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
ad1a19cb
Commit
ad1a19cb
authored
Mar 09, 2017
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implmented execute provision for v0.0
parent
f102f1f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
2 deletions
+36
-2
ProvisionController0.java
...ava/nl/uva/sne/drip/api/v0/rest/ProvisionController0.java
+33
-2
Execute.java
...c/main/java/nl/uva/sne/drip/commons/v0/types/Execute.java
+3
-0
No files found.
drip-api/src/main/java/nl/uva/sne/drip/api/v0/rest/ProvisionController0.java
View file @
ad1a19cb
...
@@ -15,11 +15,12 @@
...
@@ -15,11 +15,12 @@
*/
*/
package
nl
.
uva
.
sne
.
drip
.
api
.
v0
.
rest
;
package
nl
.
uva
.
sne
.
drip
.
api
.
v0
.
rest
;
import
nl.uva.sne.drip.commons.v1.types.ProvisionInfo
;
import
java.io.IOException
;
import
java.io.IOException
;
import
nl.uva.sne.drip.commons.v1.types.ProvisionInfo
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.concurrent.TimeoutException
;
import
java.util.concurrent.TimeoutException
;
import
java.util.logging.Level
;
import
java.util.logging.Level
;
...
@@ -27,7 +28,6 @@ import java.util.logging.Logger;
...
@@ -27,7 +28,6 @@ import java.util.logging.Logger;
import
javax.annotation.security.RolesAllowed
;
import
javax.annotation.security.RolesAllowed
;
import
nl.uva.sne.drip.commons.utils.Converter
;
import
nl.uva.sne.drip.commons.utils.Converter
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestMethod
;
...
@@ -39,7 +39,9 @@ import nl.uva.sne.drip.api.service.ProvisionService;
...
@@ -39,7 +39,9 @@ import nl.uva.sne.drip.api.service.ProvisionService;
import
nl.uva.sne.drip.api.service.UserKeyService
;
import
nl.uva.sne.drip.api.service.UserKeyService
;
import
nl.uva.sne.drip.api.service.UserScriptService
;
import
nl.uva.sne.drip.api.service.UserScriptService
;
import
nl.uva.sne.drip.api.service.UserService
;
import
nl.uva.sne.drip.api.service.UserService
;
import
nl.uva.sne.drip.commons.v0.types.Execute
;
import
nl.uva.sne.drip.commons.v0.types.File
;
import
nl.uva.sne.drip.commons.v0.types.File
;
import
nl.uva.sne.drip.commons.v0.types.Result
;
import
nl.uva.sne.drip.commons.v0.types.Upload
;
import
nl.uva.sne.drip.commons.v0.types.Upload
;
import
nl.uva.sne.drip.commons.v1.types.CloudCredentials
;
import
nl.uva.sne.drip.commons.v1.types.CloudCredentials
;
import
nl.uva.sne.drip.commons.v1.types.LoginKey
;
import
nl.uva.sne.drip.commons.v1.types.LoginKey
;
...
@@ -136,4 +138,33 @@ public class ProvisionController0 {
...
@@ -136,4 +138,33 @@ public class ProvisionController0 {
+
provInfo
.
getId
();
+
provInfo
.
getId
();
}
}
@RequestMapping
(
value
=
"/execute"
,
method
=
RequestMethod
.
POST
,
consumes
=
MediaType
.
TEXT_XML_VALUE
)
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
public
@ResponseBody
Result
execute
(
@RequestBody
Execute
exc
)
{
try
{
ProvisionInfo
req
=
provisionService
.
findOne
(
exc
.
action
);
req
=
provisionService
.
provisionResources
(
req
);
Map
<
String
,
Object
>
map
=
req
.
getKeyValue
();
String
yaml
=
Converter
.
map2YmlString
(
map
);
yaml
=
yaml
.
replaceAll
(
"\n"
,
"\\\\n"
);
Result
res
=
new
Result
();
List
<
File
>
files
=
new
ArrayList
<>();
File
e
=
new
File
();
e
.
content
=
yaml
;
e
.
level
=
"0"
;
e
.
name
=
"provisioned_"
+
exc
.
action
;
files
.
add
(
e
);
res
.
info
=
"INFO"
;
res
.
status
=
"Success"
;
res
.
file
=
files
;
return
res
;
}
catch
(
IOException
|
TimeoutException
|
JSONException
|
InterruptedException
ex
)
{
Logger
.
getLogger
(
ProvisionController0
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
}
return
null
;
}
}
}
drip-api/src/main/java/nl/uva/sne/drip/commons/v0/types/Execute.java
View file @
ad1a19cb
...
@@ -15,10 +15,13 @@
...
@@ -15,10 +15,13 @@
*/
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
v0
.
types
;
package
nl
.
uva
.
sne
.
drip
.
commons
.
v0
.
types
;
import
javax.xml.bind.annotation.XmlRootElement
;
/**
/**
*
*
* @author S. Koulouzis
* @author S. Koulouzis
*/
*/
@XmlRootElement
public
class
Execute
{
public
class
Execute
{
public
String
user
;
public
String
user
;
...
...
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