Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
P
Project
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Labels
Merge Requests
4
Merge Requests
4
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Coscine
B
backend
apis
Project
Commits
f50bd8f7
Commit
f50bd8f7
authored
Dec 16, 2019
by
Marcel Nellesen
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New: Included Mockup for bucket Application (coscine/issues#527)
parent
aa44dd00
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
200 additions
and
44 deletions
+200
-44
src/Project.Tests/DefaultControllerTests.cs
src/Project.Tests/DefaultControllerTests.cs
+1
-2
src/Project.Tests/Project.Tests.csproj
src/Project.Tests/Project.Tests.csproj
+2
-2
src/Project.Tests/ResourceControllerTests.cs
src/Project.Tests/ResourceControllerTests.cs
+2
-2
src/Project.Tests/ResourceTypeControllerTests.cs
src/Project.Tests/ResourceTypeControllerTests.cs
+2
-3
src/Project.Tests/app.config
src/Project.Tests/app.config
+1
-1
src/Project.Tests/packages.config
src/Project.Tests/packages.config
+1
-1
src/Project/App.config
src/Project/App.config
+1
-1
src/Project/Controllers/DataSourceController.cs
src/Project/Controllers/DataSourceController.cs
+61
-13
src/Project/Controllers/ResourceTypeController.cs
src/Project/Controllers/ResourceTypeController.cs
+8
-1
src/Project/Models/ResourceModel.cs
src/Project/Models/ResourceModel.cs
+56
-9
src/Project/Models/S3ResourceTypeModel.cs
src/Project/Models/S3ResourceTypeModel.cs
+35
-0
src/Project/Project.csproj
src/Project/Project.csproj
+4
-2
src/Project/ReturnObjects/RDSResourceTypeObject.cs
src/Project/ReturnObjects/RDSResourceTypeObject.cs
+3
-6
src/Project/ReturnObjects/S3ResourceTypeObject.cs
src/Project/ReturnObjects/S3ResourceTypeObject.cs
+22
-0
src/Project/packages.config
src/Project/packages.config
+1
-1
No files found.
src/Project.Tests/DefaultControllerTests.cs
View file @
f50bd8f7
...
...
@@ -144,9 +144,8 @@ namespace Coscine.Api.Project.Tests
RDSResourceTypeModel
rdsResourceTypeModel
=
new
RDSResourceTypeModel
();
RdsResourceType
=
new
RDSResourceType
()
{
AccessKey
=
"a"
,
SecretKey
=
"b"
,
BucketName
=
"c"
,
Size
=
25
,
};
rdsResourceTypeModel
.
Insert
(
RdsResourceType
);
...
...
src/Project.Tests/Project.Tests.csproj
View file @
f50bd8f7
...
...
@@ -65,8 +65,8 @@
<Reference
Include=
"Coscine.Configuration, Version=1.4.0.0, Culture=neutral, PublicKeyToken=ce3d7a32d7dc1e5a, processorArchitecture=MSIL"
>
<HintPath>
..\packages\Coscine.Configuration.1.4.0\lib\net461\Coscine.Configuration.dll
</HintPath>
</Reference>
<Reference
Include=
"Coscine.Database, Version=1.1
0
.0.0, Culture=neutral, PublicKeyToken=767d77427707b70a, processorArchitecture=MSIL"
>
<HintPath>
..\packages\Coscine.Database.1.1
0
.0\lib\net461\Coscine.Database.dll
</HintPath>
<Reference
Include=
"Coscine.Database, Version=1.1
1
.0.0, Culture=neutral, PublicKeyToken=767d77427707b70a, processorArchitecture=MSIL"
>
<HintPath>
..\packages\Coscine.Database.1.1
1
.0\lib\net461\Coscine.Database.dll
</HintPath>
</Reference>
<Reference
Include=
"Coscine.ProxyApi, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL"
>
<HintPath>
..\packages\Coscine.ProxyApi.1.2.0\lib\net461\Coscine.ProxyApi.dll
</HintPath>
...
...
src/Project.Tests/ResourceControllerTests.cs
View file @
f50bd8f7
...
...
@@ -53,7 +53,7 @@ namespace Coscine.Api.Project.Tests
ResourceObject
resourceObject
=
(
ResourceObject
)
okObjectResult
.
Value
;
resourceObject
.
DisplayName
=
"OtherName"
;
resourceObject
.
ResourceTypeOption
=
JObject
.
FromObject
(
new
RDSResourceTypeObject
(
Guid
.
NewGuid
(),
"PITLABTTEST"
,
"accesskey"
,
"secretkey"
));
resourceObject
.
ResourceTypeOption
=
JObject
.
FromObject
(
new
RDSResourceTypeObject
(
Guid
.
NewGuid
(),
"PITLABTTEST"
,
0
));
Stream
stream
=
ObjectFactory
<
ResourceObject
>.
SerializeToStream
(
resourceObject
);
...
...
@@ -97,7 +97,7 @@ namespace Coscine.Api.Project.Tests
new
List
<
DisciplineObject
>()
{
new
DisciplineObject
(
Discipline
.
Id
,
Discipline
.
Url
,
Discipline
.
DisplayNameDe
,
Discipline
.
DisplayNameEn
)
},
new
VisibilityObject
(
Visibility
.
Id
,
Visibility
.
DisplayName
),
new
LicenseObject
(
License
.
Id
,
License
.
DisplayName
),
JObject
.
FromObject
(
new
RDSResourceTypeObject
(
Guid
.
NewGuid
(),
"PITLABTTEST"
,
"accesskey"
,
"secretkey"
)),
JObject
.
FromObject
(
new
RDSResourceTypeObject
(
Guid
.
NewGuid
(),
"PITLABTTEST"
,
0
)),
"link"
,
JToken
.
Parse
(
"{}"
)
);
...
...
src/Project.Tests/ResourceTypeControllerTests.cs
View file @
f50bd8f7
...
...
@@ -24,11 +24,10 @@ namespace Coscine.Api.Project.Tests
OkObjectResult
okObjectResult
=
(
OkObjectResult
)
actionResult
;
List
<
string
>
fields
=
(
List
<
string
>)
okObjectResult
.
Value
;
if
(
fields
.
Count
()
==
3
)
if
(
fields
.
Count
()
==
2
)
{
Assert
.
IsTrue
(
fields
[
0
]
==
"BucketName"
);
Assert
.
IsTrue
(
fields
[
1
]
==
"AccessKey"
);
Assert
.
IsTrue
(
fields
[
2
]
==
"SecretKey"
);
Assert
.
IsTrue
(
fields
[
1
]
==
"Size"
);
}
else
{
...
...
src/Project.Tests/app.config
View file @
f50bd8f7
...
...
@@ -88,7 +88,7 @@
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"Coscine.Database"
publicKeyToken
=
"767d77427707b70a"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.1
0.0.0"
newVersion
=
"1.10
.0.0"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.1
1.0.0"
newVersion
=
"1.11
.0.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.IdentityModel.Tokens.Jwt"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
...
...
src/Project.Tests/packages.config
View file @
f50bd8f7
...
...
@@ -7,7 +7,7 @@
<
package
id
=
"Coscine.Action"
version
=
"1.7.0"
targetFramework
=
"net472"
/>
<
package
id
=
"Coscine.ApiCommons"
version
=
"1.2.2"
targetFramework
=
"net472"
/>
<
package
id
=
"Coscine.Configuration"
version
=
"1.4.0"
targetFramework
=
"net472"
/>
<
package
id
=
"Coscine.Database"
version
=
"1.1
0
.0"
targetFramework
=
"net472"
/>
<
package
id
=
"Coscine.Database"
version
=
"1.1
1
.0"
targetFramework
=
"net472"
/>
<
package
id
=
"Coscine.ProxyApi"
version
=
"1.2.0"
targetFramework
=
"net472"
/>
<
package
id
=
"Coscine.SharePoint.Webparts.Vue"
version
=
"1.4.0"
targetFramework
=
"net472"
/>
<
package
id
=
"dotNetRDF"
version
=
"2.2.1"
targetFramework
=
"net472"
/>
...
...
src/Project/App.config
View file @
f50bd8f7
...
...
@@ -91,7 +91,7 @@
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"Coscine.Database"
publicKeyToken
=
"767d77427707b70a"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.1
0.0.0"
newVersion
=
"1.10
.0.0"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.1
1.0.0"
newVersion
=
"1.11
.0.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.IdentityModel.Tokens.Jwt"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
...
...
src/Project/Controllers/DataSourceController.cs
View file @
f50bd8f7
...
...
@@ -73,7 +73,7 @@ namespace Coscine.Api.Project.Controllers
else
{
// If the path is null, an empty string is added.
string
url
=
$"
{
_configuration
.
GetString
(
"coscine/global/waterbutler_url"
)}{
resource
.
Type
.
DisplayName
.
ToLower
(
)}{
path
}
"
;
string
url
=
$"
{
_configuration
.
GetString
(
"coscine/global/waterbutler_url"
)}{
GetResourceTypeName
(
resource
)}{
path
}
"
;
var
request
=
new
HttpRequestMessage
(
HttpMethod
.
Get
,
url
);
request
.
Headers
.
Authorization
=
new
AuthenticationHeaderValue
(
"Bearer"
,
authHeader
);
...
...
@@ -127,7 +127,7 @@ namespace Coscine.Api.Project.Controllers
else
{
// If the path is null, an empty string is added.
string
url
=
$"
{
_configuration
.
GetString
(
"coscine/global/waterbutler_url"
)}{
resource
.
Type
.
DisplayName
.
ToLower
(
)}
/?kind=file&name=
{
path
}
"
;
string
url
=
$"
{
_configuration
.
GetString
(
"coscine/global/waterbutler_url"
)}{
GetResourceTypeName
(
resource
)}
/?kind=file&name=
{
path
}
"
;
try
{
...
...
@@ -176,7 +176,7 @@ namespace Coscine.Api.Project.Controllers
else
{
// If the path is null, an empty string is added.
string
url
=
$"
{
_configuration
.
GetString
(
"coscine/global/waterbutler_url"
)}{
resource
.
Type
.
DisplayName
.
ToLower
(
)}
/
{
path
}
?kind=file"
;
string
url
=
$"
{
_configuration
.
GetString
(
"coscine/global/waterbutler_url"
)}{
GetResourceTypeName
(
resource
)}
/
{
path
}
?kind=file"
;
try
{
...
...
@@ -198,6 +198,29 @@ namespace Coscine.Api.Project.Controllers
}
}
private
string
GetResourceTypeName
(
Resource
resource
)
{
if
(
resource
.
Type
.
DisplayName
.
ToLower
().
Equals
(
"s3"
))
{
return
"rds"
;
}
else
{
return
resource
.
Type
.
DisplayName
.
ToLower
();
}
}
private
string
GetResourceTypeName
(
JToken
resource
)
{
if
(
resource
[
"type"
][
"displayName"
].
ToString
().
ToLower
().
Equals
(
"s3"
))
{
return
"rds"
;
}
else
{
return
resource
[
"type"
][
"displayName"
].
ToString
().
ToLower
();
}
}
public
async
Task
<
HttpResponseMessage
>
UploadFile
(
string
url
,
string
authHeader
,
Stream
stream
)
{
...
...
@@ -230,7 +253,7 @@ namespace Coscine.Api.Project.Controllers
else
{
// If the path is null, an empty string is added.
string
url
=
$"
{
_configuration
.
GetString
(
"coscine/global/waterbutler_url"
)}{
resource
.
Type
.
DisplayName
.
ToLower
(
)}{
path
}
"
;
string
url
=
$"
{
_configuration
.
GetString
(
"coscine/global/waterbutler_url"
)}{
GetResourceTypeName
(
resource
)}{
path
}
"
;
var
request
=
new
HttpRequestMessage
(
HttpMethod
.
Delete
,
url
);
request
.
Headers
.
Authorization
=
new
AuthenticationHeaderValue
(
"Bearer"
,
authHeader
);
...
...
@@ -265,13 +288,13 @@ namespace Coscine.Api.Project.Controllers
string
authHeader
=
null
;
if
(
resource
[
"type"
][
"displayName"
].
ToString
().
ToLower
()
==
"
rds
"
)
if
(
resource
[
"type"
][
"displayName"
].
ToString
().
ToLower
()
==
"
s3
"
)
{
RDSResourceType
rdsResourceType
=
new
RDS
ResourceType
();
rds
ResourceType
.
BucketName
=
resource
[
"resourceTypeOption"
][
"BucketName"
].
ToString
();
rds
ResourceType
.
AccessKey
=
resource
[
"resourceTypeOption"
][
"AccessKey"
].
ToString
();
rds
ResourceType
.
SecretKey
=
resource
[
"resourceTypeOption"
][
"SecretKey"
].
ToString
();
authHeader
=
Build
RdsAuthHeader
(
rds
ResourceType
);
S3ResourceType
s3ResourceType
=
new
S3
ResourceType
();
s3
ResourceType
.
BucketName
=
resource
[
"resourceTypeOption"
][
"BucketName"
].
ToString
();
s3
ResourceType
.
AccessKey
=
resource
[
"resourceTypeOption"
][
"AccessKey"
].
ToString
();
s3
ResourceType
.
SecretKey
=
resource
[
"resourceTypeOption"
][
"SecretKey"
].
ToString
();
authHeader
=
Build
S3AuthHeader
(
s3
ResourceType
);
}
else
if
(
resource
[
"type"
][
"displayName"
].
ToString
().
ToLower
()
==
"gitlab"
)
{
...
...
@@ -289,7 +312,7 @@ namespace Coscine.Api.Project.Controllers
else
{
// If the path is null, an empty string is added.
string
url
=
$"
{
_configuration
.
GetString
(
"coscine/global/waterbutler_url"
)}{
resource
[
"type"
][
"displayName"
].
ToString
().
ToLower
(
)}{
path
}
"
;
string
url
=
$"
{
_configuration
.
GetString
(
"coscine/global/waterbutler_url"
)}{
GetResourceTypeName
(
resource
)}{
path
}
"
;
var
request
=
new
HttpRequestMessage
(
HttpMethod
.
Get
,
url
);
request
.
Headers
.
Authorization
=
new
AuthenticationHeaderValue
(
"Bearer"
,
authHeader
);
...
...
@@ -413,6 +436,13 @@ namespace Coscine.Api.Project.Controllers
authHeader
=
BuildRdsAuthHeader
(
rdsResourceType
);
}
else
if
(
resource
.
Type
.
DisplayName
.
ToLower
()
==
"s3"
)
{
S3ResourceTypeModel
s3ResourceTypeModel
=
new
S3ResourceTypeModel
();
var
s3ResourceType
=
s3ResourceTypeModel
.
GetById
(
resource
.
ResourceTypeOptionId
.
Value
);
authHeader
=
BuildS3AuthHeader
(
s3ResourceType
);
}
else
if
(
resource
.
Type
.
DisplayName
.
ToLower
()
==
"gitlab"
)
{
GitlabResourceTypeModel
gitlabResourceTypeModel
=
new
GitlabResourceTypeModel
();
...
...
@@ -430,8 +460,8 @@ namespace Coscine.Api.Project.Controllers
var
credentials
=
new
Dictionary
<
string
,
object
>
{
{
"access_key"
,
rdsResourceType
.
AccessKey
},
{
"secret_key"
,
rdsResourceType
.
SecretKey
}
{
"access_key"
,
_configuration
.
GetStringAndWait
(
"coscine/global/buckets/accessKey"
)
},
{
"secret_key"
,
_configuration
.
GetStringAndWait
(
"coscine/global/buckets/secretKey"
)
}
};
var
settings
=
new
Dictionary
<
string
,
object
>
...
...
@@ -442,6 +472,24 @@ namespace Coscine.Api.Project.Controllers
return
BuildWaterbutlerPayload
(
auth
,
credentials
,
settings
);
}
private
string
BuildS3AuthHeader
(
S3ResourceType
s3ResourceType
)
{
var
auth
=
new
Dictionary
<
string
,
object
>();
var
credentials
=
new
Dictionary
<
string
,
object
>
{
{
"access_key"
,
s3ResourceType
.
AccessKey
},
{
"secret_key"
,
s3ResourceType
.
SecretKey
}
};
var
settings
=
new
Dictionary
<
string
,
object
>
{
{
"bucket"
,
s3ResourceType
.
BucketName
}
};
return
BuildWaterbutlerPayload
(
auth
,
credentials
,
settings
);
}
private
string
BuildGitlabAuthHeader
(
GitlabResourceType
gitlabResourceType
)
{
...
...
src/Project/Controllers/ResourceTypeController.cs
View file @
f50bd8f7
...
...
@@ -38,7 +38,14 @@ namespace Coscine.Api.Project.Controllers
{
var
resourceType
=
_resourceTypeModel
.
GetById
(
Guid
.
Parse
(
id
));
if
(
resourceType
.
DisplayName
==
"rds"
)
if
(
resourceType
.
DisplayName
==
"s3"
)
{
return
Type
.
GetType
(
"Coscine.Api.Project.ReturnObjects.S3ResourceTypeObject"
).
GetProperties
()
.
Where
((
property
)
=>
property
.
Name
!=
"Id"
)
.
Select
((
property
)
=>
property
.
Name
)
.
ToList
();
}
else
if
(
resourceType
.
DisplayName
==
"rds"
)
{
return
Type
.
GetType
(
"Coscine.Api.Project.ReturnObjects.RDSResourceTypeObject"
).
GetProperties
()
.
Where
((
property
)
=>
property
.
Name
!=
"Id"
)
...
...
src/Project/Models/ResourceModel.cs
View file @
f50bd8f7
using
Coscine.Api.Project.ReturnObjects
;
using
Coscine.ApiCommons.Models
;
using
Coscine.Configuration
;
using
Coscine.Database.Model
;
using
LinqToDB
;
using
Newtonsoft.Json.Linq
;
...
...
@@ -12,8 +13,11 @@ namespace Coscine.Api.Project.Models
{
public
class
ResourceModel
:
DatabaseModel
<
Resource
>
{
private
readonly
IConfiguration
_configuration
;
public
ResourceModel
()
:
base
(
Program
.
Configuration
)
{
_configuration
=
Program
.
Configuration
;
}
public
Resource
StoreFromObject
(
ResourceObject
resourceObject
)
...
...
@@ -84,26 +88,47 @@ namespace Coscine.Api.Project.Models
if
(
resource
.
ResourceTypeOptionId
!=
null
)
{
RDSResourceType
rdsResourceType
=
rdsResourceTypeModel
.
GetById
(
resource
.
ResourceTypeOptionId
.
Value
);
rdsResourceType
.
BucketName
=
rdsResourceTypeObject
.
BucketName
;
rdsResourceType
.
AccessKey
=
rdsResourceTypeObject
.
AccessKey
??
rdsResourceType
.
AccessKey
;
rdsResourceType
.
SecretKey
=
rdsResourceTypeObject
.
SecretKey
??
rdsResourceType
.
SecretKey
;
rdsResourceTypeModel
.
Update
(
rdsResourceType
);
}
else
{
RDSResourceType
rdsResourceType
=
new
RDSResourceType
()
{
BucketName
=
rdsResourceTypeObject
.
BucketName
,
AccessKey
=
rdsResourceTypeObject
.
AccessKey
,
SecretKey
=
rdsResourceTypeObject
.
SecretKey
BucketName
=
GetRDSBucketName
(),
Size
=
rdsResourceTypeObject
.
Size
,
};
rdsResourceTypeModel
.
Insert
(
rdsResourceType
);
resource
.
ResourceTypeOptionId
=
rdsResourceType
.
Id
;
Update
(
resource
);
}
}
else
if
(
resource
.
Type
.
DisplayName
==
"s3"
)
{
S3ResourceTypeObject
s3ResourceTypeObject
=
resourceTypeOption
.
ToObject
<
S3ResourceTypeObject
>();
S3ResourceTypeModel
s3ResourceTypeModel
=
new
S3ResourceTypeModel
();
if
(
resource
.
ResourceTypeOptionId
!=
null
)
{
S3ResourceType
s3ResourceType
=
s3ResourceTypeModel
.
GetById
(
resource
.
ResourceTypeOptionId
.
Value
);
s3ResourceType
.
BucketName
=
s3ResourceTypeObject
.
BucketName
;
s3ResourceType
.
AccessKey
=
s3ResourceTypeObject
.
AccessKey
??
s3ResourceType
.
AccessKey
;
s3ResourceType
.
SecretKey
=
s3ResourceTypeObject
.
SecretKey
??
s3ResourceType
.
SecretKey
;
s3ResourceTypeModel
.
Update
(
s3ResourceType
);
}
else
{
S3ResourceType
s3ResourceType
=
new
S3ResourceType
()
{
BucketName
=
s3ResourceTypeObject
.
BucketName
,
AccessKey
=
s3ResourceTypeObject
.
AccessKey
,
SecretKey
=
s3ResourceTypeObject
.
SecretKey
};
s3ResourceTypeModel
.
Insert
(
s3ResourceType
);
resource
.
ResourceTypeOptionId
=
s3ResourceType
.
Id
;
Update
(
resource
);
}
}
else
if
(
resource
.
Type
.
DisplayName
==
"gitlab"
)
{
GitlabResourceTypeObject
gitlabResourceTypeObject
=
resourceTypeOption
.
ToObject
<
GitlabResourceTypeObject
>();
...
...
@@ -137,6 +162,17 @@ namespace Coscine.Api.Project.Models
}
}
private
string
GetRDSBucketName
()
{
var
prefix
=
_configuration
.
GetStringAndWait
(
"coscine/global/buckets/prefix"
);
var
number
=
Int32
.
Parse
(
_configuration
.
GetStringAndWait
(
"coscine/global/buckets/currentid"
));
var
maxNumber
=
Int32
.
Parse
(
_configuration
.
GetStringAndWait
(
"coscine/global/buckets/highestid"
));
var
newNumber
=
number
%
maxNumber
==
0
?
1
:
number
+
1
;
_configuration
.
Put
(
"coscine/global/buckets/currentid"
,
""
+
newNumber
);
return
String
.
Format
(
"{0}{1,3:000}"
,
prefix
,
number
);
}
private
void
SetDisciplines
(
Resource
resource
,
IEnumerable
<
DisciplineObject
>
disciplines
)
{
ResourceDisciplineModel
resourceDisciplineModel
=
new
ResourceDisciplineModel
();
...
...
@@ -220,6 +256,11 @@ namespace Coscine.Api.Project.Models
RDSResourceTypeModel
rdsResourceTypeModel
=
new
RDSResourceTypeModel
();
rdsResourceTypeModel
.
Delete
(
rdsResourceTypeModel
.
GetById
(
resource
.
ResourceTypeOptionId
.
Value
));
}
else
if
(
resource
.
Type
.
DisplayName
==
"s3"
&&
resource
.
ResourceTypeOptionId
!=
null
)
{
S3ResourceTypeModel
s3ResourceTypeModel
=
new
S3ResourceTypeModel
();
s3ResourceTypeModel
.
Delete
(
s3ResourceTypeModel
.
GetById
(
resource
.
ResourceTypeOptionId
.
Value
));
}
else
if
(
resource
.
Type
.
DisplayName
==
"gitlab"
&&
resource
.
ResourceTypeOptionId
!=
null
)
{
GitlabResourceTypeModel
gitlabResourceTypeModel
=
new
GitlabResourceTypeModel
();
...
...
@@ -255,7 +296,13 @@ namespace Coscine.Api.Project.Models
{
RDSResourceTypeModel
rdsResourceTypeModel
=
new
RDSResourceTypeModel
();
var
rdsResourceType
=
rdsResourceTypeModel
.
GetById
(
resource
.
ResourceTypeOptionId
.
Value
);
resourceTypeOptionObject
=
new
RDSResourceTypeObject
(
rdsResourceType
.
Id
,
rdsResourceType
.
BucketName
,
null
,
null
);
resourceTypeOptionObject
=
new
RDSResourceTypeObject
(
rdsResourceType
.
Id
,
rdsResourceType
.
BucketName
,
(
int
)
rdsResourceType
.
Size
);
}
else
if
(
resource
.
Type
.
DisplayName
==
"s3"
&&
resource
.
ResourceTypeOptionId
!=
null
)
{
S3ResourceTypeModel
s3ResourceTypeModel
=
new
S3ResourceTypeModel
();
var
s3ResourceType
=
s3ResourceTypeModel
.
GetById
(
resource
.
ResourceTypeOptionId
.
Value
);
resourceTypeOptionObject
=
new
S3ResourceTypeObject
(
s3ResourceType
.
Id
,
s3ResourceType
.
BucketName
,
null
,
null
);
}
else
if
(
resource
.
Type
.
DisplayName
==
"gitlab"
&&
resource
.
ResourceTypeOptionId
!=
null
)
{
...
...
src/Project/Models/S3ResourceTypeModel.cs
0 → 100644
View file @
f50bd8f7
using
Coscine.ApiCommons.Models
;
using
Coscine.Database.Model
;
using
LinqToDB
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq.Expressions
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
Coscine.Api.Project.Models
{
public
class
S3ResourceTypeModel
:
DatabaseModel
<
S3ResourceType
>
{
public
S3ResourceTypeModel
()
:
base
(
Program
.
Configuration
)
{
}
public
override
Expression
<
Func
<
S3ResourceType
,
Guid
>>
GetIdFromObject
()
{
return
(
rdsResourceType
)
=>
rdsResourceType
.
Id
;
}
public
override
ITable
<
S3ResourceType
>
GetITableFromDatabase
(
CoscineDB
db
)
{
return
db
.
S3ResourceTypes
;
}
public
override
void
SetObjectId
(
S3ResourceType
databaseObject
,
Guid
id
)
{
databaseObject
.
Id
=
id
;
}
}
}
src/Project/Project.csproj
View file @
f50bd8f7
...
...
@@ -54,8 +54,8 @@
<Reference
Include=
"Coscine.Configuration, Version=1.4.0.0, Culture=neutral, PublicKeyToken=ce3d7a32d7dc1e5a, processorArchitecture=MSIL"
>
<HintPath>
..\packages\Coscine.Configuration.1.4.0\lib\net461\Coscine.Configuration.dll
</HintPath>
</Reference>
<Reference
Include=
"Coscine.Database, Version=1.1
0
.0.0, Culture=neutral, PublicKeyToken=767d77427707b70a, processorArchitecture=MSIL"
>
<HintPath>
..\packages\Coscine.Database.1.1
0
.0\lib\net461\Coscine.Database.dll
</HintPath>
<Reference
Include=
"Coscine.Database, Version=1.1
1
.0.0, Culture=neutral, PublicKeyToken=767d77427707b70a, processorArchitecture=MSIL"
>
<HintPath>
..\packages\Coscine.Database.1.1
1
.0\lib\net461\Coscine.Database.dll
</HintPath>
</Reference>
<Reference
Include=
"Coscine.ProxyApi, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL"
>
<HintPath>
..\packages\Coscine.ProxyApi.1.2.0\lib\net461\Coscine.ProxyApi.dll
</HintPath>
...
...
@@ -606,6 +606,7 @@
<Compile
Include=
"Models\ProjectModel.cs"
/>
<Compile
Include=
"Models\ProjectResourceModel.cs"
/>
<Compile
Include=
"Models\ProjectRoleModel.cs"
/>
<Compile
Include=
"Models\S3ResourceTypeModel.cs"
/>
<Compile
Include=
"Models\RDSResourceTypeModel.cs"
/>
<Compile
Include=
"Models\ResourceDisciplineModel.cs"
/>
<Compile
Include=
"Models\MetadataModel.cs"
/>
...
...
@@ -619,6 +620,7 @@
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<Compile
Include=
"ReturnObjects\GitlabResourceTypeObject.cs"
/>
<Compile
Include=
"ReturnObjects\LicenseObject.cs"
/>
<Compile
Include=
"ReturnObjects\S3ResourceTypeObject.cs"
/>
<Compile
Include=
"ReturnObjects\RDSResourceTypeObject.cs"
/>
<Compile
Include=
"ReturnObjects\ResourceTypeOptionObject.cs"
/>
<Compile
Include=
"ReturnObjects\VisibilityObject.cs"
/>
...
...
src/Project/ReturnObjects/RDSResourceTypeObject.cs
View file @
f50bd8f7
...
...
@@ -7,16 +7,13 @@ namespace Coscine.Api.Project.ReturnObjects
{
public
Guid
Id
{
get
;
set
;
}
public
string
BucketName
{
get
;
set
;
}
public
string
AccessKey
{
get
;
set
;
}
public
string
SecretKey
{
get
;
set
;
}
public
int
Size
{
get
;
set
;
}
public
RDSResourceTypeObject
(
Guid
id
,
string
bucketName
,
string
accessKey
,
string
secretKey
)
public
RDSResourceTypeObject
(
Guid
id
,
string
bucketName
,
int
size
)
{
Id
=
id
;
BucketName
=
bucketName
;
AccessKey
=
accessKey
;
SecretKey
=
secretKey
;
Size
=
size
;
}
}
}
src/Project/ReturnObjects/S3ResourceTypeObject.cs
0 → 100644
View file @
f50bd8f7
using
System
;
namespace
Coscine.Api.Project.ReturnObjects
{
[
Serializable
]
public
class
S3ResourceTypeObject
:
ResourceTypeOptionObject
{
public
Guid
Id
{
get
;
set
;
}
public
string
BucketName
{
get
;
set
;
}
public
string
AccessKey
{
get
;
set
;
}
public
string
SecretKey
{
get
;
set
;
}
public
S3ResourceTypeObject
(
Guid
id
,
string
bucketName
,
string
accessKey
,
string
secretKey
)
{
Id
=
id
;
BucketName
=
bucketName
;
AccessKey
=
accessKey
;
SecretKey
=
secretKey
;
}
}
}
src/Project/packages.config
View file @
f50bd8f7
...
...
@@ -6,7 +6,7 @@
<
package
id
=
"Coscine.Action"
version
=
"1.7.0"
targetFramework
=
"net472"
/>
<
package
id
=
"Coscine.ApiCommons"
version
=
"1.2.2"
targetFramework
=
"net472"
/>
<
package
id
=
"Coscine.Configuration"
version
=
"1.4.0"
targetFramework
=
"net472"
/>
<
package
id
=
"Coscine.Database"
version
=
"1.1
0
.0"
targetFramework
=
"net472"
/>
<
package
id
=
"Coscine.Database"
version
=
"1.1
1
.0"
targetFramework
=
"net472"
/>
<
package
id
=
"Coscine.ProxyApi"
version
=
"1.2.0"
targetFramework
=
"net472"
/>
<
package
id
=
"Coscine.SharePoint.Webparts.Vue"
version
=
"1.4.0"
targetFramework
=
"net472"
/>
<
package
id
=
"dotNetRDF"
version
=
"2.2.1"
targetFramework
=
"net472"
/>
...
...
CoscineBot
⚙
@CoscineBot
mentioned in commit
18012a3c
·
Dec 16, 2019
mentioned in commit
18012a3c
mentioned in commit 18012a3c0d753a4dbe673465a1cafa24535e56ff
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment