Commit d5334ea6 authored by Spiros Koulouzis's avatar Spiros Koulouzis

Documentation

parent f28be060
......@@ -44,7 +44,7 @@ import org.springframework.web.bind.annotation.RequestBody;
* @author S. Koulouzis
*/
@RestController
@RequestMapping("/user/v0.0/switch/account/configure/")
@RequestMapping("/user/v0.0/switch/account/configure")
@Component
public class CloudConfigurationController0 {
......
......@@ -41,7 +41,7 @@ import org.springframework.web.bind.annotation.RequestBody;
* @author S. Koulouzis
*/
@RestController
@RequestMapping("/user/v0.0/switch/deploy/")
@RequestMapping("/user/v0.0/switch/deploy")
@Component
@PreAuthorize("isAuthenticated()")
public class DeployController0 {
......@@ -49,14 +49,14 @@ public class DeployController0 {
@Autowired
private DeployClusterService deployService;
@RequestMapping(value = "/kubernetes", method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE)
@RequestMapping(value = "/kubernetes", method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE)
@RolesAllowed({UserService.USER, UserService.ADMIN})
public @ResponseBody
Result deployKubernetes(@RequestBody Deploy deploy) {
return deploy(deploy, "kubernetes");
}
@RequestMapping(value = "/swarm", method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE)
@RequestMapping(value = "/swarm", method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE)
@RolesAllowed({UserService.USER, UserService.ADMIN})
public @ResponseBody
Result deploySwarm(@RequestBody Deploy deploy) {
......
......@@ -56,7 +56,7 @@ public class PlannerController0 {
@Autowired
private ToscaService toscaService;
@RequestMapping(value = "/planning", method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE)
@RequestMapping(value = "/planning", method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE)
@RolesAllowed({UserService.USER, UserService.ADMIN})
public @ResponseBody
Result plan(@RequestBody Plan plan0) {
......
......@@ -58,7 +58,7 @@ import org.springframework.web.bind.annotation.RequestBody;
* @author S. Koulouzis
*/
@RestController
@RequestMapping("/user/v0.0/switch/provision/")
@RequestMapping("/user/v0.0/switch/provision")
@Component
@PreAuthorize("isAuthenticated()")
public class ProvisionController0 {
......@@ -78,8 +78,6 @@ public class ProvisionController0 {
@Autowired
private PlannerService planService;
@RequestMapping(value = "/upload", method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE)
@RolesAllowed({UserService.USER, UserService.ADMIN})
public @ResponseBody
......@@ -121,7 +119,7 @@ public class ProvisionController0 {
+ provInfo.getId();
}
@RequestMapping(value = "/execute", method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE)
@RequestMapping(value = "/execute", method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE)
@RolesAllowed({UserService.USER, UserService.ADMIN})
public @ResponseBody
Result execute(@RequestBody Execute exc) {
......
......@@ -39,7 +39,7 @@ import org.springframework.web.bind.annotation.RequestBody;
* @author S. Koulouzis
*/
@RestController
@RequestMapping("/manager/v0.0/switch/account/")
@RequestMapping("/manager/v0.0/switch/account")
@Component
public class UserController0 {
......
......@@ -15,8 +15,6 @@
*/
package nl.uva.sne.drip.api.v0.rest;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.security.RolesAllowed;
import nl.uva.sne.drip.api.service.ProvisionService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -28,7 +26,6 @@ import org.springframework.web.bind.annotation.RestController;
import nl.uva.sne.drip.api.service.UserKeyService;
import nl.uva.sne.drip.api.service.UserService;
import nl.uva.sne.drip.commons.v0.types.ConfUserKey;
import nl.uva.sne.drip.commons.v0.types.Attribute;
import nl.uva.sne.drip.commons.v1.types.LoginKey;
import nl.uva.sne.drip.commons.v1.types.ProvisionInfo;
import org.springframework.http.MediaType;
......
......@@ -38,7 +38,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
* @author S. Koulouzis
*/
@RestController
@RequestMapping("/user/v0.0/switch/provision/")
@RequestMapping("/user/v0.0/switch/provision")
@Component
public class UserScriptController0 {
......
......@@ -15,6 +15,7 @@
*/
package nl.uva.sne.drip.commons.v0.types;
import com.webcohesion.enunciate.metadata.DocumentationExample;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlValue;
......@@ -24,8 +25,23 @@ import javax.xml.bind.annotation.XmlValue;
*/
public class Attribute {
/**
* Name of the file/public key.
*/
@DocumentationExample("planner_output_all")
@XmlAttribute
public String name;
/**
* There are two levels of description files for topologies designed by users.
* If the level attribute for the element file is 1, then this file is the top-level description,
* which defines how the sub-topologies are connected to each other.
* If the level attribute is 0, then the file is the low-level description,
* which describes the topology in one data center in detail.
* On the other hand, the name of low-level description file must be the
* sub-topology name appeared in the high-level description file. (For example, here should be zh_a and zh_b.)
*/
@DocumentationExample("0")
@XmlAttribute
public String level;
......
......@@ -15,6 +15,7 @@
*/
package nl.uva.sne.drip.commons.v0.types;
import com.webcohesion.enunciate.metadata.DocumentationExample;
import javax.xml.bind.annotation.XmlRootElement;
/**
......@@ -24,5 +25,9 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class ConfScript extends Execute {
/**
* The script contents with new lines replace by '\n'
*/
@DocumentationExample("#!/bin/bash\\n\\nlogstashScript=/root/runLogstash.sh\\nscreen -S logstash -dm /bin/bash \"$logstashScript\"\\n\\n\\nlogLevelPath=/root/\\nlogLevelFile=$logLevelPath/logstash_loglevel.csv\\nremotePath=/media/lobcder/skoulouz/\\nremoteLogPath=$remotePath/logs\\nlocalLogPath=/root/logs\\n\\nmkdir $localLogPath\\n\\n\\nfor logArchPath in $remoteLogPath/*.gz; do\\n echo \"File -> $logArchPath\"\\n if [ ! -f $logArchPath.lock ]; then\\n touch $logArchPath.lock\\n cp $logArchPath $localLogPath\\n logArchName=$(basename $logArchPath)\\n tar -xvf $localLogPath/$logArchName -C $localLogPath\\n sleep 120\\n modTime=-100\\n while [ ! -f $logLevelFile ]\\n do\\n sleep 5\\n done\\n while [ $modTime -lt 120 ]\\n do\\n moddate=$(stat -c %Y $logLevelFile)\\n moddate=${moddate%% *}\\n now=$(date +%s)\\n modTime=\"$(( $now - $moddate))\"\\n echo $modTime\\n sleep 5\\n done\\n rm $localLogPath/*.tar.gz\\n rm $localLogPath/*.log\\n modTime=-100\\n fi\\ndone\\n \\n\\nscreen -X -S logstash quit\\nsleep 5\\n\\nuid=`ifconfig | grep eth0 | awk '{print $NF}' | sed 's/://g'`\\n\\nfor csvFiles in $logLevelPath/*.csv; do\\n echo $csvFiles $csvFiles$uid.csv\\n mv $csvFiles $csvFiles$uid.csv\\n cp $csvFiles$uid.csv $remotePath\\ndone\\n\\nkillall java \\n")
public String script;
}
......@@ -15,6 +15,7 @@
*/
package nl.uva.sne.drip.commons.v0.types;
import com.webcohesion.enunciate.metadata.DocumentationExample;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
......@@ -26,14 +27,43 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class Configure {
/**
* Not used. It's there for backwards compatibility.
*/
@DocumentationExample("user")
public String user;
/**
* Not used. It's there for backwards compatibility.
*/
@DocumentationExample("123")
public String pwd;
/**
* The key id for the cloud provider.
*
*/
@DocumentationExample("AKIAITY3K5ZUQ6M7YBSQ")
public String keyid;
/**
* The key for the cloud provider.
*/
@DocumentationExample("6J7uo99ifrff45126Gsy5vgb3bmrtwY6hBxtYt9y")
public String key;
@XmlElement(name = "loginKey")
public List<LoginKey0> loginKey;
/**
* The binary keystore (user.jks) for the cloud provider encoded in base64
*/
@DocumentationExample("/u3+7QAAAAIAAAABAWuf2AAACvDCCArgwDgYKKwYBBEBAQUABIIC\\npKlNUfpKLNCy0h8P4L5XeECwwIN/tezeaOVsjvzLsXeiBsB/luYv9gttoeKFbcJb/IDpZr\\nfpL1tjF8Sed6g38kNoWwnVVoNZ1ILpITjESL6FkZW+gGAPS+XHp8l52/2DjeECQlx+38GlFUftWP\\nn3QH9bDYD+7sRtm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ArBgNVBAMTJDMxYzBmMDlmLTk1ZjctNDUxMC1h\\nMzBiLWQ5M2RmMmJkMDJjOTEhMB8GCSqGSIb3DQEJARYSY2gtYWRtaW5zQGdlbmkubmV0MIGfMA0G\\nCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC4LG9Xl2veo5+Zy1fDi47ajinYu+mv8QYDya2Hf8lPolQy\\nlnGFFQRMx/JsbG1BBQ86FqSeUWtvANhY1nRlrozutOBeg9EEfhX+JXvVdhEKQ4/ANliC0V1UR3GO\\nJHtQaj/6qoG/q01bWP7EJgf+ZPfTdCgCkJ89v8oth1m3UjCxcQIDAQABo4IBNzCCATMwHQYDVR0O\\nBBYEFHGlguYe8bTQK4umhY/oGl1ifTGuMEYGA1UdIwQ/MD2AFEU22V1Y/0L1KwlqbnkdPIMEy5hR\\noRqkGDAWMRQwEgYDVQQDEwtjaC5nZW5pLm5ldIIJAJvH3dZoB97bMEcGCCsGAQUFBwEBBDswOTA3\\nBhRpg8yTgKiYzKjHvbGngICqrteKG4YfaHR0cHM6Ly9jaC5nZW5pLm5ldC9jYWluZm8uaHRtbDBz\\nBgNVHREEbDBqgRJjaC1hZG1pbnNAZ2VuaS5uZXSGKXVybjpwdWJsaWNpZDpJRE4rY2guZ2VuaS5u\\nZXQrYXV0aG9yaXR5K21hhil1dWlkOjMxYzBmMDlmLTk1ZjctNDUxMC1hMzBiLWQ5M2RmMmJkMDJj\\nOTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAHgrtROjbfUT6HQCZCl1XuAEZQPse3/x\\nT2smC3LzAH4UUj3gEBq27VvxbqzazdBQCSeBEl2RUd+KoDzmhG5vBbAyHt8UE6s3P7Yx\\ngoNYTld0JHB5wq3XFRaaGbeVgo2AuK9S/Q3whzMTRW21a58tLP5zwKGzX3oyQQUT5J\\ncwv0z5NmJdAfk8Y=")
public String geniKey;
/**
* Key alias in key store
*/
@DocumentationExample("exogeni")
public String geniKeyAlias;
@XmlElement(name = "loginPubKey")
......
......@@ -15,6 +15,7 @@
*/
package nl.uva.sne.drip.commons.v0.types;
import com.webcohesion.enunciate.metadata.DocumentationExample;
import javax.xml.bind.annotation.XmlRootElement;
/**
......@@ -24,8 +25,21 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class Execute {
/**
* Not used. It's there for backwards compatibility.
*/
@DocumentationExample("user")
public String user;
/**
* Not used. It's there for backwards compatibility.
*/
@DocumentationExample("123")
public String pwd;
/**
* A referance id used from the servcie to do the provisioning
*/
@DocumentationExample("58c2c2f3a8d4b56889878d03")
public String action;
}
......@@ -15,6 +15,7 @@
*/
package nl.uva.sne.drip.commons.v0.types;
import com.webcohesion.enunciate.metadata.DocumentationExample;
import javax.xml.bind.annotation.XmlRootElement;
/**
......@@ -24,7 +25,16 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class Register {
/**
* The user name
*/
@DocumentationExample("user")
public String user;
/**
* The user password
*/
@DocumentationExample("123abc")
public String pwd;
}
......@@ -15,6 +15,7 @@
*/
package nl.uva.sne.drip.commons.v0.types;
import com.webcohesion.enunciate.metadata.DocumentationExample;
import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;
......@@ -24,10 +25,19 @@ import javax.xml.bind.annotation.XmlRootElement;
*/
@XmlRootElement
public class Result {
/**
* The status of the response
*/
@DocumentationExample("Success")
public String status;
/**
* Not used. Not used. It's there for backwards compatibility.
*/
@DocumentationExample("INFO")
public String info;
public List<Attribute> file;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment