Commit c0a478f8 authored by Spiros Koulouzis's avatar Spiros Koulouzis

manager as spring/swagger

parent 8d9282a9
<?xml version="1.0" encoding="UTF-8"?>
<project-shared-configuration>
<!--
This file contains additional configuration written by modules in the NetBeans IDE.
The configuration is intended to be shared among all the users of project and
therefore it is assumed to be part of version control checkout.
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
-->
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
<!--
Properties that influence various parts of the IDE, especially code formatting and the like.
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
That way multiple projects can share the same settings (useful for formatting rules for example).
Any value defined here will override the pom.xml file value but is only applicable to the current project.
-->
<org-netbeans-modules-whitelist.whitelist-oracle>false</org-netbeans-modules-whitelist.whitelist-oracle>
</properties>
</project-shared-configuration>
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>run</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath nl.uva.sne.drip.Swagger2SpringBoot</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
<action>
<actionName>debug</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath nl.uva.sne.drip.Swagger2SpringBoot</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
</properties>
</action>
<action>
<actionName>profile</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath nl.uva.sne.drip.Swagger2SpringBoot</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
</actions>
openapi: 3.0.1
info:
title: DRIP
description: The Dynamic Real-time infrastructure planner (DRIP) allows application
developers to seamlessly plan a customized virtual infrastructure based on application
level constraints on QoS and resource budgets, provisioning the virtual infrastructure,
deploy application components onto the virtual infrastructure, and start execution
on demand using TOSCA.
contact:
email: z.zhao@uva.nl
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 3.0.0
externalDocs:
description: Find out more about DRIP
url: https://github.com/QCAPI-DRIP/DRIP-integration/wiki
servers:
- url: ///drip-api
paths:
/tosca_template:
post:
summary: upload a tosca template description file
operationId: uploadToscaTemplate
requestBody:
content:
multipart/form-data:
schema:
required:
- file
properties:
file:
type: string
description: tosca Template description
format: binary
required: true
responses:
200:
description: successful operation
content:
text/plain::
schema:
type: string
405:
description: Invalid input
content: {}
security:
- drip_auth:
- write:ToscaTemplate
- read:ToscaTemplate
/tosca_template/{id}:
get:
summary: Find topolog template by ID
description: Returns a single topolog template
operationId: getToscaTemplateByID
parameters:
- name: id
in: path
description: ID of topolog template to return
required: true
schema:
type: integer
format: int64
responses:
200:
description: successful operation
content:
text/plain::
schema:
type: string
400:
description: Invalid ID supplied
content: {}
404:
description: ToscaTemplate not found
content: {}
405:
description: Invalid input
content: {}
security:
- drip_auth:
- write:ToscaTemplate
- read:ToscaTemplate
put:
summary: Updates exisintg topolog template in the store
operationId: updateToscaTemplateByID
parameters:
- name: id
in: path
description: ID of topolog template to return
required: true
schema:
type: integer
format: int64
requestBody:
content:
multipart/form-data:
schema:
properties:
file:
type: string
description: tosca Template description
format: binary
responses:
200:
description: successful operation
content: {}
400:
description: Invalid ID supplied
content: {}
404:
description: ToscaTemplate not found
content: {}
405:
description: Invalid input
content: {}
security:
- drip_auth:
- write:ToscaTemplate
- read:ToscaTemplate
delete:
summary: Deletes a tosca topolog template
operationId: deleteToscaTemplateByID
parameters:
- name: id
in: path
description: ID of topolog template to return
required: true
schema:
type: integer
format: int64
responses:
200:
description: successful operation
content: {}
400:
description: Invalid ID supplied
content: {}
404:
description: ToscaTemplate not found
content: {}
security:
- drip_auth:
- write:ToscaTemplate
- read:ToscaTemplate
/planner/plan/{id}:
get:
summary: plan tosca template
description: Returns the ID of the planed topolog template
operationId: planToscaTemplateByID
parameters:
- name: id
in: path
description: ID of topolog template to plan
required: true
schema:
type: integer
format: int64
responses:
200:
description: successful operation
content:
text/plain::
schema:
type: string
400:
description: Invalid ID supplied
content: {}
404:
description: ToscaTemplate not found
content: {}
405:
description: Invalid input
content: {}
security:
- drip_auth:
- write:ToscaTemplate
- read:ToscaTemplate
/planner/{id}:
get:
summary: get the plan tosca template
description: Returns the plan topolog template
operationId: getPlanToscaTemplateByID
parameters:
- name: id
in: path
description: ID of topolog template plan
required: true
schema:
type: integer
format: int64
responses:
200:
description: successful operation
content:
text/plain::
schema:
type: string
400:
description: Invalid ID supplied
content: {}
404:
description: ToscaTemplate not found
content: {}
405:
description: Invalid input
content: {}
security:
- drip_auth:
- write:ToscaTemplate
- read:ToscaTemplate
/provisioner/provision/{id}:
get:
summary: provision tosca template
description: 'provosions the operationId: Plan Tosca Template Returns the provision
ID'
operationId: provisionPlanToscaTemplateByID
parameters:
- name: id
in: path
description: ID of topolog template to plan
required: true
schema:
type: integer
format: int64
responses:
200:
description: successful operation
content:
text/plain::
schema:
type: string
400:
description: Invalid ID supplied
content: {}
404:
description: ToscaTemplate not found
content: {}
405:
description: Invalid input
content: {}
security:
- drip_auth:
- write:ToscaTemplate
- read:ToscaTemplate
/provisioner/{id}:
get:
summary: the provisioned tosca template
description: Returns the provisioned tosca template
operationId: getProvisionToscaTemplateByID
parameters:
- name: id
in: path
description: ID of topolog template to plan
required: true
schema:
type: integer
format: int64
responses:
200:
description: successful operation
content:
text/plain::
schema:
type: string
400:
description: Invalid ID supplied
content: {}
404:
description: ToscaTemplate not found
content: {}
405:
description: Invalid input
content: {}
security:
- drip_auth:
- write:ToscaTemplate
- read:ToscaTemplate
/deployer/deploy/{id}:
get:
summary: deploy the software tosca template
description: Returns the deployment ID
operationId: deployProvisionToscaTemplateByID
parameters:
- name: id
in: path
description: ID of topolog template to deploy
required: true
schema:
type: integer
format: int64
responses:
200:
description: successful operation
content:
text/plain::
schema:
type: string
400:
description: Invalid ID supplied
content: {}
404:
description: ToscaTemplate not found
content: {}
405:
description: Invalid input
content: {}
security:
- drip_auth:
- write:ToscaTemplate
- read:ToscaTemplate
/deployer/{id}:
get:
summary: get the deployment topolog template
description: Returns the deployment topolog template
operationId: getDeployToscaTemplateByID
parameters:
- name: id
in: path
description: ID of topolog template to deploy
required: true
schema:
type: integer
format: int64
responses:
200:
description: successful operation
content:
text/plain::
schema:
type: string
400:
description: Invalid ID supplied
content: {}
404:
description: ToscaTemplate not found
content: {}
405:
description: Invalid input
content: {}
security:
- drip_auth:
- write:ToscaTemplate
- read:ToscaTemplate
/credential:
post:
summary: Create credentials
description: Creates credentials
operationId: createCredentials
requestBody:
description: Created user object
content:
application/json:
schema:
$ref: '#/components/schemas/Credentials'
required: true
responses:
200:
description: successful operation
content:
text/plain::
schema:
type: string
400:
description: Invalid ID supplied
content: {}
404:
description: ToscaTemplate not found
content: {}
405:
description: Invalid input
content: {}
security:
- drip_auth:
- write:Credentials
- read:Credentials
/user:
post:
summary: Create user
description: This can only be done by admin.
operationId: createUser
requestBody:
description: Created user object
content:
'*/*':
schema:
$ref: '#/components/schemas/User'
required: true
responses:
default:
description: successful operation
content: {}
security:
- drip_auth:
- admin:User
/user/login:
get:
tags:
- user
summary: Logs user into the system
parameters:
- name: username
in: query
description: The user name for login
required: true
schema:
type: string
- name: password
in: query
description: The password for login in clear text
required: true
schema:
type: string
responses:
200:
description: successful operation
headers:
X-Rate-Limit:
description: calls per hour allowed by the user
schema:
type: integer
format: int32
X-Expires-After:
description: date in UTC when token expires
schema:
type: string
format: date-time
content:
application/json:
schema:
type: string
400:
description: Invalid username/password supplied
content: {}
/user/logout:
get:
summary: Logs out current logged in user session
responses:
default:
description: successful operation
content: {}
/user/{username}:
get:
summary: Get user by user name
parameters:
- name: username
in: path
description: 'The name that needs to be fetched. Use user1 for testing. '
required: true
schema:
type: string
responses:
200:
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/User'
400:
description: Invalid username supplied
content: {}
404:
description: User not found
content: {}
security:
- drip_auth:
- admin:User
put:
tags:
- user
summary: Updated user
description: This can only be done by the logged in user.
parameters:
- name: username
in: path
description: name that need to be updated
required: true
schema:
type: string
requestBody:
description: Updated user object
content:
'*/*':
schema:
$ref: '#/components/schemas/User'
required: true
responses:
400:
description: Invalid user supplied
content: {}
404:
description: User not found
content: {}
security:
- drip_auth:
- admin:User
delete:
summary: Delete user
description: This can only be done by the logged in user.
parameters:
- name: username
in: path
description: The name that needs to be deleted
required: true
schema:
type: string
responses:
400:
description: Invalid username supplied
content: {}
404:
description: User not found
content: {}
security:
- drip_auth:
- admin:User
components:
schemas:
User:
type: object
properties:
id:
type: integer
format: int64
username:
type: string
firstName:
type: string
lastName:
type: string
email:
type: string
password:
type: string
userStatus:
type: integer
description: User Status
format: int32
ToscaTemplate:
type: object
properties:
tosca_definitions_version:
type: string
tosca_default_namespace:
type: string
template_name:
type: string
imports:
type: array
items:
type: object
additionalProperties:
type: string
repositories:
type: object
additionalProperties:
type: string
dsl_definitions:
type: object
additionalProperties:
type: string
node_types:
type: object
additionalProperties:
type: object
properties: {}
topology_template:
$ref: '#/components/schemas/TopologyTemplate'
relationship_types:
type: object
additionalProperties:
type: object
properties: {}
relationship_templates:
type: object
additionalProperties:
type: object
properties: {}
capability_types:
type: object
additionalProperties:
type: object
properties: {}
artifact_types:
type: object
additionalProperties:
type: object
properties: {}
data_types:
type: object
additionalProperties:
type: object
properties: {}
interface_types:
type: object
additionalProperties:
type: object
properties: {}
policy_types:
type: object
additionalProperties:
type: string
group_types:
type: object
additionalProperties:
type: object
properties: {}
description:
type: string
template_author:
type: string
TopologyTemplate:
type: object
properties:
description:
type: string
inputs:
type: array
items:
type: object
additionalProperties:
type: object
properties: {}
policies:
type: array
items:
type: object
additionalProperties:
type: object
properties: {}
outputs:
type: array
items:
type: object
additionalProperties:
type: object
properties: {}
node_templates:
type: object
additionalProperties:
type: object
properties: {}
relationship_templates:
type: object
additionalProperties:
type: object
properties: {}
groups:
type: object
additionalProperties:
type: object
properties: {}
substitution_mappings:
type: object
additionalProperties:
type: object
properties: {}
NodeTemplate:
type: object
properties:
name:
type: string
type:
type: string
requirements:
type: array
items:
type: object
additionalProperties:
type: string
artifacts:
type: object
additionalProperties:
type: object
properties: {}
properties:
type: object
additionalProperties:
type: object
properties: {}
interfaces:
type: object
additionalProperties:
type: object
properties: {}
capabilities:
type: object
additionalProperties:
type: object
properties: {}
workflows:
type: object
additionalProperties:
type: object
properties: {}
Credentials:
type: object
properties:
protocol:
type: string
token_type:
type: string
token:
type: string
keys:
type: object
additionalProperties:
type: string
user:
type: string
cloud_provider_name:
type: string
securitySchemes:
drip_auth:
type: oauth2
flows:
implicit:
authorizationUrl: http://localhost/oauth/dialog
scopes:
write:ToscaTemplate: modify topolog template in your account
read:ToscaTemplate: read your topolog template
admin:User: Grants access to admin operations
write:Credentials: modify cloud credentials in your account
read:Credentials: read your cloud credentials
......@@ -4,10 +4,11 @@
<artifactId>drip-manager</artifactId>
<packaging>jar</packaging>
<name>drip-manager</name>
<version>1.0.0</version>
<version>3.0.0</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<springfox-version>2.9.2</springfox-version>
</properties>
<parent>
......@@ -53,11 +54,27 @@
</dependency>
<dependency>
<groupId>com.github.joschi.jackson</groupId>
<artifactId>jackson-datatype-threetenbp</artifactId>
<version>2.6.4</version>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<type>jar</type>
</dependency>
<!-- Bean Validation API support -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<type>jar</type>
</dependency>
<!-- Bean Validation API support -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
......@@ -68,14 +85,15 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<groupId>com.github.joschi.jackson</groupId>
<artifactId>jackson-datatype-threetenbp</artifactId>
<version>2.6.4</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.20</version>
<groupId>nl.uva.sne.drip</groupId>
<artifactId>drip-commons</artifactId>
<version>1.0-SNAPSHOT</version>
<type>jar</type>
</dependency>
</dependencies>
......
package nl.uva.sne.drip;
import nl.uva.sne.drip.dao.TopologTemplateDAO;
import nl.uva.sne.drip.dao.ToscaTemplateDAO;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.ExitCodeGenerator;
import org.springframework.boot.SpringApplication;
......@@ -12,7 +12,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication
@EnableSwagger2
@EnableMongoRepositories(basePackageClasses = {TopologTemplateDAO.class})
@EnableMongoRepositories(basePackageClasses = {ToscaTemplateDAO.class})
@ComponentScan(basePackages = {"nl.uva.sne.drip", "nl.uva.sne.drip.api", "nl.uva.sne.drip.configuration", "nl.uva.sne.drip.dao", "nl.uva.sne.drip.model", "nl.uva.sne.drip.service"})
public class Swagger2SpringBoot implements CommandLineRunner {
......@@ -28,7 +28,6 @@ public class Swagger2SpringBoot implements CommandLineRunner {
}
class ExitException extends RuntimeException implements ExitCodeGenerator {
private static final long serialVersionUID = 1L;
@Override
......
package nl.uva.sne.drip.api;
@javax.annotation.Generated(value = "nl.uva.sne.drip.codegen.languages.SpringCodegen", date = "2019-10-09T14:00:37.436Z")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-10T17:15:46.465Z")
public class ApiException extends Exception{
private int code;
......
......@@ -5,7 +5,7 @@ import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
@javax.annotation.Generated(value = "nl.uva.sne.drip.codegen.languages.SpringCodegen", date = "2019-10-09T14:00:37.436Z")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-10T17:15:46.465Z")
public class ApiOriginFilter implements javax.servlet.Filter {
@Override
......
......@@ -2,7 +2,7 @@ package nl.uva.sne.drip.api;
import javax.xml.bind.annotation.XmlTransient;
@javax.annotation.Generated(value = "nl.uva.sne.drip.codegen.languages.SpringCodegen", date = "2019-10-09T14:00:37.436Z")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-10T17:15:46.465Z")
@javax.xml.bind.annotation.XmlRootElement
public class ApiResponseMessage {
......
/**
* NOTE: This class is auto generated by the swagger code generator program (2.4.8).
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
package nl.uva.sne.drip.api;
import nl.uva.sne.drip.model.Credentials;
import io.swagger.annotations.*;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.List;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-10T17:15:46.465Z")
@Api(value = "credential", description = "the credential API")
public interface CredentialApi {
@ApiOperation(value = "Create credentials", nickname = "createCredentials", notes = "Creates credentials", response = String.class, authorizations = {
@Authorization(value = "drip_auth", scopes = {
@AuthorizationScope(scope = "read:Credentials", description = "read your cloud credentials"),
@AuthorizationScope(scope = "write:Credentials", description = "modify cloud credentials in your account")
})
}, tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = String.class),
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "ToscaTemplate not found"),
@ApiResponse(code = 405, message = "Invalid input") })
@RequestMapping(value = "/credential",
produces = { "application/json" },
consumes = { "application/json" },
method = RequestMethod.POST)
ResponseEntity<String> createCredentials(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody Credentials body);
}
package nl.uva.sne.drip.api;
import nl.uva.sne.drip.model.Credentials;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.*;
import javax.validation.Valid;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-10T17:15:46.465Z")
@Controller
public class CredentialApiController implements CredentialApi {
private static final Logger log = LoggerFactory.getLogger(CredentialApiController.class);
private final ObjectMapper objectMapper;
private final HttpServletRequest request;
@org.springframework.beans.factory.annotation.Autowired
public CredentialApiController(ObjectMapper objectMapper, HttpServletRequest request) {
this.objectMapper = objectMapper;
this.request = request;
}
public ResponseEntity<String> createCredentials(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody Credentials body) {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("application/json")) {
try {
return new ResponseEntity<String>(objectMapper.readValue("\"\"", String.class), HttpStatus.NOT_IMPLEMENTED);
} catch (IOException e) {
log.error("Couldn't serialize response for content type application/json", e);
return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
return new ResponseEntity<String>(HttpStatus.NOT_IMPLEMENTED);
}
}
/**
* NOTE: This class is auto generated by the swagger code generator program (2.4.8).
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
package nl.uva.sne.drip.api;
import io.swagger.annotations.*;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.List;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-10T17:15:46.465Z")
@Api(value = "deployer", description = "the deployer API")
public interface DeployerApi {
@ApiOperation(value = "deploy the software tosca template", nickname = "deployProvisionToscaTemplateByID", notes = "Returns the deployment ID", response = String.class, authorizations = {
@Authorization(value = "drip_auth", scopes = {
@AuthorizationScope(scope = "read:ToscaTemplate", description = "read your topolog template"),
@AuthorizationScope(scope = "write:ToscaTemplate", description = "modify topolog template in your account")
})
}, tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = String.class),
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "ToscaTemplate not found"),
@ApiResponse(code = 405, message = "Invalid input") })
@RequestMapping(value = "/deployer/deploy/{id}",
produces = { "text/plain" },
method = RequestMethod.GET)
ResponseEntity<String> deployProvisionToscaTemplateByID(@ApiParam(value = "ID of topolog template to deploy",required=true) @PathVariable("id") String id);
@ApiOperation(value = "get the deployment topolog template", nickname = "getDeployToscaTemplateByID", notes = "Returns the deployment topolog template", response = String.class, authorizations = {
@Authorization(value = "drip_auth", scopes = {
@AuthorizationScope(scope = "read:ToscaTemplate", description = "read your topolog template"),
@AuthorizationScope(scope = "write:ToscaTemplate", description = "modify topolog template in your account")
})
}, tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = String.class),
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "ToscaTemplate not found"),
@ApiResponse(code = 405, message = "Invalid input") })
@RequestMapping(value = "/deployer/{id}",
produces = { "text/plain" },
method = RequestMethod.GET)
ResponseEntity<String> getDeployToscaTemplateByID(@ApiParam(value = "ID of topolog template to deploy",required=true) @PathVariable("id") String id);
}
package nl.uva.sne.drip.api;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.*;
import javax.validation.Valid;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-10T17:15:46.465Z")
@Controller
public class DeployerApiController implements DeployerApi {
private static final Logger log = LoggerFactory.getLogger(DeployerApiController.class);
private final ObjectMapper objectMapper;
private final HttpServletRequest request;
@org.springframework.beans.factory.annotation.Autowired
public DeployerApiController(ObjectMapper objectMapper, HttpServletRequest request) {
this.objectMapper = objectMapper;
this.request = request;
}
public ResponseEntity<String> deployProvisionToscaTemplateByID(@ApiParam(value = "ID of topolog template to deploy",required=true) @PathVariable("id") String id) {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("")) {
try {
return new ResponseEntity<String>(objectMapper.readValue("", String.class), HttpStatus.NOT_IMPLEMENTED);
} catch (IOException e) {
log.error("Couldn't serialize response for content type ", e);
return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
return new ResponseEntity<String>(HttpStatus.NOT_IMPLEMENTED);
}
public ResponseEntity<String> getDeployToscaTemplateByID(@ApiParam(value = "ID of topolog template to deploy",required=true) @PathVariable("id") String id) {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("")) {
try {
return new ResponseEntity<String>(objectMapper.readValue("", String.class), HttpStatus.NOT_IMPLEMENTED);
} catch (IOException e) {
log.error("Couldn't serialize response for content type ", e);
return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
return new ResponseEntity<String>(HttpStatus.NOT_IMPLEMENTED);
}
}
package nl.uva.sne.drip.api;
@javax.annotation.Generated(value = "nl.uva.sne.drip.codegen.languages.SpringCodegen", date = "2019-10-09T14:00:37.436Z")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-10T17:15:46.465Z")
public class NotFoundException extends ApiException {
private int code;
......
/**
* NOTE: This class is auto generated by the swagger code generator program (2.4.8).
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
package nl.uva.sne.drip.api;
import io.swagger.annotations.*;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.List;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-10T17:15:46.465Z")
@Api(value = "planner", description = "the planner API")
public interface PlannerApi {
@ApiOperation(value = "get the plan tosca template", nickname = "getPlanToscaTemplateByID", notes = "Returns the plan topolog template", response = String.class, authorizations = {
@Authorization(value = "drip_auth", scopes = {
@AuthorizationScope(scope = "read:ToscaTemplate", description = "read your topolog template"),
@AuthorizationScope(scope = "write:ToscaTemplate", description = "modify topolog template in your account")
})
}, tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = String.class),
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "ToscaTemplate not found"),
@ApiResponse(code = 405, message = "Invalid input") })
@RequestMapping(value = "/planner/{id}",
produces = { "text/plain" },
method = RequestMethod.GET)
ResponseEntity<String> getPlanToscaTemplateByID(@ApiParam(value = "ID of topolog template plan",required=true) @PathVariable("id") String id);
@ApiOperation(value = "plan tosca template", nickname = "planToscaTemplateByID", notes = "Returns the ID of the planed topolog template", response = String.class, authorizations = {
@Authorization(value = "drip_auth", scopes = {
@AuthorizationScope(scope = "read:ToscaTemplate", description = "read your topolog template"),
@AuthorizationScope(scope = "write:ToscaTemplate", description = "modify topolog template in your account")
})
}, tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = String.class),
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "ToscaTemplate not found"),
@ApiResponse(code = 405, message = "Invalid input") })
@RequestMapping(value = "/planner/plan/{id}",
produces = { "text/plain" },
method = RequestMethod.GET)
ResponseEntity<String> planToscaTemplateByID(@ApiParam(value = "ID of topolog template to plan",required=true) @PathVariable("id") String id);
}
......@@ -2,59 +2,66 @@ package nl.uva.sne.drip.api;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.*;
import nl.uva.sne.drip.service.TopologTemplateService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.*;
import javax.validation.Valid;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
@javax.annotation.Generated(value = "nl.uva.sne.drip.codegen.languages.SpringCodegen", date = "2019-10-09T14:00:37.436Z")
import java.io.IOException;
import java.util.List;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-10T17:15:46.465Z")
@Controller
public class TopologTemplateApiController implements TopologTemplateApi {
public class PlannerApiController implements PlannerApi {
private static final Logger log = LoggerFactory.getLogger(TopologTemplateApiController.class);
private static final Logger log = LoggerFactory.getLogger(PlannerApiController.class);
private final ObjectMapper objectMapper;
private final HttpServletRequest request;
@Autowired
private TopologTemplateService topologTemplateService;
@org.springframework.beans.factory.annotation.Autowired
public TopologTemplateApiController(ObjectMapper objectMapper, HttpServletRequest request) {
public PlannerApiController(ObjectMapper objectMapper, HttpServletRequest request) {
this.objectMapper = objectMapper;
this.request = request;
}
public ResponseEntity<Void> addTopologTemplate(@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file) {
public ResponseEntity<String> getPlanToscaTemplateByID(@ApiParam(value = "ID of topolog template plan",required=true) @PathVariable("id") String id) {
String accept = request.getHeader("Accept");
return new ResponseEntity<Void>(HttpStatus.NOT_IMPLEMENTED);
}
if (accept != null && accept.contains("")) {
try {
return new ResponseEntity<String>(objectMapper.readValue("", String.class), HttpStatus.NOT_IMPLEMENTED);
} catch (IOException e) {
log.error("Couldn't serialize response for content type ", e);
return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
public ResponseEntity<Void> getTopologTemplateById(@ApiParam(value = "ID of topolog template to return", required = true) @PathVariable("TopologTemplateId") Long topologTemplateId) {
String accept = request.getHeader("Accept");
return new ResponseEntity<Void>(HttpStatus.NOT_IMPLEMENTED);
return new ResponseEntity<String>(HttpStatus.NOT_IMPLEMENTED);
}
public ResponseEntity<Void> topologTemplate(@ApiParam(value = "ID of topolog template to return", required = true) @PathVariable("TopologTemplateId") Long topologTemplateId, @ApiParam(value = "") @RequestHeader(value = "api_key", required = false) String apiKey) {
public ResponseEntity<String> planToscaTemplateByID(@ApiParam(value = "ID of topolog template to plan",required=true) @PathVariable("id") String id) {
String accept = request.getHeader("Accept");
return new ResponseEntity<Void>(HttpStatus.NOT_IMPLEMENTED);
}
if (accept != null && accept.contains("")) {
try {
return new ResponseEntity<String>(objectMapper.readValue("", String.class), HttpStatus.NOT_IMPLEMENTED);
} catch (IOException e) {
log.error("Couldn't serialize response for content type ", e);
return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
public ResponseEntity<Void> updateTopologTemplate(@ApiParam(value = "ID of topolog template to return", required = true) @PathVariable("TopologTemplateId") Long topologTemplateId, @ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file) {
String accept = request.getHeader("Accept");
return new ResponseEntity<Void>(HttpStatus.NOT_IMPLEMENTED);
return new ResponseEntity<String>(HttpStatus.NOT_IMPLEMENTED);
}
}
/**
* NOTE: This class is auto generated by the swagger code generator program (2.4.8).
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
package nl.uva.sne.drip.api;
import io.swagger.annotations.*;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.List;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-10T17:15:46.465Z")
@Api(value = "provisioner", description = "the provisioner API")
public interface ProvisionerApi {
@ApiOperation(value = "the provisioned tosca template", nickname = "getProvisionToscaTemplateByID", notes = "Returns the provisioned tosca template", response = String.class, authorizations = {
@Authorization(value = "drip_auth", scopes = {
@AuthorizationScope(scope = "read:ToscaTemplate", description = "read your topolog template"),
@AuthorizationScope(scope = "write:ToscaTemplate", description = "modify topolog template in your account")
})
}, tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = String.class),
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "ToscaTemplate not found"),
@ApiResponse(code = 405, message = "Invalid input") })
@RequestMapping(value = "/provisioner/{id}",
produces = { "text/plain" },
method = RequestMethod.GET)
ResponseEntity<String> getProvisionToscaTemplateByID(@ApiParam(value = "ID of topolog template to plan",required=true) @PathVariable("id") String id);
@ApiOperation(value = "provision tosca template", nickname = "provisionPlanToscaTemplateByID", notes = "provosions the operationId: Plan Tosca Template Returns the provision ID", response = String.class, authorizations = {
@Authorization(value = "drip_auth", scopes = {
@AuthorizationScope(scope = "read:ToscaTemplate", description = "read your topolog template"),
@AuthorizationScope(scope = "write:ToscaTemplate", description = "modify topolog template in your account")
})
}, tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = String.class),
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "ToscaTemplate not found"),
@ApiResponse(code = 405, message = "Invalid input") })
@RequestMapping(value = "/provisioner/provision/{id}",
produces = { "text/plain" },
method = RequestMethod.GET)
ResponseEntity<String> provisionPlanToscaTemplateByID(@ApiParam(value = "ID of topolog template to plan",required=true) @PathVariable("id") String id);
}
package nl.uva.sne.drip.api;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.*;
import javax.validation.Valid;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-10T17:15:46.465Z")
@Controller
public class ProvisionerApiController implements ProvisionerApi {
private static final Logger log = LoggerFactory.getLogger(ProvisionerApiController.class);
private final ObjectMapper objectMapper;
private final HttpServletRequest request;
@org.springframework.beans.factory.annotation.Autowired
public ProvisionerApiController(ObjectMapper objectMapper, HttpServletRequest request) {
this.objectMapper = objectMapper;
this.request = request;
}
public ResponseEntity<String> getProvisionToscaTemplateByID(@ApiParam(value = "ID of topolog template to plan",required=true) @PathVariable("id") String id) {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("")) {
try {
return new ResponseEntity<String>(objectMapper.readValue("", String.class), HttpStatus.NOT_IMPLEMENTED);
} catch (IOException e) {
log.error("Couldn't serialize response for content type ", e);
return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
return new ResponseEntity<String>(HttpStatus.NOT_IMPLEMENTED);
}
public ResponseEntity<String> provisionPlanToscaTemplateByID(@ApiParam(value = "ID of topolog template to plan",required=true) @PathVariable("id") String id) {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("")) {
try {
return new ResponseEntity<String>(objectMapper.readValue("", String.class), HttpStatus.NOT_IMPLEMENTED);
} catch (IOException e) {
log.error("Couldn't serialize response for content type ", e);
return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
return new ResponseEntity<String>(HttpStatus.NOT_IMPLEMENTED);
}
}
......@@ -21,72 +21,73 @@ import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.List;
@javax.annotation.Generated(value = "nl.uva.sne.drip.codegen.languages.SpringCodegen", date = "2019-10-09T14:00:37.436Z")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-10T17:15:46.465Z")
@Api(value = "topolog_template", description = "the topolog_template API")
public interface TopologTemplateApi {
@Api(value = "tosca_template", description = "the tosca_template API")
public interface ToscaTemplateApi {
@ApiOperation(value = "upload a topolog template description file", nickname = "addTopologTemplate", notes = "", authorizations = {
@ApiOperation(value = "Deletes a tosca topolog template", nickname = "deleteToscaTemplateByID", notes = "", response = String.class, authorizations = {
@Authorization(value = "drip_auth", scopes = {
@AuthorizationScope(scope = "write:TopologTemplate", description = "modify topolog template in your account"),
@AuthorizationScope(scope = "read:TopologTemplate", description = "read your topolog template")
@AuthorizationScope(scope = "read:ToscaTemplate", description = "read your topolog template"),
@AuthorizationScope(scope = "write:ToscaTemplate", description = "modify topolog template in your account")
})
}, tags={ })
@ApiResponses(value = {
@ApiResponse(code = 405, message = "Invalid input") })
@RequestMapping(value = "/topolog_template",
consumes = { "multipart/form-data" },
method = RequestMethod.POST)
ResponseEntity<Void> addTopologTemplate(@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file);
@ApiResponse(code = 200, message = "successful operation", response = String.class),
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "ToscaTemplate not found") })
@RequestMapping(value = "/tosca_template/{id}",
method = RequestMethod.DELETE)
ResponseEntity<String> deleteToscaTemplateByID(@ApiParam(value = "ID of topolog template to return",required=true) @PathVariable("id") String id);
@ApiOperation(value = "Find topolog template by ID", nickname = "getTopologTemplateById", notes = "Returns a single topolog template", authorizations = {
@ApiOperation(value = "Find topolog template by ID", nickname = "getToscaTemplateByID", notes = "Returns a single topolog template", response = String.class, authorizations = {
@Authorization(value = "drip_auth", scopes = {
@AuthorizationScope(scope = "write:TopologTemplate", description = "modify topolog template in your account"),
@AuthorizationScope(scope = "read:TopologTemplate", description = "read your topolog template")
@AuthorizationScope(scope = "read:ToscaTemplate", description = "read your topolog template"),
@AuthorizationScope(scope = "write:ToscaTemplate", description = "modify topolog template in your account")
})
}, tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation"),
@ApiResponse(code = 200, message = "successful operation", response = String.class),
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "TopologTemplate not found"),
@ApiResponse(code = 404, message = "ToscaTemplate not found"),
@ApiResponse(code = 405, message = "Invalid input") })
@RequestMapping(value = "/topolog_template/{TopologTemplateId}",
@RequestMapping(value = "/tosca_template/{id}",
produces = { "text/plain" },
method = RequestMethod.GET)
ResponseEntity<Void> getTopologTemplateById(@ApiParam(value = "ID of topolog template to return",required=true) @PathVariable("TopologTemplateId") Long topologTemplateId);
ResponseEntity<String> getToscaTemplateByID(@ApiParam(value = "ID of topolog template to return",required=true) @PathVariable("id") String id);
@ApiOperation(value = "Deletes a topolog template", nickname = "topologTemplate", notes = "", authorizations = {
@ApiOperation(value = "Updates exisintg topolog template", nickname = "updateToscaTemplateByID", notes = "", response = String.class, authorizations = {
@Authorization(value = "drip_auth", scopes = {
@AuthorizationScope(scope = "write:TopologTemplate", description = "modify topolog template in your account"),
@AuthorizationScope(scope = "read:TopologTemplate", description = "read your topolog template")
@AuthorizationScope(scope = "read:ToscaTemplate", description = "read your topolog template"),
@AuthorizationScope(scope = "write:ToscaTemplate", description = "modify topolog template in your account")
})
}, tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation"),
@ApiResponse(code = 200, message = "successful operation", response = String.class),
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "TopologTemplate not found") })
@RequestMapping(value = "/topolog_template/{TopologTemplateId}",
method = RequestMethod.DELETE)
ResponseEntity<Void> topologTemplate(@ApiParam(value = "ID of topolog template to return",required=true) @PathVariable("TopologTemplateId") Long topologTemplateId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey);
@ApiResponse(code = 404, message = "ToscaTemplate not found"),
@ApiResponse(code = 405, message = "Invalid input") })
@RequestMapping(value = "/tosca_template/{id}",
produces = { "text/plain" },
consumes = { "multipart/form-data" },
method = RequestMethod.PUT)
ResponseEntity<String> updateToscaTemplateByID(@ApiParam(value = "ID of topolog template to return",required=true) @PathVariable("id") String id,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file);
@ApiOperation(value = "Updates exisintg topolog template in the store", nickname = "updateTopologTemplate", notes = "", authorizations = {
@ApiOperation(value = "upload a tosca template description file", nickname = "uploadToscaTemplate", notes = "", response = String.class, authorizations = {
@Authorization(value = "drip_auth", scopes = {
@AuthorizationScope(scope = "write:TopologTemplate", description = "modify topolog template in your account"),
@AuthorizationScope(scope = "read:TopologTemplate", description = "read your topolog template")
@AuthorizationScope(scope = "read:ToscaTemplate", description = "read your topolog template"),
@AuthorizationScope(scope = "write:ToscaTemplate", description = "modify topolog template in your account")
})
}, tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation"),
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "TopologTemplate not found"),
@ApiResponse(code = 200, message = "successful operation", response = String.class),
@ApiResponse(code = 405, message = "Invalid input") })
@RequestMapping(value = "/topolog_template/{TopologTemplateId}",
produces = { "application/json" },
@RequestMapping(value = "/tosca_template",
consumes = { "multipart/form-data" },
method = RequestMethod.POST)
ResponseEntity<Void> updateTopologTemplate(@ApiParam(value = "ID of topolog template to return",required=true) @PathVariable("TopologTemplateId") Long topologTemplateId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file);
ResponseEntity<String> uploadToscaTemplate(@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file);
}
package nl.uva.sne.drip.api;
import org.springframework.core.io.Resource;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.*;
import javax.validation.Valid;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;
import java.util.logging.Level;
import nl.uva.sne.drip.dao.ToscaTemplateDAO;
import nl.uva.sne.drip.model.ToscaTemplate;
import nl.uva.sne.drip.service.ToscaTemplateService;
import org.springframework.beans.factory.annotation.Autowired;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-10T17:15:46.465Z")
@Controller
public class ToscaTemplateApiController implements ToscaTemplateApi {
private static final Logger log = LoggerFactory.getLogger(ToscaTemplateApiController.class);
private final ObjectMapper objectMapper;
private final HttpServletRequest request;
@Autowired
private ToscaTemplateService toscaTemplateService;
@org.springframework.beans.factory.annotation.Autowired
public ToscaTemplateApiController(ObjectMapper objectMapper, HttpServletRequest request) {
this.objectMapper = objectMapper;
this.request = request;
}
@Override
public ResponseEntity<String> deleteToscaTemplateByID(@ApiParam(value = "ID of topolog template to return", required = true) @PathVariable("id") String id) {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("application/json")) {
try {
toscaTemplateService.deleteByID(id);
return new ResponseEntity<>(objectMapper.readValue("\"\"", String.class), HttpStatus.OK);
} catch (IOException e) {
log.error("Couldn't serialize response for content type application/json", e);
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
@Override
public ResponseEntity<String> getToscaTemplateByID(@ApiParam(value = "ID of topolog template to return", required = true) @PathVariable("id") String id) {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("text/plain")) {
try {
String ymlStr = toscaTemplateService.findByID(id);
return new ResponseEntity<>(objectMapper.readValue(ymlStr, String.class), HttpStatus.OK);
} catch (IOException e) {
log.error("Couldn't serialize response for content type ", e);
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
@Override
public ResponseEntity<String> updateToscaTemplateByID(@ApiParam(value = "ID of topolog template to return", required = true) @PathVariable("id") String id, @ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file) {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("")) {
try {
id = toscaTemplateService.updateToscaTemplateByID(id);
return new ResponseEntity<>(objectMapper.readValue(String.valueOf(id), String.class), HttpStatus.OK);
} catch (IOException e) {
log.error("Couldn't serialize response for content type ", e);
return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR);
}
public ResponseEntity<String> uploadToscaTemplate(@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file) {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("*/*")) {
try {
String id = toscaTemplateService.saveFile(file);
return new ResponseEntity<>(String.valueOf(id), HttpStatus.OK);
} catch (IOException e) {
log.error("Couldn't serialize response for content type application/json", e);
return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR);
} catch (ApiException ex) {
return new ResponseEntity<String>(HttpStatus.CONFLICT);
}
}
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
......@@ -21,39 +21,59 @@ import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.List;
@javax.annotation.Generated(value = "nl.uva.sne.drip.codegen.languages.SpringCodegen", date = "2019-10-09T14:00:37.436Z")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-10T17:15:46.465Z")
@Api(value = "user", description = "the user API")
public interface UserApi {
@ApiOperation(value = "Create user", nickname = "createUser", notes = "This can only be done by the logged in user.", authorizations = {
@ApiOperation(value = "Create user", nickname = "createUser", notes = "This can only be done by admin.", response = String.class, authorizations = {
@Authorization(value = "drip_auth", scopes = {
@AuthorizationScope(scope = "admin:User", description = "Grants access to admin operations")
})
}, tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@ApiResponse(code = 200, message = "successful operation", response = String.class),
@ApiResponse(code = 409, message = "already exists") })
@RequestMapping(value = "/user",
produces = { "application/json" },
method = RequestMethod.POST)
ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body);
ResponseEntity<String> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body);
@ApiOperation(value = "Logs user into the system", nickname = "userLoginGet", notes = "", response = String.class, tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = String.class),
@ApiResponse(code = 400, message = "Invalid username/password supplied") })
@RequestMapping(value = "/user/login",
produces = { "application/json" },
method = RequestMethod.GET)
ResponseEntity<String> userLoginGet(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password);
@ApiOperation(value = "Logs out current logged in user session", nickname = "userLogoutGet", notes = "", tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@RequestMapping(value = "/user/logout",
produces = { "application/json" },
method = RequestMethod.GET)
ResponseEntity<Void> userLogoutGet();
@ApiOperation(value = "Delete user", nickname = "deleteUser", notes = "This can only be done by the logged in user.", authorizations = {
@ApiOperation(value = "Delete user", nickname = "userUsernameDelete", notes = "This can only be done by the logged in user.", authorizations = {
@Authorization(value = "drip_auth", scopes = {
@AuthorizationScope(scope = "admin:User", description = "Grants access to admin operations")
})
}, tags={ "user", })
}, tags={ })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid username supplied"),
@ApiResponse(code = 404, message = "User not found") })
@RequestMapping(value = "/user/{username}",
produces = { "application/json" },
method = RequestMethod.DELETE)
ResponseEntity<Void> deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathVariable("username") String username);
ResponseEntity<Void> userUsernameDelete(@ApiParam(value = "The name that needs to be deleted",required=true) @PathVariable("username") String username);
@ApiOperation(value = "Get user by user name", nickname = "getUserByName", notes = "", response = User.class, authorizations = {
@ApiOperation(value = "Get user by user name", nickname = "userUsernameGet", notes = "", response = User.class, authorizations = {
@Authorization(value = "drip_auth", scopes = {
@AuthorizationScope(scope = "admin:User", description = "Grants access to admin operations")
})
......@@ -65,29 +85,10 @@ public interface UserApi {
@RequestMapping(value = "/user/{username}",
produces = { "application/json" },
method = RequestMethod.GET)
ResponseEntity<User> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true) @PathVariable("username") String username);
@ApiOperation(value = "Logs user into the system", nickname = "loginUser", notes = "", response = String.class, tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = String.class),
@ApiResponse(code = 400, message = "Invalid username/password supplied") })
@RequestMapping(value = "/user/login",
produces = { "application/json" },
method = RequestMethod.GET)
ResponseEntity<String> loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password);
@ApiOperation(value = "Logs out current logged in user session", nickname = "logoutUser", notes = "", tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@RequestMapping(value = "/user/logout",
produces = { "application/json" },
method = RequestMethod.GET)
ResponseEntity<Void> logoutUser();
ResponseEntity<User> userUsernameGet(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true) @PathVariable("username") String username);
@ApiOperation(value = "Updated user", nickname = "updateUser", notes = "This can only be done by the logged in user.", authorizations = {
@ApiOperation(value = "Updated user", nickname = "userUsernamePut", notes = "This can only be done by the logged in user.", authorizations = {
@Authorization(value = "drip_auth", scopes = {
@AuthorizationScope(scope = "admin:User", description = "Grants access to admin operations")
})
......@@ -98,6 +99,6 @@ public interface UserApi {
@RequestMapping(value = "/user/{username}",
produces = { "application/json" },
method = RequestMethod.PUT)
ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be updated",required=true) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body);
ResponseEntity<Void> userUsernamePut(@ApiParam(value = "name that need to be updated",required=true) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body);
}
......@@ -20,7 +20,7 @@ import javax.validation.Valid;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;
@javax.annotation.Generated(value = "nl.uva.sne.drip.codegen.languages.SpringCodegen", date = "2019-10-09T14:00:37.436Z")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-10T17:15:46.465Z")
@Controller
public class UserApiController implements UserApi {
......@@ -37,31 +37,21 @@ public class UserApiController implements UserApi {
this.request = request;
}
public ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) {
String accept = request.getHeader("Accept");
return new ResponseEntity<Void>(HttpStatus.NOT_IMPLEMENTED);
}
public ResponseEntity<Void> deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathVariable("username") String username) {
String accept = request.getHeader("Accept");
return new ResponseEntity<Void>(HttpStatus.NOT_IMPLEMENTED);
}
public ResponseEntity<User> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true) @PathVariable("username") String username) {
public ResponseEntity<String> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("application/json")) {
try {
return new ResponseEntity<User>(objectMapper.readValue("{ \"firstName\" : \"firstName\", \"lastName\" : \"lastName\", \"password\" : \"password\", \"userStatus\" : 6, \"id\" : 0, \"email\" : \"email\", \"username\" : \"username\"}", User.class), HttpStatus.NOT_IMPLEMENTED);
return new ResponseEntity<String>(objectMapper.readValue("\"\"", String.class), HttpStatus.NOT_IMPLEMENTED);
} catch (IOException e) {
log.error("Couldn't serialize response for content type application/json", e);
return new ResponseEntity<User>(HttpStatus.INTERNAL_SERVER_ERROR);
return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
return new ResponseEntity<User>(HttpStatus.NOT_IMPLEMENTED);
return new ResponseEntity<String>(HttpStatus.NOT_IMPLEMENTED);
}
public ResponseEntity<String> loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password) {
public ResponseEntity<String> userLoginGet(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password) {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("application/json")) {
try {
......@@ -75,12 +65,31 @@ public class UserApiController implements UserApi {
return new ResponseEntity<String>(HttpStatus.NOT_IMPLEMENTED);
}
public ResponseEntity<Void> logoutUser() {
public ResponseEntity<Void> userLogoutGet() {
String accept = request.getHeader("Accept");
return new ResponseEntity<Void>(HttpStatus.NOT_IMPLEMENTED);
}
public ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be updated",required=true) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) {
public ResponseEntity<Void> userUsernameDelete(@ApiParam(value = "The name that needs to be deleted",required=true) @PathVariable("username") String username) {
String accept = request.getHeader("Accept");
return new ResponseEntity<Void>(HttpStatus.NOT_IMPLEMENTED);
}
public ResponseEntity<User> userUsernameGet(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true) @PathVariable("username") String username) {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("application/json")) {
try {
return new ResponseEntity<User>(objectMapper.readValue("{ \"firstName\" : \"firstName\", \"lastName\" : \"lastName\", \"password\" : \"password\", \"userStatus\" : 6, \"id\" : 0, \"email\" : \"email\", \"username\" : \"username\"}", User.class), HttpStatus.NOT_IMPLEMENTED);
} catch (IOException e) {
log.error("Couldn't serialize response for content type application/json", e);
return new ResponseEntity<User>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
return new ResponseEntity<User>(HttpStatus.NOT_IMPLEMENTED);
}
public ResponseEntity<Void> userUsernamePut(@ApiParam(value = "name that need to be updated",required=true) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) {
String accept = request.getHeader("Accept");
return new ResponseEntity<Void>(HttpStatus.NOT_IMPLEMENTED);
}
......
......@@ -27,6 +27,7 @@ import java.math.BigDecimal;
* Adapted from the jackson threetenbp InstantDeserializer to add support for deserializing rfc822 format.
*
* @author Nick Williams
* @param <T>
*/
public class CustomInstantDeserializer<T extends Temporal>
extends ThreeTenDateTimeDeserializerBase<T> {
......
......@@ -32,9 +32,9 @@ import org.springframework.data.mongodb.repository.config.EnableMongoRepositorie
@Configuration
@EnableMongoRepositories(basePackages = "nl.uva.sne.drip.api")
@PropertySources({
@PropertySource(value = "classpath:drip.properties", ignoreResourceNotFound = true)
@PropertySource(value = "classpath:application.properties", ignoreResourceNotFound = true)
,
@PropertySource(value = "file:etc/drip.properties", ignoreResourceNotFound = true)
@PropertySource(value = "file:etc/application.properties", ignoreResourceNotFound = true)
})
@ComponentScan(basePackages = {"nl.uva.sne.drip", "nl.uva.sne.drip.api", "nl.uva.sne.drip.configuration", "nl.uva.sne.drip.dao", "nl.uva.sne.drip.model", "nl.uva.sne.drip.service"})
public class MongoConfig extends AbstractMongoConfiguration {
......
......@@ -10,8 +10,6 @@ import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
@javax.annotation.Generated(value = "nl.uva.sne.drip.codegen.languages.SpringCodegen", date = "2019-10-09T14:00:37.436Z")
@Configuration
public class SwaggerDocumentationConfig {
......
......@@ -5,6 +5,7 @@
*/
package nl.uva.sne.drip.dao;
import nl.uva.sne.drip.model.ToscaTemplate;
import nl.uva.sne.drip.model.User;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;
......@@ -14,6 +15,6 @@ import org.springframework.stereotype.Repository;
* @author S. Koulouzis
*/
@Repository
public interface TopologTemplateDAO extends MongoRepository<User, String> {
public interface ToscaTemplateDAO extends MongoRepository<ToscaTemplate, String> {
}
package nl.uva.sne.drip.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import javax.validation.constraints.*;
/**
* Credentials
*/
@Validated
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-10T17:15:46.465Z")
public class Credentials {
@JsonProperty("protocol")
private String protocol = null;
@JsonProperty("token_type")
private String tokenType = null;
@JsonProperty("token")
private String token = null;
@JsonProperty("keys")
@Valid
private Map<String, String> keys = null;
@JsonProperty("user")
private String user = null;
@JsonProperty("cloud_provider_name")
private String cloudProviderName = null;
public Credentials protocol(String protocol) {
this.protocol = protocol;
return this;
}
/**
* Get protocol
* @return protocol
**/
@ApiModelProperty(value = "")
public String getProtocol() {
return protocol;
}
public void setProtocol(String protocol) {
this.protocol = protocol;
}
public Credentials tokenType(String tokenType) {
this.tokenType = tokenType;
return this;
}
/**
* Get tokenType
* @return tokenType
**/
@ApiModelProperty(value = "")
public String getTokenType() {
return tokenType;
}
public void setTokenType(String tokenType) {
this.tokenType = tokenType;
}
public Credentials token(String token) {
this.token = token;
return this;
}
/**
* Get token
* @return token
**/
@ApiModelProperty(value = "")
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public Credentials keys(Map<String, String> keys) {
this.keys = keys;
return this;
}
public Credentials putKeysItem(String key, String keysItem) {
if (this.keys == null) {
this.keys = new HashMap<String, String>();
}
this.keys.put(key, keysItem);
return this;
}
/**
* Get keys
* @return keys
**/
@ApiModelProperty(value = "")
public Map<String, String> getKeys() {
return keys;
}
public void setKeys(Map<String, String> keys) {
this.keys = keys;
}
public Credentials user(String user) {
this.user = user;
return this;
}
/**
* Get user
* @return user
**/
@ApiModelProperty(value = "")
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public Credentials cloudProviderName(String cloudProviderName) {
this.cloudProviderName = cloudProviderName;
return this;
}
/**
* Get cloudProviderName
* @return cloudProviderName
**/
@ApiModelProperty(value = "")
public String getCloudProviderName() {
return cloudProviderName;
}
public void setCloudProviderName(String cloudProviderName) {
this.cloudProviderName = cloudProviderName;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Credentials credentials = (Credentials) o;
return Objects.equals(this.protocol, credentials.protocol) &&
Objects.equals(this.tokenType, credentials.tokenType) &&
Objects.equals(this.token, credentials.token) &&
Objects.equals(this.keys, credentials.keys) &&
Objects.equals(this.user, credentials.user) &&
Objects.equals(this.cloudProviderName, credentials.cloudProviderName);
}
@Override
public int hashCode() {
return Objects.hash(protocol, tokenType, token, keys, user, cloudProviderName);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Credentials {\n");
sb.append(" protocol: ").append(toIndentedString(protocol)).append("\n");
sb.append(" tokenType: ").append(toIndentedString(tokenType)).append("\n");
sb.append(" token: ").append(toIndentedString(token)).append("\n");
sb.append(" keys: ").append(toIndentedString(keys)).append("\n");
sb.append(" user: ").append(toIndentedString(user)).append("\n");
sb.append(" cloudProviderName: ").append(toIndentedString(cloudProviderName)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
......@@ -17,7 +17,7 @@ import javax.validation.constraints.*;
* NodeTemplate
*/
@Validated
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-09T16:44:17.416Z")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-10T17:15:46.465Z")
public class NodeTemplate {
@JsonProperty("name")
......@@ -28,27 +28,27 @@ public class NodeTemplate {
@JsonProperty("requirements")
@Valid
private List<Map<String, String>> requirements = null;
private List<Map<String, Object>> requirements = null;
@JsonProperty("artifacts")
@Valid
private Map<String, String> artifacts = null;
private Map<String, Object> artifacts = null;
@JsonProperty("properties")
@Valid
private Map<String, String> properties = null;
private Map<String, Object> properties = null;
@JsonProperty("interfaces")
@Valid
private Map<String, String> interfaces = null;
private Map<String, Object> interfaces = null;
@JsonProperty("capabilities")
@Valid
private Map<String, String> capabilities = null;
private Map<String, Object> capabilities = null;
@JsonProperty("workflows")
@Valid
private Map<String, String> workflows = null;
private Map<String, Object> workflows = null;
public NodeTemplate name(String name) {
this.name = name;
......@@ -90,14 +90,14 @@ public class NodeTemplate {
this.type = type;
}
public NodeTemplate requirements(List<Map<String, String>> requirements) {
public NodeTemplate requirements(List<Map<String, Object>> requirements) {
this.requirements = requirements;
return this;
}
public NodeTemplate addRequirementsItem(Map<String, String> requirementsItem) {
public NodeTemplate addRequirementsItem(Map<String, Object> requirementsItem) {
if (this.requirements == null) {
this.requirements = new ArrayList<Map<String, String>>();
this.requirements = new ArrayList<Map<String, Object>>();
}
this.requirements.add(requirementsItem);
return this;
......@@ -111,22 +111,22 @@ public class NodeTemplate {
@Valid
public List<Map<String, String>> getRequirements() {
public List<Map<String, Object>> getRequirements() {
return requirements;
}
public void setRequirements(List<Map<String, String>> requirements) {
public void setRequirements(List<Map<String, Object>> requirements) {
this.requirements = requirements;
}
public NodeTemplate artifacts(Map<String, String> artifacts) {
public NodeTemplate artifacts(Map<String, Object> artifacts) {
this.artifacts = artifacts;
return this;
}
public NodeTemplate putArtifactsItem(String key, String artifactsItem) {
public NodeTemplate putArtifactsItem(String key, Object artifactsItem) {
if (this.artifacts == null) {
this.artifacts = new HashMap<String, String>();
this.artifacts = new HashMap<String, Object>();
}
this.artifacts.put(key, artifactsItem);
return this;
......@@ -139,22 +139,22 @@ public class NodeTemplate {
@ApiModelProperty(value = "")
public Map<String, String> getArtifacts() {
public Map<String, Object> getArtifacts() {
return artifacts;
}
public void setArtifacts(Map<String, String> artifacts) {
public void setArtifacts(Map<String, Object> artifacts) {
this.artifacts = artifacts;
}
public NodeTemplate properties(Map<String, String> properties) {
public NodeTemplate properties(Map<String, Object> properties) {
this.properties = properties;
return this;
}
public NodeTemplate putPropertiesItem(String key, String propertiesItem) {
public NodeTemplate putPropertiesItem(String key, Object propertiesItem) {
if (this.properties == null) {
this.properties = new HashMap<String, String>();
this.properties = new HashMap<String, Object>();
}
this.properties.put(key, propertiesItem);
return this;
......@@ -167,22 +167,22 @@ public class NodeTemplate {
@ApiModelProperty(value = "")
public Map<String, String> getProperties() {
public Map<String, Object> getProperties() {
return properties;
}
public void setProperties(Map<String, String> properties) {
public void setProperties(Map<String, Object> properties) {
this.properties = properties;
}
public NodeTemplate interfaces(Map<String, String> interfaces) {
public NodeTemplate interfaces(Map<String, Object> interfaces) {
this.interfaces = interfaces;
return this;
}
public NodeTemplate putInterfacesItem(String key, String interfacesItem) {
public NodeTemplate putInterfacesItem(String key, Object interfacesItem) {
if (this.interfaces == null) {
this.interfaces = new HashMap<String, String>();
this.interfaces = new HashMap<String, Object>();
}
this.interfaces.put(key, interfacesItem);
return this;
......@@ -195,22 +195,22 @@ public class NodeTemplate {
@ApiModelProperty(value = "")
public Map<String, String> getInterfaces() {
public Map<String, Object> getInterfaces() {
return interfaces;
}
public void setInterfaces(Map<String, String> interfaces) {
public void setInterfaces(Map<String, Object> interfaces) {
this.interfaces = interfaces;
}
public NodeTemplate capabilities(Map<String, String> capabilities) {
public NodeTemplate capabilities(Map<String, Object> capabilities) {
this.capabilities = capabilities;
return this;
}
public NodeTemplate putCapabilitiesItem(String key, String capabilitiesItem) {
public NodeTemplate putCapabilitiesItem(String key, Object capabilitiesItem) {
if (this.capabilities == null) {
this.capabilities = new HashMap<String, String>();
this.capabilities = new HashMap<String, Object>();
}
this.capabilities.put(key, capabilitiesItem);
return this;
......@@ -223,22 +223,22 @@ public class NodeTemplate {
@ApiModelProperty(value = "")
public Map<String, String> getCapabilities() {
public Map<String, Object> getCapabilities() {
return capabilities;
}
public void setCapabilities(Map<String, String> capabilities) {
public void setCapabilities(Map<String, Object> capabilities) {
this.capabilities = capabilities;
}
public NodeTemplate workflows(Map<String, String> workflows) {
public NodeTemplate workflows(Map<String, Object> workflows) {
this.workflows = workflows;
return this;
}
public NodeTemplate putWorkflowsItem(String key, String workflowsItem) {
public NodeTemplate putWorkflowsItem(String key, Object workflowsItem) {
if (this.workflows == null) {
this.workflows = new HashMap<String, String>();
this.workflows = new HashMap<String, Object>();
}
this.workflows.put(key, workflowsItem);
return this;
......@@ -251,11 +251,11 @@ public class NodeTemplate {
@ApiModelProperty(value = "")
public Map<String, String> getWorkflows() {
public Map<String, Object> getWorkflows() {
return workflows;
}
public void setWorkflows(Map<String, String> workflows) {
public void setWorkflows(Map<String, Object> workflows) {
this.workflows = workflows;
}
......
......@@ -17,7 +17,7 @@ import javax.validation.constraints.*;
* TopologyTemplate
*/
@Validated
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-09T16:44:17.416Z")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-10T17:15:46.465Z")
public class TopologyTemplate {
@JsonProperty("description")
......@@ -25,30 +25,31 @@ public class TopologyTemplate {
@JsonProperty("inputs")
@Valid
private List<Map<String, String>> inputs = null;
private List<Map<String, Object>> inputs = null;
@JsonProperty("policies")
@Valid
private List<Map<String, String>> policies = null;
private List<Map<String, Object>> policies = null;
@JsonProperty("outputs")
@Valid
private List<Map<String, String>> outputs = null;
private List<Map<String, Object>> outputs = null;
@JsonProperty("node_templates")
private NodeTemplate nodeTemplates = null;
@Valid
private Map<String, Object> nodeTemplates = null;
@JsonProperty("relationship_templates")
@Valid
private Map<String, String> relationshipTemplates = null;
private Map<String, Object> relationshipTemplates = null;
@JsonProperty("groups")
@Valid
private Map<String, String> groups = null;
private Map<String, Object> groups = null;
@JsonProperty("substitution_mappings")
@Valid
private Map<String, String> substitutionMappings = null;
private Map<String, Object> substitutionMappings = null;
public TopologyTemplate description(String description) {
this.description = description;
......@@ -70,14 +71,14 @@ public class TopologyTemplate {
this.description = description;
}
public TopologyTemplate inputs(List<Map<String, String>> inputs) {
public TopologyTemplate inputs(List<Map<String, Object>> inputs) {
this.inputs = inputs;
return this;
}
public TopologyTemplate addInputsItem(Map<String, String> inputsItem) {
public TopologyTemplate addInputsItem(Map<String, Object> inputsItem) {
if (this.inputs == null) {
this.inputs = new ArrayList<Map<String, String>>();
this.inputs = new ArrayList<Map<String, Object>>();
}
this.inputs.add(inputsItem);
return this;
......@@ -91,22 +92,22 @@ public class TopologyTemplate {
@Valid
public List<Map<String, String>> getInputs() {
public List<Map<String, Object>> getInputs() {
return inputs;
}
public void setInputs(List<Map<String, String>> inputs) {
public void setInputs(List<Map<String, Object>> inputs) {
this.inputs = inputs;
}
public TopologyTemplate policies(List<Map<String, String>> policies) {
public TopologyTemplate policies(List<Map<String, Object>> policies) {
this.policies = policies;
return this;
}
public TopologyTemplate addPoliciesItem(Map<String, String> policiesItem) {
public TopologyTemplate addPoliciesItem(Map<String, Object> policiesItem) {
if (this.policies == null) {
this.policies = new ArrayList<Map<String, String>>();
this.policies = new ArrayList<Map<String, Object>>();
}
this.policies.add(policiesItem);
return this;
......@@ -120,22 +121,22 @@ public class TopologyTemplate {
@Valid
public List<Map<String, String>> getPolicies() {
public List<Map<String, Object>> getPolicies() {
return policies;
}
public void setPolicies(List<Map<String, String>> policies) {
public void setPolicies(List<Map<String, Object>> policies) {
this.policies = policies;
}
public TopologyTemplate outputs(List<Map<String, String>> outputs) {
public TopologyTemplate outputs(List<Map<String, Object>> outputs) {
this.outputs = outputs;
return this;
}
public TopologyTemplate addOutputsItem(Map<String, String> outputsItem) {
public TopologyTemplate addOutputsItem(Map<String, Object> outputsItem) {
if (this.outputs == null) {
this.outputs = new ArrayList<Map<String, String>>();
this.outputs = new ArrayList<Map<String, Object>>();
}
this.outputs.add(outputsItem);
return this;
......@@ -149,43 +150,50 @@ public class TopologyTemplate {
@Valid
public List<Map<String, String>> getOutputs() {
public List<Map<String, Object>> getOutputs() {
return outputs;
}
public void setOutputs(List<Map<String, String>> outputs) {
public void setOutputs(List<Map<String, Object>> outputs) {
this.outputs = outputs;
}
public TopologyTemplate nodeTemplates(NodeTemplate nodeTemplates) {
public TopologyTemplate nodeTemplates(Map<String, Object> nodeTemplates) {
this.nodeTemplates = nodeTemplates;
return this;
}
public TopologyTemplate putNodeTemplatesItem(String key, Object nodeTemplatesItem) {
if (this.nodeTemplates == null) {
this.nodeTemplates = new HashMap<String, Object>();
}
this.nodeTemplates.put(key, nodeTemplatesItem);
return this;
}
/**
* Get nodeTemplates
* @return nodeTemplates
**/
@ApiModelProperty(value = "")
@Valid
public NodeTemplate getNodeTemplates() {
public Map<String, Object> getNodeTemplates() {
return nodeTemplates;
}
public void setNodeTemplates(NodeTemplate nodeTemplates) {
public void setNodeTemplates(Map<String, Object> nodeTemplates) {
this.nodeTemplates = nodeTemplates;
}
public TopologyTemplate relationshipTemplates(Map<String, String> relationshipTemplates) {
public TopologyTemplate relationshipTemplates(Map<String, Object> relationshipTemplates) {
this.relationshipTemplates = relationshipTemplates;
return this;
}
public TopologyTemplate putRelationshipTemplatesItem(String key, String relationshipTemplatesItem) {
public TopologyTemplate putRelationshipTemplatesItem(String key, Object relationshipTemplatesItem) {
if (this.relationshipTemplates == null) {
this.relationshipTemplates = new HashMap<String, String>();
this.relationshipTemplates = new HashMap<String, Object>();
}
this.relationshipTemplates.put(key, relationshipTemplatesItem);
return this;
......@@ -198,22 +206,22 @@ public class TopologyTemplate {
@ApiModelProperty(value = "")
public Map<String, String> getRelationshipTemplates() {
public Map<String, Object> getRelationshipTemplates() {
return relationshipTemplates;
}
public void setRelationshipTemplates(Map<String, String> relationshipTemplates) {
public void setRelationshipTemplates(Map<String, Object> relationshipTemplates) {
this.relationshipTemplates = relationshipTemplates;
}
public TopologyTemplate groups(Map<String, String> groups) {
public TopologyTemplate groups(Map<String, Object> groups) {
this.groups = groups;
return this;
}
public TopologyTemplate putGroupsItem(String key, String groupsItem) {
public TopologyTemplate putGroupsItem(String key, Object groupsItem) {
if (this.groups == null) {
this.groups = new HashMap<String, String>();
this.groups = new HashMap<String, Object>();
}
this.groups.put(key, groupsItem);
return this;
......@@ -226,22 +234,22 @@ public class TopologyTemplate {
@ApiModelProperty(value = "")
public Map<String, String> getGroups() {
public Map<String, Object> getGroups() {
return groups;
}
public void setGroups(Map<String, String> groups) {
public void setGroups(Map<String, Object> groups) {
this.groups = groups;
}
public TopologyTemplate substitutionMappings(Map<String, String> substitutionMappings) {
public TopologyTemplate substitutionMappings(Map<String, Object> substitutionMappings) {
this.substitutionMappings = substitutionMappings;
return this;
}
public TopologyTemplate putSubstitutionMappingsItem(String key, String substitutionMappingsItem) {
public TopologyTemplate putSubstitutionMappingsItem(String key, Object substitutionMappingsItem) {
if (this.substitutionMappings == null) {
this.substitutionMappings = new HashMap<String, String>();
this.substitutionMappings = new HashMap<String, Object>();
}
this.substitutionMappings.put(key, substitutionMappingsItem);
return this;
......@@ -254,11 +262,11 @@ public class TopologyTemplate {
@ApiModelProperty(value = "")
public Map<String, String> getSubstitutionMappings() {
public Map<String, Object> getSubstitutionMappings() {
return substitutionMappings;
}
public void setSubstitutionMappings(Map<String, String> substitutionMappings) {
public void setSubstitutionMappings(Map<String, Object> substitutionMappings) {
this.substitutionMappings = substitutionMappings;
}
......
......@@ -3,6 +3,8 @@ package nl.uva.sne.drip.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
......@@ -12,610 +14,641 @@ import java.util.Map;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import javax.validation.constraints.*;
import org.springframework.data.annotation.Id;
/**
* ToscaTemplate
*/
@Validated
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-09T16:44:17.416Z")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ToscaTemplate {
public class ToscaTemplate {
@JsonProperty("tosca_definitions_version")
private String toscaDefinitionsVersion = null;
@Id
@JsonIgnore
private String id;
@JsonProperty("tosca_default_namespace")
private String toscaDefaultNamespace = null;
@JsonProperty("tosca_definitions_version")
private String toscaDefinitionsVersion = null;
@JsonProperty("template_name")
private String templateName = null;
@JsonProperty("tosca_default_namespace")
private String toscaDefaultNamespace = null;
@JsonProperty("imports")
@Valid
private List<Map<String, String>> imports = null;
@JsonProperty("template_name")
private String templateName = null;
@JsonProperty("repositories")
@Valid
private List<Map<String, String>> repositories = null;
@JsonProperty("imports")
@Valid
private List<Map<String, String>> imports = null;
@JsonProperty("dsl_definitions")
@Valid
private Map<String, String> dslDefinitions = null;
@JsonProperty("repositories")
@Valid
private Map<String, String> repositories = null;
@JsonProperty("node_types")
@Valid
private Map<String, String> nodeTypes = null;
@JsonProperty("dsl_definitions")
@Valid
private Map<String, String> dslDefinitions = null;
@JsonProperty("topology_template")
private TopologyTemplate topologyTemplate = null;
@JsonProperty("node_types")
@Valid
private Map<String, Object> nodeTypes = null;
@JsonProperty("relationship_types")
@Valid
private Map<String, String> relationshipTypes = null;
@JsonProperty("topology_template")
private TopologyTemplate topologyTemplate = null;
@JsonProperty("relationship_templates")
@Valid
private Map<String, String> relationshipTemplates = null;
@JsonProperty("relationship_types")
@Valid
private Map<String, Object> relationshipTypes = null;
@JsonProperty("capability_types")
@Valid
private Map<String, String> capabilityTypes = null;
@JsonProperty("relationship_templates")
@Valid
private Map<String, Object> relationshipTemplates = null;
@JsonProperty("artifact_types")
@Valid
private Map<String, String> artifactTypes = null;
@JsonProperty("capability_types")
@Valid
private Map<String, Object> capabilityTypes = null;
@JsonProperty("data_types")
@Valid
private Map<String, String> dataTypes = null;
@JsonProperty("artifact_types")
@Valid
private Map<String, Object> artifactTypes = null;
@JsonProperty("interface_types")
@Valid
private Map<String, String> interfaceTypes = null;
@JsonProperty("data_types")
@Valid
private Map<String, Object> dataTypes = null;
@JsonProperty("policy_types")
@Valid
private Map<String, String> policyTypes = null;
@JsonProperty("interface_types")
@Valid
private Map<String, Object> interfaceTypes = null;
@JsonProperty("group_types")
@Valid
private Map<String, String> groupTypes = null;
@JsonProperty("policy_types")
@Valid
private Map<String, String> policyTypes = null;
@JsonProperty("description")
private String description = null;
@JsonProperty("group_types")
@Valid
private Map<String, Object> groupTypes = null;
@JsonProperty("template_author")
private String templateAuthor = null;
@JsonProperty("description")
private String description = null;
public ToscaTemplate toscaDefinitionsVersion(String toscaDefinitionsVersion) {
this.toscaDefinitionsVersion = toscaDefinitionsVersion;
return this;
}
@JsonProperty("template_author")
private String templateAuthor = null;
/**
* Get toscaDefinitionsVersion
* @return toscaDefinitionsVersion
**/
@ApiModelProperty(value = "")
public ToscaTemplate toscaDefinitionsVersion(String toscaDefinitionsVersion) {
this.toscaDefinitionsVersion = toscaDefinitionsVersion;
return this;
}
@JsonIgnore
public String getId() {
return id;
}
public String getToscaDefinitionsVersion() {
return toscaDefinitionsVersion;
}
public void setID(String id) {
this.id = id;
}
public void setToscaDefinitionsVersion(String toscaDefinitionsVersion) {
this.toscaDefinitionsVersion = toscaDefinitionsVersion;
}
/**
* Get toscaDefinitionsVersion
*
* @return toscaDefinitionsVersion
*
*/
@ApiModelProperty(value = "")
public ToscaTemplate toscaDefaultNamespace(String toscaDefaultNamespace) {
this.toscaDefaultNamespace = toscaDefaultNamespace;
return this;
}
public String getToscaDefinitionsVersion() {
return toscaDefinitionsVersion;
}
/**
* Get toscaDefaultNamespace
* @return toscaDefaultNamespace
**/
@ApiModelProperty(value = "")
public void setToscaDefinitionsVersion(String toscaDefinitionsVersion) {
this.toscaDefinitionsVersion = toscaDefinitionsVersion;
}
public ToscaTemplate toscaDefaultNamespace(String toscaDefaultNamespace) {
this.toscaDefaultNamespace = toscaDefaultNamespace;
return this;
}
public String getToscaDefaultNamespace() {
return toscaDefaultNamespace;
}
/**
* Get toscaDefaultNamespace
*
* @return toscaDefaultNamespace
*
*/
@ApiModelProperty(value = "")
public void setToscaDefaultNamespace(String toscaDefaultNamespace) {
this.toscaDefaultNamespace = toscaDefaultNamespace;
}
public String getToscaDefaultNamespace() {
return toscaDefaultNamespace;
}
public ToscaTemplate templateName(String templateName) {
this.templateName = templateName;
return this;
}
public void setToscaDefaultNamespace(String toscaDefaultNamespace) {
this.toscaDefaultNamespace = toscaDefaultNamespace;
}
/**
* Get templateName
* @return templateName
**/
@ApiModelProperty(value = "")
public ToscaTemplate templateName(String templateName) {
this.templateName = templateName;
return this;
}
/**
* Get templateName
*
* @return templateName
*
*/
@ApiModelProperty(value = "")
public String getTemplateName() {
return templateName;
}
public String getTemplateName() {
return templateName;
}
public void setTemplateName(String templateName) {
this.templateName = templateName;
}
public void setTemplateName(String templateName) {
this.templateName = templateName;
}
public ToscaTemplate imports(List<Map<String, String>> imports) {
this.imports = imports;
return this;
}
public ToscaTemplate imports(List<Map<String, String>> imports) {
this.imports = imports;
return this;
}
public ToscaTemplate addImportsItem(Map<String, String> importsItem) {
if (this.imports == null) {
this.imports = new ArrayList<Map<String, String>>();
public ToscaTemplate addImportsItem(Map<String, String> importsItem) {
if (this.imports == null) {
this.imports = new ArrayList<Map<String, String>>();
}
this.imports.add(importsItem);
return this;
}
this.imports.add(importsItem);
return this;
}
/**
* Get imports
* @return imports
**/
@ApiModelProperty(value = "")
/**
* Get imports
*
* @return imports
*
*/
@ApiModelProperty(value = "")
@Valid
@Valid
public List<Map<String, String>> getImports() {
return imports;
}
public List<Map<String, String>> getImports() {
return imports;
}
public void setImports(List<Map<String, String>> imports) {
this.imports = imports;
}
public void setImports(List<Map<String, String>> imports) {
this.imports = imports;
}
public ToscaTemplate repositories(List<Map<String, String>> repositories) {
this.repositories = repositories;
return this;
}
public ToscaTemplate repositories(Map<String, String> repositories) {
this.repositories = repositories;
return this;
}
public ToscaTemplate addRepositoriesItem(Map<String, String> repositoriesItem) {
if (this.repositories == null) {
this.repositories = new ArrayList<Map<String, String>>();
}
this.repositories.add(repositoriesItem);
return this;
}
/**
* Get repositories
* @return repositories
**/
@ApiModelProperty(value = "")
public ToscaTemplate putRepositoriesItem(String key, String repositoriesItem) {
if (this.repositories == null) {
this.repositories = new HashMap<String, String>();
}
this.repositories.put(key, repositoriesItem);
return this;
}
@Valid
/**
* Get repositories
*
* @return repositories
*
*/
@ApiModelProperty(value = "")
public List<Map<String, String>> getRepositories() {
return repositories;
}
public void setRepositories(List<Map<String, String>> repositories) {
this.repositories = repositories;
}
public ToscaTemplate dslDefinitions(Map<String, String> dslDefinitions) {
this.dslDefinitions = dslDefinitions;
return this;
}
public Map<String, String> getRepositories() {
return repositories;
}
public ToscaTemplate putDslDefinitionsItem(String key, String dslDefinitionsItem) {
if (this.dslDefinitions == null) {
this.dslDefinitions = new HashMap<String, String>();
}
this.dslDefinitions.put(key, dslDefinitionsItem);
return this;
}
public void setRepositories(Map<String, String> repositories) {
this.repositories = repositories;
}
/**
* Get dslDefinitions
* @return dslDefinitions
**/
@ApiModelProperty(value = "")
public Map<String, String> getDslDefinitions() {
return dslDefinitions;
}
public void setDslDefinitions(Map<String, String> dslDefinitions) {
this.dslDefinitions = dslDefinitions;
}
public ToscaTemplate nodeTypes(Map<String, String> nodeTypes) {
this.nodeTypes = nodeTypes;
return this;
}
public ToscaTemplate dslDefinitions(Map<String, String> dslDefinitions) {
this.dslDefinitions = dslDefinitions;
return this;
}
public ToscaTemplate putNodeTypesItem(String key, String nodeTypesItem) {
if (this.nodeTypes == null) {
this.nodeTypes = new HashMap<String, String>();
}
this.nodeTypes.put(key, nodeTypesItem);
return this;
}
/**
* Get nodeTypes
* @return nodeTypes
**/
@ApiModelProperty(value = "")
public ToscaTemplate putDslDefinitionsItem(String key, String dslDefinitionsItem) {
if (this.dslDefinitions == null) {
this.dslDefinitions = new HashMap<String, String>();
}
this.dslDefinitions.put(key, dslDefinitionsItem);
return this;
}
/**
* Get dslDefinitions
*
* @return dslDefinitions
*
*/
@ApiModelProperty(value = "")
public Map<String, String> getNodeTypes() {
return nodeTypes;
}
public void setNodeTypes(Map<String, String> nodeTypes) {
this.nodeTypes = nodeTypes;
}
public ToscaTemplate topologyTemplate(TopologyTemplate topologyTemplate) {
this.topologyTemplate = topologyTemplate;
return this;
}
/**
* Get topologyTemplate
* @return topologyTemplate
**/
@ApiModelProperty(value = "")
public Map<String, String> getDslDefinitions() {
return dslDefinitions;
}
@Valid
public TopologyTemplate getTopologyTemplate() {
return topologyTemplate;
}
public void setTopologyTemplate(TopologyTemplate topologyTemplate) {
this.topologyTemplate = topologyTemplate;
}
public ToscaTemplate relationshipTypes(Map<String, String> relationshipTypes) {
this.relationshipTypes = relationshipTypes;
return this;
}
public void setDslDefinitions(Map<String, String> dslDefinitions) {
this.dslDefinitions = dslDefinitions;
}
public ToscaTemplate putRelationshipTypesItem(String key, String relationshipTypesItem) {
if (this.relationshipTypes == null) {
this.relationshipTypes = new HashMap<String, String>();
public ToscaTemplate nodeTypes(Map<String, Object> nodeTypes) {
this.nodeTypes = nodeTypes;
return this;
}
this.relationshipTypes.put(key, relationshipTypesItem);
return this;
}
/**
* Get relationshipTypes
* @return relationshipTypes
**/
@ApiModelProperty(value = "")
public ToscaTemplate putNodeTypesItem(String key, Object nodeTypesItem) {
if (this.nodeTypes == null) {
this.nodeTypes = new HashMap<String, Object>();
}
this.nodeTypes.put(key, nodeTypesItem);
return this;
}
/**
* Get nodeTypes
*
* @return nodeTypes
*
*/
@ApiModelProperty(value = "")
public Map<String, String> getRelationshipTypes() {
return relationshipTypes;
}
public void setRelationshipTypes(Map<String, String> relationshipTypes) {
this.relationshipTypes = relationshipTypes;
}
public ToscaTemplate relationshipTemplates(Map<String, String> relationshipTemplates) {
this.relationshipTemplates = relationshipTemplates;
return this;
}
public Map<String, Object> getNodeTypes() {
return nodeTypes;
}
public ToscaTemplate putRelationshipTemplatesItem(String key, String relationshipTemplatesItem) {
if (this.relationshipTemplates == null) {
this.relationshipTemplates = new HashMap<String, String>();
public void setNodeTypes(Map<String, Object> nodeTypes) {
this.nodeTypes = nodeTypes;
}
this.relationshipTemplates.put(key, relationshipTemplatesItem);
return this;
}
/**
* Get relationshipTemplates
* @return relationshipTemplates
**/
@ApiModelProperty(value = "")
public ToscaTemplate topologyTemplate(TopologyTemplate topologyTemplate) {
this.topologyTemplate = topologyTemplate;
return this;
}
/**
* Get topologyTemplate
*
* @return topologyTemplate
*
*/
@ApiModelProperty(value = "")
public Map<String, String> getRelationshipTemplates() {
return relationshipTemplates;
}
public void setRelationshipTemplates(Map<String, String> relationshipTemplates) {
this.relationshipTemplates = relationshipTemplates;
}
public ToscaTemplate capabilityTypes(Map<String, String> capabilityTypes) {
this.capabilityTypes = capabilityTypes;
return this;
}
@Valid
public ToscaTemplate putCapabilityTypesItem(String key, String capabilityTypesItem) {
if (this.capabilityTypes == null) {
this.capabilityTypes = new HashMap<String, String>();
public TopologyTemplate getTopologyTemplate() {
return topologyTemplate;
}
this.capabilityTypes.put(key, capabilityTypesItem);
return this;
}
/**
* Get capabilityTypes
* @return capabilityTypes
**/
@ApiModelProperty(value = "")
public void setTopologyTemplate(TopologyTemplate topologyTemplate) {
this.topologyTemplate = topologyTemplate;
}
public ToscaTemplate relationshipTypes(Map<String, Object> relationshipTypes) {
this.relationshipTypes = relationshipTypes;
return this;
}
public ToscaTemplate putRelationshipTypesItem(String key, Object relationshipTypesItem) {
if (this.relationshipTypes == null) {
this.relationshipTypes = new HashMap<String, Object>();
}
this.relationshipTypes.put(key, relationshipTypesItem);
return this;
}
/**
* Get relationshipTypes
*
* @return relationshipTypes
*
*/
@ApiModelProperty(value = "")
public Map<String, Object> getRelationshipTypes() {
return relationshipTypes;
}
public void setRelationshipTypes(Map<String, Object> relationshipTypes) {
this.relationshipTypes = relationshipTypes;
}
public Map<String, String> getCapabilityTypes() {
return capabilityTypes;
}
public void setCapabilityTypes(Map<String, String> capabilityTypes) {
this.capabilityTypes = capabilityTypes;
}
public ToscaTemplate artifactTypes(Map<String, String> artifactTypes) {
this.artifactTypes = artifactTypes;
return this;
}
public ToscaTemplate relationshipTemplates(Map<String, Object> relationshipTemplates) {
this.relationshipTemplates = relationshipTemplates;
return this;
}
public ToscaTemplate putArtifactTypesItem(String key, String artifactTypesItem) {
if (this.artifactTypes == null) {
this.artifactTypes = new HashMap<String, String>();
public ToscaTemplate putRelationshipTemplatesItem(String key, Object relationshipTemplatesItem) {
if (this.relationshipTemplates == null) {
this.relationshipTemplates = new HashMap<String, Object>();
}
this.relationshipTemplates.put(key, relationshipTemplatesItem);
return this;
}
this.artifactTypes.put(key, artifactTypesItem);
return this;
}
/**
* Get artifactTypes
* @return artifactTypes
**/
@ApiModelProperty(value = "")
/**
* Get relationshipTemplates
*
* @return relationshipTemplates
*
*/
@ApiModelProperty(value = "")
public Map<String, Object> getRelationshipTemplates() {
return relationshipTemplates;
}
public void setRelationshipTemplates(Map<String, Object> relationshipTemplates) {
this.relationshipTemplates = relationshipTemplates;
}
public Map<String, String> getArtifactTypes() {
return artifactTypes;
}
public ToscaTemplate capabilityTypes(Map<String, Object> capabilityTypes) {
this.capabilityTypes = capabilityTypes;
return this;
}
public void setArtifactTypes(Map<String, String> artifactTypes) {
this.artifactTypes = artifactTypes;
}
public ToscaTemplate putCapabilityTypesItem(String key, Object capabilityTypesItem) {
if (this.capabilityTypes == null) {
this.capabilityTypes = new HashMap<String, Object>();
}
this.capabilityTypes.put(key, capabilityTypesItem);
return this;
}
public ToscaTemplate dataTypes(Map<String, String> dataTypes) {
this.dataTypes = dataTypes;
return this;
}
/**
* Get capabilityTypes
*
* @return capabilityTypes
*
*/
@ApiModelProperty(value = "")
public ToscaTemplate putDataTypesItem(String key, String dataTypesItem) {
if (this.dataTypes == null) {
this.dataTypes = new HashMap<String, String>();
public Map<String, Object> getCapabilityTypes() {
return capabilityTypes;
}
this.dataTypes.put(key, dataTypesItem);
return this;
}
/**
* Get dataTypes
* @return dataTypes
**/
@ApiModelProperty(value = "")
public void setCapabilityTypes(Map<String, Object> capabilityTypes) {
this.capabilityTypes = capabilityTypes;
}
public ToscaTemplate artifactTypes(Map<String, Object> artifactTypes) {
this.artifactTypes = artifactTypes;
return this;
}
public Map<String, String> getDataTypes() {
return dataTypes;
}
public ToscaTemplate putArtifactTypesItem(String key, Object artifactTypesItem) {
if (this.artifactTypes == null) {
this.artifactTypes = new HashMap<String, Object>();
}
this.artifactTypes.put(key, artifactTypesItem);
return this;
}
public void setDataTypes(Map<String, String> dataTypes) {
this.dataTypes = dataTypes;
}
/**
* Get artifactTypes
*
* @return artifactTypes
*
*/
@ApiModelProperty(value = "")
public ToscaTemplate interfaceTypes(Map<String, String> interfaceTypes) {
this.interfaceTypes = interfaceTypes;
return this;
}
public Map<String, Object> getArtifactTypes() {
return artifactTypes;
}
public ToscaTemplate putInterfaceTypesItem(String key, String interfaceTypesItem) {
if (this.interfaceTypes == null) {
this.interfaceTypes = new HashMap<String, String>();
public void setArtifactTypes(Map<String, Object> artifactTypes) {
this.artifactTypes = artifactTypes;
}
this.interfaceTypes.put(key, interfaceTypesItem);
return this;
}
/**
* Get interfaceTypes
* @return interfaceTypes
**/
@ApiModelProperty(value = "")
public ToscaTemplate dataTypes(Map<String, Object> dataTypes) {
this.dataTypes = dataTypes;
return this;
}
public Map<String, String> getInterfaceTypes() {
return interfaceTypes;
}
public ToscaTemplate putDataTypesItem(String key, Object dataTypesItem) {
if (this.dataTypes == null) {
this.dataTypes = new HashMap<String, Object>();
}
this.dataTypes.put(key, dataTypesItem);
return this;
}
public void setInterfaceTypes(Map<String, String> interfaceTypes) {
this.interfaceTypes = interfaceTypes;
}
/**
* Get dataTypes
*
* @return dataTypes
*
*/
@ApiModelProperty(value = "")
public ToscaTemplate policyTypes(Map<String, String> policyTypes) {
this.policyTypes = policyTypes;
return this;
}
public Map<String, Object> getDataTypes() {
return dataTypes;
}
public ToscaTemplate putPolicyTypesItem(String key, String policyTypesItem) {
if (this.policyTypes == null) {
this.policyTypes = new HashMap<String, String>();
public void setDataTypes(Map<String, Object> dataTypes) {
this.dataTypes = dataTypes;
}
this.policyTypes.put(key, policyTypesItem);
return this;
}
/**
* Get policyTypes
* @return policyTypes
**/
@ApiModelProperty(value = "")
public Map<String, String> getPolicyTypes() {
return policyTypes;
}
public void setPolicyTypes(Map<String, String> policyTypes) {
this.policyTypes = policyTypes;
}
public ToscaTemplate groupTypes(Map<String, String> groupTypes) {
this.groupTypes = groupTypes;
return this;
}
public ToscaTemplate putGroupTypesItem(String key, String groupTypesItem) {
if (this.groupTypes == null) {
this.groupTypes = new HashMap<String, String>();
}
this.groupTypes.put(key, groupTypesItem);
return this;
}
/**
* Get groupTypes
* @return groupTypes
**/
@ApiModelProperty(value = "")
public Map<String, String> getGroupTypes() {
return groupTypes;
}
public void setGroupTypes(Map<String, String> groupTypes) {
this.groupTypes = groupTypes;
}
public ToscaTemplate description(String description) {
this.description = description;
return this;
}
/**
* Get description
* @return description
**/
@ApiModelProperty(value = "")
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public ToscaTemplate templateAuthor(String templateAuthor) {
this.templateAuthor = templateAuthor;
return this;
}
/**
* Get templateAuthor
* @return templateAuthor
**/
@ApiModelProperty(value = "")
public String getTemplateAuthor() {
return templateAuthor;
}
public void setTemplateAuthor(String templateAuthor) {
this.templateAuthor = templateAuthor;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ToscaTemplate toscaTemplate = (ToscaTemplate) o;
return Objects.equals(this.toscaDefinitionsVersion, toscaTemplate.toscaDefinitionsVersion) &&
Objects.equals(this.toscaDefaultNamespace, toscaTemplate.toscaDefaultNamespace) &&
Objects.equals(this.templateName, toscaTemplate.templateName) &&
Objects.equals(this.imports, toscaTemplate.imports) &&
Objects.equals(this.repositories, toscaTemplate.repositories) &&
Objects.equals(this.dslDefinitions, toscaTemplate.dslDefinitions) &&
Objects.equals(this.nodeTypes, toscaTemplate.nodeTypes) &&
Objects.equals(this.topologyTemplate, toscaTemplate.topologyTemplate) &&
Objects.equals(this.relationshipTypes, toscaTemplate.relationshipTypes) &&
Objects.equals(this.relationshipTemplates, toscaTemplate.relationshipTemplates) &&
Objects.equals(this.capabilityTypes, toscaTemplate.capabilityTypes) &&
Objects.equals(this.artifactTypes, toscaTemplate.artifactTypes) &&
Objects.equals(this.dataTypes, toscaTemplate.dataTypes) &&
Objects.equals(this.interfaceTypes, toscaTemplate.interfaceTypes) &&
Objects.equals(this.policyTypes, toscaTemplate.policyTypes) &&
Objects.equals(this.groupTypes, toscaTemplate.groupTypes) &&
Objects.equals(this.description, toscaTemplate.description) &&
Objects.equals(this.templateAuthor, toscaTemplate.templateAuthor);
}
@Override
public int hashCode() {
return Objects.hash(toscaDefinitionsVersion, toscaDefaultNamespace, templateName, imports, repositories, dslDefinitions, nodeTypes, topologyTemplate, relationshipTypes, relationshipTemplates, capabilityTypes, artifactTypes, dataTypes, interfaceTypes, policyTypes, groupTypes, description, templateAuthor);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ToscaTemplate {\n");
sb.append(" toscaDefinitionsVersion: ").append(toIndentedString(toscaDefinitionsVersion)).append("\n");
sb.append(" toscaDefaultNamespace: ").append(toIndentedString(toscaDefaultNamespace)).append("\n");
sb.append(" templateName: ").append(toIndentedString(templateName)).append("\n");
sb.append(" imports: ").append(toIndentedString(imports)).append("\n");
sb.append(" repositories: ").append(toIndentedString(repositories)).append("\n");
sb.append(" dslDefinitions: ").append(toIndentedString(dslDefinitions)).append("\n");
sb.append(" nodeTypes: ").append(toIndentedString(nodeTypes)).append("\n");
sb.append(" topologyTemplate: ").append(toIndentedString(topologyTemplate)).append("\n");
sb.append(" relationshipTypes: ").append(toIndentedString(relationshipTypes)).append("\n");
sb.append(" relationshipTemplates: ").append(toIndentedString(relationshipTemplates)).append("\n");
sb.append(" capabilityTypes: ").append(toIndentedString(capabilityTypes)).append("\n");
sb.append(" artifactTypes: ").append(toIndentedString(artifactTypes)).append("\n");
sb.append(" dataTypes: ").append(toIndentedString(dataTypes)).append("\n");
sb.append(" interfaceTypes: ").append(toIndentedString(interfaceTypes)).append("\n");
sb.append(" policyTypes: ").append(toIndentedString(policyTypes)).append("\n");
sb.append(" groupTypes: ").append(toIndentedString(groupTypes)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" templateAuthor: ").append(toIndentedString(templateAuthor)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
public ToscaTemplate interfaceTypes(Map<String, Object> interfaceTypes) {
this.interfaceTypes = interfaceTypes;
return this;
}
public ToscaTemplate putInterfaceTypesItem(String key, Object interfaceTypesItem) {
if (this.interfaceTypes == null) {
this.interfaceTypes = new HashMap<String, Object>();
}
this.interfaceTypes.put(key, interfaceTypesItem);
return this;
}
/**
* Get interfaceTypes
*
* @return interfaceTypes
*
*/
@ApiModelProperty(value = "")
public Map<String, Object> getInterfaceTypes() {
return interfaceTypes;
}
public void setInterfaceTypes(Map<String, Object> interfaceTypes) {
this.interfaceTypes = interfaceTypes;
}
public ToscaTemplate policyTypes(Map<String, String> policyTypes) {
this.policyTypes = policyTypes;
return this;
}
public ToscaTemplate putPolicyTypesItem(String key, String policyTypesItem) {
if (this.policyTypes == null) {
this.policyTypes = new HashMap<String, String>();
}
this.policyTypes.put(key, policyTypesItem);
return this;
}
/**
* Get policyTypes
*
* @return policyTypes
*
*/
@ApiModelProperty(value = "")
public Map<String, String> getPolicyTypes() {
return policyTypes;
}
public void setPolicyTypes(Map<String, String> policyTypes) {
this.policyTypes = policyTypes;
}
public ToscaTemplate groupTypes(Map<String, Object> groupTypes) {
this.groupTypes = groupTypes;
return this;
}
public ToscaTemplate putGroupTypesItem(String key, Object groupTypesItem) {
if (this.groupTypes == null) {
this.groupTypes = new HashMap<String, Object>();
}
this.groupTypes.put(key, groupTypesItem);
return this;
}
/**
* Get groupTypes
*
* @return groupTypes
*
*/
@ApiModelProperty(value = "")
public Map<String, Object> getGroupTypes() {
return groupTypes;
}
public void setGroupTypes(Map<String, Object> groupTypes) {
this.groupTypes = groupTypes;
}
public ToscaTemplate description(String description) {
this.description = description;
return this;
}
/**
* Get description
*
* @return description
*
*/
@ApiModelProperty(value = "")
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public ToscaTemplate templateAuthor(String templateAuthor) {
this.templateAuthor = templateAuthor;
return this;
}
/**
* Get templateAuthor
*
* @return templateAuthor
*
*/
@ApiModelProperty(value = "")
public String getTemplateAuthor() {
return templateAuthor;
}
public void setTemplateAuthor(String templateAuthor) {
this.templateAuthor = templateAuthor;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ToscaTemplate toscaTemplate = (ToscaTemplate) o;
return Objects.equals(this.toscaDefinitionsVersion, toscaTemplate.toscaDefinitionsVersion)
&& Objects.equals(this.toscaDefaultNamespace, toscaTemplate.toscaDefaultNamespace)
&& Objects.equals(this.templateName, toscaTemplate.templateName)
&& Objects.equals(this.imports, toscaTemplate.imports)
&& Objects.equals(this.repositories, toscaTemplate.repositories)
&& Objects.equals(this.dslDefinitions, toscaTemplate.dslDefinitions)
&& Objects.equals(this.nodeTypes, toscaTemplate.nodeTypes)
&& Objects.equals(this.topologyTemplate, toscaTemplate.topologyTemplate)
&& Objects.equals(this.relationshipTypes, toscaTemplate.relationshipTypes)
&& Objects.equals(this.relationshipTemplates, toscaTemplate.relationshipTemplates)
&& Objects.equals(this.capabilityTypes, toscaTemplate.capabilityTypes)
&& Objects.equals(this.artifactTypes, toscaTemplate.artifactTypes)
&& Objects.equals(this.dataTypes, toscaTemplate.dataTypes)
&& Objects.equals(this.interfaceTypes, toscaTemplate.interfaceTypes)
&& Objects.equals(this.policyTypes, toscaTemplate.policyTypes)
&& Objects.equals(this.groupTypes, toscaTemplate.groupTypes)
&& Objects.equals(this.description, toscaTemplate.description)
&& Objects.equals(this.templateAuthor, toscaTemplate.templateAuthor);
}
@Override
public int hashCode() {
return Objects.hash(toscaDefinitionsVersion, toscaDefaultNamespace, templateName, imports, repositories, dslDefinitions, nodeTypes, topologyTemplate, relationshipTypes, relationshipTemplates, capabilityTypes, artifactTypes, dataTypes, interfaceTypes, policyTypes, groupTypes, description, templateAuthor);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ToscaTemplate {\n");
sb.append(" toscaDefinitionsVersion: ").append(toIndentedString(toscaDefinitionsVersion)).append("\n");
sb.append(" toscaDefaultNamespace: ").append(toIndentedString(toscaDefaultNamespace)).append("\n");
sb.append(" templateName: ").append(toIndentedString(templateName)).append("\n");
sb.append(" imports: ").append(toIndentedString(imports)).append("\n");
sb.append(" repositories: ").append(toIndentedString(repositories)).append("\n");
sb.append(" dslDefinitions: ").append(toIndentedString(dslDefinitions)).append("\n");
sb.append(" nodeTypes: ").append(toIndentedString(nodeTypes)).append("\n");
sb.append(" topologyTemplate: ").append(toIndentedString(topologyTemplate)).append("\n");
sb.append(" relationshipTypes: ").append(toIndentedString(relationshipTypes)).append("\n");
sb.append(" relationshipTemplates: ").append(toIndentedString(relationshipTemplates)).append("\n");
sb.append(" capabilityTypes: ").append(toIndentedString(capabilityTypes)).append("\n");
sb.append(" artifactTypes: ").append(toIndentedString(artifactTypes)).append("\n");
sb.append(" dataTypes: ").append(toIndentedString(dataTypes)).append("\n");
sb.append(" interfaceTypes: ").append(toIndentedString(interfaceTypes)).append("\n");
sb.append(" policyTypes: ").append(toIndentedString(policyTypes)).append("\n");
sb.append(" groupTypes: ").append(toIndentedString(groupTypes)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" templateAuthor: ").append(toIndentedString(templateAuthor)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
......@@ -13,7 +13,7 @@ import javax.validation.constraints.*;
* User
*/
@Validated
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-09T16:44:17.416Z")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-10T17:15:46.465Z")
public class User {
@JsonProperty("id")
......
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package nl.uva.sne.drip.service;
import nl.uva.sne.drip.dao.TopologTemplateDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
* @author S. Koulouzis
*/
@Service
public class TopologTemplateService {
@Autowired
private TopologTemplateDAO dao;
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package nl.uva.sne.drip.service;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.databind.SerializationConfig;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator.Feature;
import java.io.IOException;
import java.util.Map;
import java.util.Optional;
import nl.uva.sne.drip.api.ApiException;
import nl.uva.sne.drip.dao.ToscaTemplateDAO;
import nl.uva.sne.drip.model.ToscaTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import nl.uva.sne.drip.commons.utils.Converter;
import org.springframework.data.domain.Example;
/**
*
* @author S. Koulouzis
*/
@Service
public class ToscaTemplateService {
private final ObjectMapper objectMapper;
@org.springframework.beans.factory.annotation.Autowired
public ToscaTemplateService() {
this.objectMapper = new ObjectMapper(new YAMLFactory().disable(Feature.WRITE_DOC_START_MARKER));
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
}
@Autowired
private ToscaTemplateDAO dao;
public String save(ToscaTemplate tt) {
dao.save(tt);
return tt.getId();
}
public String saveFile(MultipartFile file) throws IOException, ApiException {
String originalFileName = file.getOriginalFilename();
String name = System.currentTimeMillis() + "_" + originalFileName;
byte[] bytes = file.getBytes();
String ymlStr = new String(bytes, "UTF-8");
ToscaTemplate tt = objectMapper.readValue(ymlStr, ToscaTemplate.class);
Example<ToscaTemplate> templateExample = Example.of(tt);
Optional<ToscaTemplate> result = dao.findOne(templateExample);
if (result.equals(tt)) {
throw new ApiException(409, "Tosca Template already exists");
}
save(tt);
return tt.getId();
}
public String updateToscaTemplateByID(String id, MultipartFile file) throws IOException {
ToscaTemplate tt = dao.findById(id).get();
if (tt == null) {
throw new NullPointerException();
}
byte[] bytes = file.getBytes();
String ymlStr = new String(bytes, "UTF-8");
tt = objectMapper.readValue(ymlStr, ToscaTemplate.class);
tt.setID(id);
return save(tt);
}
public String updateToscaTemplateByID(String id) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
public String findByID(String id) throws JsonProcessingException {
ToscaTemplate tt = dao.findById(id).get();
return objectMapper.writeValueAsString(tt);
}
public void deleteByID(String id) {
dao.deleteById(id);
}
}
......@@ -8,4 +8,7 @@ message.broker.host=127.0.0.1
db.host=127.0.0.1
db.name=drip
db.username=drip-user
db.password=drip-pass
\ No newline at end of file
db.password=drip-pass
spring.jackson.deserialization.UNWRAP_ROOT_VALUE=true
\ No newline at end of file
......@@ -17,6 +17,7 @@ paths:
post:
summary: "upload a tosca template description file"
description: ""
operationId: "uploadToscaTemplate"
consumes:
- "multipart/form-data"
parameters:
......@@ -26,17 +27,21 @@ paths:
description: "tosca Template description"
required: true
responses:
200:
description: "successful operation"
schema:
type: "string"
405:
description: "Invalid input"
security:
- drip_auth:
- "write:ToscaTemplate"
- "read:ToscaTemplate"
/topolog_template/{id}:
/tosca_template/{id}:
get:
summary: "Find topolog template by ID"
description: "Returns a single topolog template"
operationId: "getToscaTemplateById"
operationId: "getToscaTemplateByID"
produces:
- "text/plain"
parameters:
......@@ -44,11 +49,12 @@ paths:
in: "path"
description: "ID of topolog template to return"
required: true
type: "integer"
format: "int64"
type: "string"
responses:
200:
description: "successful operation"
schema:
type: "string"
400:
description: "Invalid ID supplied"
404:
......@@ -59,14 +65,14 @@ paths:
- drip_auth:
- "write:ToscaTemplate"
- "read:ToscaTemplate"
post:
summary: "Updates exisintg topolog template in the store"
put:
summary: "Updates exisintg topolog template"
description: ""
operationId: "updateToscaTemplate"
operationId: "updateToscaTemplateByID"
consumes:
- "multipart/form-data"
produces:
- "application/json"
- "text/plain"
parameters:
- in: "formData"
name: "file"
......@@ -76,11 +82,12 @@ paths:
in: "path"
description: "ID of topolog template to return"
required: true
type: "integer"
format: "int64"
type: "string"
responses:
200:
description: "successful operation"
schema:
type: "string"
400:
description: "Invalid ID supplied"
404:
......@@ -94,20 +101,18 @@ paths:
delete:
summary: "Deletes a tosca topolog template"
description: ""
operationId: "deleteToscaTemplateByID"
parameters:
- name: "api_key"
in: "header"
required: false
type: "string"
- name: "id"
in: "path"
description: "ID of topolog template to return"
required: true
type: "integer"
format: "int64"
type: "string"
responses:
200:
description: "successful operation"
description: "successful operation"
schema:
type: "string"
400:
description: "Invalid ID supplied"
404:
......@@ -120,6 +125,7 @@ paths:
get:
summary: "plan tosca template"
description: "Returns the ID of the planed topolog template"
operationId: "planToscaTemplateByID"
produces:
- "text/plain"
parameters:
......@@ -127,11 +133,12 @@ paths:
in: "path"
description: "ID of topolog template to plan"
required: true
type: "integer"
format: "int64"
type: "string"
responses:
200:
description: "successful operation"
schema:
type: "string"
400:
description: "Invalid ID supplied"
404:
......@@ -146,6 +153,7 @@ paths:
get:
summary: "get the plan tosca template"
description: "Returns the plan topolog template"
operationId: "getPlanToscaTemplateByID"
produces:
- "text/plain"
parameters:
......@@ -153,11 +161,12 @@ paths:
in: "path"
description: "ID of topolog template plan"
required: true
type: "integer"
format: "int64"
type: "string"
responses:
200:
description: "successful operation"
schema:
type: "string"
400:
description: "Invalid ID supplied"
404:
......@@ -171,7 +180,8 @@ paths:
/provisioner/provision/{id}:
get:
summary: "provision tosca template"
description: "Returns the provision ID"
description: "provosions the operationId: Plan Tosca Template Returns the provision ID"
operationId: "provisionPlanToscaTemplateByID"
produces:
- "text/plain"
parameters:
......@@ -179,11 +189,12 @@ paths:
in: "path"
description: "ID of topolog template to plan"
required: true
type: "integer"
format: "int64"
type: "string"
responses:
200:
description: "successful operation"
schema:
type: "string"
400:
description: "Invalid ID supplied"
404:
......@@ -198,6 +209,7 @@ paths:
get:
summary: "the provisioned tosca template"
description: "Returns the provisioned tosca template"
operationId: "getProvisionToscaTemplateByID"
produces:
- "text/plain"
parameters:
......@@ -205,11 +217,12 @@ paths:
in: "path"
description: "ID of topolog template to plan"
required: true
type: "integer"
format: "int64"
type: "string"
responses:
200:
description: "successful operation"
schema:
type: "string"
400:
description: "Invalid ID supplied"
404:
......@@ -224,6 +237,7 @@ paths:
get:
summary: "deploy the software tosca template"
description: "Returns the deployment ID"
operationId: "deployProvisionToscaTemplateByID"
produces:
- "text/plain"
parameters:
......@@ -231,11 +245,12 @@ paths:
in: "path"
description: "ID of topolog template to deploy"
required: true
type: "integer"
format: "int64"
type: "string"
responses:
200:
description: "successful operation"
schema:
type: "string"
400:
description: "Invalid ID supplied"
404:
......@@ -250,6 +265,7 @@ paths:
get:
summary: "get the deployment topolog template"
description: "Returns the deployment topolog template"
operationId: "getDeployToscaTemplateByID"
produces:
- "text/plain"
parameters:
......@@ -257,11 +273,12 @@ paths:
in: "path"
description: "ID of topolog template to deploy"
required: true
type: "integer"
format: "int64"
type: "string"
responses:
200:
description: "successful operation"
schema:
type: "string"
400:
description: "Invalid ID supplied"
404:
......@@ -276,6 +293,7 @@ paths:
post:
summary: "Create credentials"
description: "Creates credentials"
operationId: "createCredentials"
produces:
- "application/json"
consumes:
......@@ -290,6 +308,8 @@ paths:
responses:
200:
description: "successful operation"
schema:
type: "string"
400:
description: "Invalid ID supplied"
404:
......@@ -298,11 +318,12 @@ paths:
description: "Invalid input"
security:
- drip_auth:
- "admin:User"
- "write:Credentials"
- "read:Credentials"
/user:
post:
summary: "Create user"
description: "This can only be done by the logged in user."
description: "This can only be done by admin."
operationId: "createUser"
produces:
- "application/json"
......@@ -314,8 +335,12 @@ paths:
schema:
$ref: "#/definitions/User"
responses:
default:
200:
description: "successful operation"
schema:
type: "string"
409:
description: "already exists"
security:
- drip_auth:
- "admin:User"
......@@ -325,7 +350,6 @@ paths:
- "user"
summary: "Logs user into the system"
description: ""
operationId: "loginUser"
produces:
- "application/json"
parameters:
......@@ -359,7 +383,6 @@ paths:
get:
summary: "Logs out current logged in user session"
description: ""
operationId: "logoutUser"
produces:
- "application/json"
parameters: []
......@@ -370,7 +393,6 @@ paths:
get:
summary: "Get user by user name"
description: ""
operationId: "getUserByName"
produces:
- "application/json"
parameters:
......@@ -396,7 +418,6 @@ paths:
- "user"
summary: "Updated user"
description: "This can only be done by the logged in user."
operationId: "updateUser"
produces:
- "application/json"
parameters:
......@@ -418,11 +439,10 @@ paths:
description: "User not found"
security:
- drip_auth:
- "admin:User"
- "admin:User"
delete:
summary: "Delete user"
description: "This can only be done by the logged in user."
operationId: "deleteUser"
produces:
- "application/json"
parameters:
......@@ -448,10 +468,8 @@ securityDefinitions:
write:ToscaTemplate: "modify topolog template in your account"
read:ToscaTemplate: "read your topolog template"
admin:User: "Grants access to admin operations"
api_key:
type: "apiKey"
name: "api_key"
in: "header"
write:Credentials: "modify cloud credentials in your account"
read:Credentials: "read your cloud credentials"
definitions:
User:
type: "object"
......@@ -489,11 +507,9 @@ definitions:
additionalProperties:
type: string
repositories:
type: "array"
items:
type: object
additionalProperties:
type: string
type: object
additionalProperties:
type: string
dsl_definitions:
type: object
additionalProperties:
......@@ -501,33 +517,33 @@ definitions:
node_types:
type: object
additionalProperties:
type: string
type: object
topology_template:
$ref: "#/definitions/TopologyTemplate"
relationship_types:
type: object
additionalProperties:
type: string
type: object
relationship_templates:
type: object
additionalProperties:
type: string
type: object
capability_types:
type: object
additionalProperties:
type: string
type: object
artifact_types:
type: object
additionalProperties:
type: string
type: object
data_types:
type: object
additionalProperties:
type: string
type: object
interface_types:
type: object
additionalProperties:
type: string
type: object
policy_types:
type: object
additionalProperties:
......@@ -535,7 +551,7 @@ definitions:
group_types:
type: object
additionalProperties:
type: string
type: object
description:
type: "string"
template_author:
......@@ -550,66 +566,68 @@ definitions:
items:
type: object
additionalProperties:
type: string
type: object
policies:
type: "array"
items:
type: object
additionalProperties:
type: string
type: object
outputs:
type: "array"
items:
type: object
additionalProperties:
type: string
type: object
node_templates:
$ref: "#/definitions/NodeTemplate"
type: object
additionalProperties:
type: object
relationship_templates:
type: object
additionalProperties:
type: string
type: object
groups:
type: object
additionalProperties:
type: string
type: object
substitution_mappings:
type: object
additionalProperties:
type: string
type: object
NodeTemplate:
type: "object"
properties:
name:
type: "string"
type:
type: "string"
type: "string"
requirements:
type: "array"
items:
type: object
additionalProperties:
type: string
type: object
artifacts:
type: object
additionalProperties:
type: string
type: object
properties:
type: object
additionalProperties:
type: string
type: object
interfaces:
type: object
additionalProperties:
type: string
type: object
capabilities:
type: object
additionalProperties:
type: string
type: object
workflows:
type: object
additionalProperties:
type: string
type: object
Credentials:
type: "object"
properties:
......
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