Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CONF
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UvA
CONF
Commits
4927b5ba
Commit
4927b5ba
authored
Mar 08, 2017
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented user configure geni API v0
parent
a147cca7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
8 deletions
+65
-8
CloudConfigurationController0.java
...a/sne/drip/api/v0/rest/CloudConfigurationController0.java
+37
-1
Configure.java
...main/java/nl/uva/sne/drip/commons/v0/types/Configure.java
+9
-0
CloudCredentials.java
...va/nl/uva/sne/drip/commons/v1/types/CloudCredentials.java
+19
-7
No files found.
drip-api/src/main/java/nl/uva/sne/drip/api/v0/rest/CloudConfigurationController0.java
View file @
4927b5ba
...
...
@@ -32,6 +32,7 @@ import nl.uva.sne.drip.api.exception.NullKeyException;
import
nl.uva.sne.drip.api.exception.NullKeyIDException
;
import
nl.uva.sne.drip.api.service.UserService
;
import
nl.uva.sne.drip.commons.v0.types.Configure
;
import
nl.uva.sne.drip.commons.v1.types.LoginKey
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
...
@@ -53,7 +54,7 @@ public class CloudConfigurationController0 {
@RequestMapping
(
value
=
"/ec2"
,
method
=
RequestMethod
.
POST
,
consumes
=
MediaType
.
TEXT_XML_VALUE
)
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
public
@ResponseBody
String
postConf
(
@RequestBody
Configure
configure
)
{
String
post
EC2
Conf
(
@RequestBody
Configure
configure
)
{
if
(
configure
.
key
==
null
)
{
throw
new
NullKeyException
();
}
...
...
@@ -80,4 +81,39 @@ public class CloudConfigurationController0 {
return
"Success: "
+
cloudCredentials
.
getId
();
}
@RequestMapping
(
value
=
"/geni"
,
method
=
RequestMethod
.
POST
,
consumes
=
MediaType
.
TEXT_XML_VALUE
)
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
public
@ResponseBody
String
postGeniConf
(
@RequestBody
Configure
configure
)
{
if
(
configure
.
geniKey
==
null
)
{
throw
new
NullKeyException
();
}
if
(
configure
.
geniKeyAlias
==
null
)
{
throw
new
NullKeyIDException
();
}
CloudCredentials
cloudCredentials
=
new
CloudCredentials
();
cloudCredentials
.
setKeyIdAlias
(
configure
.
geniKeyAlias
);
cloudCredentials
.
setKey
(
configure
.
geniKey
);
cloudCredentials
.
setKeyPass
(
configure
.
geniKeyPass
);
List
<
nl
.
uva
.
sne
.
drip
.
commons
.
v1
.
types
.
LoginKey
>
loginKeys
=
new
ArrayList
<>();
for
(
nl
.
uva
.
sne
.
drip
.
commons
.
v0
.
types
.
LoginKey0
key0
:
configure
.
loginPubKey
)
{
nl
.
uva
.
sne
.
drip
.
commons
.
v1
.
types
.
LoginKey
key1
=
new
nl
.
uva
.
sne
.
drip
.
commons
.
v1
.
types
.
LoginKey
();
key1
.
setKey
(
key0
.
content
);
key1
.
setType
(
LoginKey
.
Type
.
PUBLIC
);
loginKeys
.
add
(
key1
);
}
for
(
nl
.
uva
.
sne
.
drip
.
commons
.
v0
.
types
.
LoginKey0
key0
:
configure
.
loginPriKey
)
{
nl
.
uva
.
sne
.
drip
.
commons
.
v1
.
types
.
LoginKey
key1
=
new
nl
.
uva
.
sne
.
drip
.
commons
.
v1
.
types
.
LoginKey
();
key1
.
setKey
(
key0
.
content
);
key1
.
setType
(
LoginKey
.
Type
.
PRIVATE
);
loginKeys
.
add
(
key1
);
}
cloudCredentials
.
setLogineKeys
(
loginKeys
);
cloudCredentials
.
setCloudProviderName
(
"geni"
);
cloudCredentialsDao
.
save
(
cloudCredentials
);
return
"Success: "
+
cloudCredentials
.
getId
();
}
}
drip-api/src/main/java/nl/uva/sne/drip/commons/v0/types/Configure.java
View file @
4927b5ba
...
...
@@ -33,5 +33,14 @@ public class Configure {
@XmlElement
(
name
=
"loginKey"
)
public
List
<
LoginKey0
>
loginKey
;
public
String
geniKey
;
public
String
geniKeyAlias
;
@XmlElement
(
name
=
"loginPubKey"
)
public
List
<
LoginKey0
>
loginPubKey
;
public
String
geniKeyPass
;
@XmlElement
(
name
=
"loginPriKey"
)
public
List
<
LoginKey0
>
loginPriKey
;
}
drip-api/src/main/java/nl/uva/sne/drip/commons/v1/types/CloudCredentials.java
View file @
4927b5ba
...
...
@@ -31,31 +31,27 @@ public class CloudCredentials {
@Id
private
String
id
;
private
String
key
;
private
String
keyIdAlias
;
/**
* A list of login keys that can be used to log in to the deployed VMs. All
* new lines in the 'key' field have to be replaced with the '\n'
*/
private
List
<
LoginKey
>
loginKeys
;
private
String
cloudProviderName
;
private
String
keypass
;
public
final
String
getId
()
{
return
id
;
}
public
final
void
setId
(
final
String
id
)
{
this
.
id
=
id
;
}
/**
* The key for the cloud provider.
*
* @return the key
*/
@DocumentationExample
(
"6J7uo99ifrff45126Gsy5vgb3bmrtwY6hBxtYt9y"
)
...
...
@@ -72,6 +68,7 @@ public class CloudCredentials {
/**
* The key id for the cloud provider or the key alias.
*
* @return the keyIdAlias
*/
@DocumentationExample
(
"AKIAITY3K5ZUQ6M7YBSQ"
)
...
...
@@ -88,6 +85,7 @@ public class CloudCredentials {
/**
* The login keys
*
* @return the loginKeys
*/
public
List
<
LoginKey
>
getLoginKeys
()
{
...
...
@@ -103,6 +101,7 @@ public class CloudCredentials {
/**
* The name of the cloud provider
*
* @return the cloudProviderName
*/
@DocumentationExample
(
"ec2"
)
...
...
@@ -116,4 +115,17 @@ public class CloudCredentials {
public
void
setCloudProviderName
(
String
cloudProviderName
)
{
this
.
cloudProviderName
=
cloudProviderName
;
}
public
void
setKeyPass
(
String
keyPass
)
{
this
.
keypass
=
keyPass
;
}
/**
* The password for key stores
* @return the keypass
*/
@DocumentationExample
(
"123passwd"
)
public
String
getKeypass
()
{
return
keypass
;
}
}
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