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 @@ ...@@ -4,10 +4,11 @@
<artifactId>drip-manager</artifactId> <artifactId>drip-manager</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>drip-manager</name> <name>drip-manager</name>
<version>1.0.0</version> <version>3.0.0</version>
<properties> <properties>
<maven.compiler.source>1.8</maven.compiler.source> <java.version>1.8</java.version>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<springfox-version>2.9.2</springfox-version> <springfox-version>2.9.2</springfox-version>
</properties> </properties>
<parent> <parent>
...@@ -53,9 +54,25 @@ ...@@ -53,9 +54,25 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.joschi.jackson</groupId> <groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-datatype-threetenbp</artifactId> <artifactId>jackson-dataformat-yaml</artifactId>
<version>2.6.4</version> </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>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<type>jar</type>
</dependency> </dependency>
<!-- Bean Validation API support --> <!-- Bean Validation API support -->
<dependency> <dependency>
...@@ -68,14 +85,15 @@ ...@@ -68,14 +85,15 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.data</groupId> <groupId>com.github.joschi.jackson</groupId>
<artifactId>spring-data-mongodb</artifactId> <artifactId>jackson-datatype-threetenbp</artifactId>
<version>2.6.4</version>
<type>jar</type> <type>jar</type>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.swagger</groupId> <groupId>nl.uva.sne.drip</groupId>
<artifactId>swagger-annotations</artifactId> <artifactId>drip-commons</artifactId>
<version>1.5.20</version> <version>1.0-SNAPSHOT</version>
<type>jar</type> <type>jar</type>
</dependency> </dependency>
</dependencies> </dependencies>
......
package nl.uva.sne.drip; 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.CommandLineRunner;
import org.springframework.boot.ExitCodeGenerator; import org.springframework.boot.ExitCodeGenerator;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
...@@ -12,7 +12,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; ...@@ -12,7 +12,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication @SpringBootApplication
@EnableSwagger2 @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"}) @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 { public class Swagger2SpringBoot implements CommandLineRunner {
...@@ -28,7 +28,6 @@ public class Swagger2SpringBoot implements CommandLineRunner { ...@@ -28,7 +28,6 @@ public class Swagger2SpringBoot implements CommandLineRunner {
} }
class ExitException extends RuntimeException implements ExitCodeGenerator { class ExitException extends RuntimeException implements ExitCodeGenerator {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Override @Override
......
package nl.uva.sne.drip.api; 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{ public class ApiException extends Exception{
private int code; private int code;
......
...@@ -5,7 +5,7 @@ import java.io.IOException; ...@@ -5,7 +5,7 @@ import java.io.IOException;
import javax.servlet.*; import javax.servlet.*;
import javax.servlet.http.HttpServletResponse; 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 { public class ApiOriginFilter implements javax.servlet.Filter {
@Override @Override
......
...@@ -2,7 +2,7 @@ package nl.uva.sne.drip.api; ...@@ -2,7 +2,7 @@ package nl.uva.sne.drip.api;
import javax.xml.bind.annotation.XmlTransient; 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 @javax.xml.bind.annotation.XmlRootElement
public class ApiResponseMessage { 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; 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 { public class NotFoundException extends ApiException {
private int code; 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; ...@@ -2,59 +2,66 @@ package nl.uva.sne.drip.api;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import nl.uva.sne.drip.service.TopologTemplateService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable; 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.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.*;
import javax.validation.Valid; import javax.validation.Valid;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired; 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 @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 ObjectMapper objectMapper;
private final HttpServletRequest request; private final HttpServletRequest request;
@Autowired
private TopologTemplateService topologTemplateService;
@org.springframework.beans.factory.annotation.Autowired @org.springframework.beans.factory.annotation.Autowired
public TopologTemplateApiController(ObjectMapper objectMapper, HttpServletRequest request) { public PlannerApiController(ObjectMapper objectMapper, HttpServletRequest request) {
this.objectMapper = objectMapper; this.objectMapper = objectMapper;
this.request = request; 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"); 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) { return new ResponseEntity<String>(HttpStatus.NOT_IMPLEMENTED);
String accept = request.getHeader("Accept");
return new ResponseEntity<Void>(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"); 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) { return new ResponseEntity<String>(HttpStatus.NOT_IMPLEMENTED);
String accept = request.getHeader("Accept");
return new ResponseEntity<Void>(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; ...@@ -21,72 +21,73 @@ import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import java.util.List; 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") @Api(value = "tosca_template", description = "the tosca_template API")
public interface TopologTemplateApi { 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 = { @Authorization(value = "drip_auth", scopes = {
@AuthorizationScope(scope = "write:TopologTemplate", description = "modify topolog template in your account"), @AuthorizationScope(scope = "read:ToscaTemplate", description = "read your topolog template"),
@AuthorizationScope(scope = "read:TopologTemplate", description = "read your topolog template") @AuthorizationScope(scope = "write:ToscaTemplate", description = "modify topolog template in your account")
}) })
}, tags={ }) }, tags={ })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 405, message = "Invalid input") }) @ApiResponse(code = 200, message = "successful operation", response = String.class),
@RequestMapping(value = "/topolog_template", @ApiResponse(code = 400, message = "Invalid ID supplied"),
consumes = { "multipart/form-data" }, @ApiResponse(code = 404, message = "ToscaTemplate not found") })
method = RequestMethod.POST) @RequestMapping(value = "/tosca_template/{id}",
ResponseEntity<Void> addTopologTemplate(@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file); 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 = { @Authorization(value = "drip_auth", scopes = {
@AuthorizationScope(scope = "write:TopologTemplate", description = "modify topolog template in your account"), @AuthorizationScope(scope = "read:ToscaTemplate", description = "read your topolog template"),
@AuthorizationScope(scope = "read:TopologTemplate", description = "read your topolog template") @AuthorizationScope(scope = "write:ToscaTemplate", description = "modify topolog template in your account")
}) })
}, tags={ }) }, tags={ })
@ApiResponses(value = { @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 = 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") }) @ApiResponse(code = 405, message = "Invalid input") })
@RequestMapping(value = "/topolog_template/{TopologTemplateId}", @RequestMapping(value = "/tosca_template/{id}",
produces = { "text/plain" }, produces = { "text/plain" },
method = RequestMethod.GET) 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 = { @Authorization(value = "drip_auth", scopes = {
@AuthorizationScope(scope = "write:TopologTemplate", description = "modify topolog template in your account"), @AuthorizationScope(scope = "read:ToscaTemplate", description = "read your topolog template"),
@AuthorizationScope(scope = "read:TopologTemplate", description = "read your topolog template") @AuthorizationScope(scope = "write:ToscaTemplate", description = "modify topolog template in your account")
}) })
}, tags={ }) }, tags={ })
@ApiResponses(value = { @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 = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "TopologTemplate not found") }) @ApiResponse(code = 404, message = "ToscaTemplate not found"),
@RequestMapping(value = "/topolog_template/{TopologTemplateId}", @ApiResponse(code = 405, message = "Invalid input") })
method = RequestMethod.DELETE) @RequestMapping(value = "/tosca_template/{id}",
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); 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 = { @Authorization(value = "drip_auth", scopes = {
@AuthorizationScope(scope = "write:TopologTemplate", description = "modify topolog template in your account"), @AuthorizationScope(scope = "read:ToscaTemplate", description = "read your topolog template"),
@AuthorizationScope(scope = "read:TopologTemplate", description = "read your topolog template") @AuthorizationScope(scope = "write:ToscaTemplate", description = "modify topolog template in your account")
}) })
}, tags={ }) }, tags={ })
@ApiResponses(value = { @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 = 405, message = "Invalid input") }) @ApiResponse(code = 405, message = "Invalid input") })
@RequestMapping(value = "/topolog_template/{TopologTemplateId}", @RequestMapping(value = "/tosca_template",
produces = { "application/json" },
consumes = { "multipart/form-data" }, consumes = { "multipart/form-data" },
method = RequestMethod.POST) 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; ...@@ -21,39 +21,59 @@ import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import java.util.List; 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") @Api(value = "user", description = "the user API")
public interface UserApi { 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 = { @Authorization(value = "drip_auth", scopes = {
@AuthorizationScope(scope = "admin:User", description = "Grants access to admin operations") @AuthorizationScope(scope = "admin:User", description = "Grants access to admin operations")
}) })
}, tags={ }) }, tags={ })
@ApiResponses(value = { @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", @RequestMapping(value = "/user",
produces = { "application/json" }, produces = { "application/json" },
method = RequestMethod.POST) 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 = { @Authorization(value = "drip_auth", scopes = {
@AuthorizationScope(scope = "admin:User", description = "Grants access to admin operations") @AuthorizationScope(scope = "admin:User", description = "Grants access to admin operations")
}) })
}, tags={ "user", }) }, tags={ })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid username supplied"), @ApiResponse(code = 400, message = "Invalid username supplied"),
@ApiResponse(code = 404, message = "User not found") }) @ApiResponse(code = 404, message = "User not found") })
@RequestMapping(value = "/user/{username}", @RequestMapping(value = "/user/{username}",
produces = { "application/json" }, produces = { "application/json" },
method = RequestMethod.DELETE) 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 = { @Authorization(value = "drip_auth", scopes = {
@AuthorizationScope(scope = "admin:User", description = "Grants access to admin operations") @AuthorizationScope(scope = "admin:User", description = "Grants access to admin operations")
}) })
...@@ -65,29 +85,10 @@ public interface UserApi { ...@@ -65,29 +85,10 @@ public interface UserApi {
@RequestMapping(value = "/user/{username}", @RequestMapping(value = "/user/{username}",
produces = { "application/json" }, produces = { "application/json" },
method = RequestMethod.GET) 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); ResponseEntity<User> userUsernameGet(@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();
@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 = { @Authorization(value = "drip_auth", scopes = {
@AuthorizationScope(scope = "admin:User", description = "Grants access to admin operations") @AuthorizationScope(scope = "admin:User", description = "Grants access to admin operations")
}) })
...@@ -98,6 +99,6 @@ public interface UserApi { ...@@ -98,6 +99,6 @@ public interface UserApi {
@RequestMapping(value = "/user/{username}", @RequestMapping(value = "/user/{username}",
produces = { "application/json" }, produces = { "application/json" },
method = RequestMethod.PUT) 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; ...@@ -20,7 +20,7 @@ import javax.validation.Valid;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.IOException; import java.io.IOException;
import java.util.List; 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 @Controller
public class UserApiController implements UserApi { public class UserApiController implements UserApi {
...@@ -37,31 +37,21 @@ public class UserApiController implements UserApi { ...@@ -37,31 +37,21 @@ public class UserApiController implements UserApi {
this.request = request; this.request = request;
} }
public ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) { public ResponseEntity<String> 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) {
String accept = request.getHeader("Accept"); String accept = request.getHeader("Accept");
if (accept != null && accept.contains("application/json")) { if (accept != null && accept.contains("application/json")) {
try { 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) { } catch (IOException e) {
log.error("Couldn't serialize response for content type application/json", 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"); String accept = request.getHeader("Accept");
if (accept != null && accept.contains("application/json")) { if (accept != null && accept.contains("application/json")) {
try { try {
...@@ -75,12 +65,31 @@ public class UserApiController implements UserApi { ...@@ -75,12 +65,31 @@ public class UserApiController implements UserApi {
return new ResponseEntity<String>(HttpStatus.NOT_IMPLEMENTED); return new ResponseEntity<String>(HttpStatus.NOT_IMPLEMENTED);
} }
public ResponseEntity<Void> logoutUser() { public ResponseEntity<Void> userLogoutGet() {
String accept = request.getHeader("Accept"); String accept = request.getHeader("Accept");
return new ResponseEntity<Void>(HttpStatus.NOT_IMPLEMENTED); 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"); String accept = request.getHeader("Accept");
return new ResponseEntity<Void>(HttpStatus.NOT_IMPLEMENTED); return new ResponseEntity<Void>(HttpStatus.NOT_IMPLEMENTED);
} }
......
...@@ -27,6 +27,7 @@ import java.math.BigDecimal; ...@@ -27,6 +27,7 @@ import java.math.BigDecimal;
* Adapted from the jackson threetenbp InstantDeserializer to add support for deserializing rfc822 format. * Adapted from the jackson threetenbp InstantDeserializer to add support for deserializing rfc822 format.
* *
* @author Nick Williams * @author Nick Williams
* @param <T>
*/ */
public class CustomInstantDeserializer<T extends Temporal> public class CustomInstantDeserializer<T extends Temporal>
extends ThreeTenDateTimeDeserializerBase<T> { extends ThreeTenDateTimeDeserializerBase<T> {
......
...@@ -32,9 +32,9 @@ import org.springframework.data.mongodb.repository.config.EnableMongoRepositorie ...@@ -32,9 +32,9 @@ import org.springframework.data.mongodb.repository.config.EnableMongoRepositorie
@Configuration @Configuration
@EnableMongoRepositories(basePackages = "nl.uva.sne.drip.api") @EnableMongoRepositories(basePackages = "nl.uva.sne.drip.api")
@PropertySources({ @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"}) @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 { public class MongoConfig extends AbstractMongoConfiguration {
......
...@@ -10,8 +10,6 @@ import springfox.documentation.service.Contact; ...@@ -10,8 +10,6 @@ import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType; import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket; 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 @Configuration
public class SwaggerDocumentationConfig { public class SwaggerDocumentationConfig {
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
*/ */
package nl.uva.sne.drip.dao; package nl.uva.sne.drip.dao;
import nl.uva.sne.drip.model.ToscaTemplate;
import nl.uva.sne.drip.model.User; import nl.uva.sne.drip.model.User;
import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -14,6 +15,6 @@ import org.springframework.stereotype.Repository; ...@@ -14,6 +15,6 @@ import org.springframework.stereotype.Repository;
* @author S. Koulouzis * @author S. Koulouzis
*/ */
@Repository @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.*; ...@@ -17,7 +17,7 @@ import javax.validation.constraints.*;
* NodeTemplate * NodeTemplate
*/ */
@Validated @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 { public class NodeTemplate {
@JsonProperty("name") @JsonProperty("name")
...@@ -28,27 +28,27 @@ public class NodeTemplate { ...@@ -28,27 +28,27 @@ public class NodeTemplate {
@JsonProperty("requirements") @JsonProperty("requirements")
@Valid @Valid
private List<Map<String, String>> requirements = null; private List<Map<String, Object>> requirements = null;
@JsonProperty("artifacts") @JsonProperty("artifacts")
@Valid @Valid
private Map<String, String> artifacts = null; private Map<String, Object> artifacts = null;
@JsonProperty("properties") @JsonProperty("properties")
@Valid @Valid
private Map<String, String> properties = null; private Map<String, Object> properties = null;
@JsonProperty("interfaces") @JsonProperty("interfaces")
@Valid @Valid
private Map<String, String> interfaces = null; private Map<String, Object> interfaces = null;
@JsonProperty("capabilities") @JsonProperty("capabilities")
@Valid @Valid
private Map<String, String> capabilities = null; private Map<String, Object> capabilities = null;
@JsonProperty("workflows") @JsonProperty("workflows")
@Valid @Valid
private Map<String, String> workflows = null; private Map<String, Object> workflows = null;
public NodeTemplate name(String name) { public NodeTemplate name(String name) {
this.name = name; this.name = name;
...@@ -90,14 +90,14 @@ public class NodeTemplate { ...@@ -90,14 +90,14 @@ public class NodeTemplate {
this.type = type; this.type = type;
} }
public NodeTemplate requirements(List<Map<String, String>> requirements) { public NodeTemplate requirements(List<Map<String, Object>> requirements) {
this.requirements = requirements; this.requirements = requirements;
return this; return this;
} }
public NodeTemplate addRequirementsItem(Map<String, String> requirementsItem) { public NodeTemplate addRequirementsItem(Map<String, Object> requirementsItem) {
if (this.requirements == null) { if (this.requirements == null) {
this.requirements = new ArrayList<Map<String, String>>(); this.requirements = new ArrayList<Map<String, Object>>();
} }
this.requirements.add(requirementsItem); this.requirements.add(requirementsItem);
return this; return this;
...@@ -111,22 +111,22 @@ public class NodeTemplate { ...@@ -111,22 +111,22 @@ public class NodeTemplate {
@Valid @Valid
public List<Map<String, String>> getRequirements() { public List<Map<String, Object>> getRequirements() {
return requirements; return requirements;
} }
public void setRequirements(List<Map<String, String>> requirements) { public void setRequirements(List<Map<String, Object>> requirements) {
this.requirements = requirements; this.requirements = requirements;
} }
public NodeTemplate artifacts(Map<String, String> artifacts) { public NodeTemplate artifacts(Map<String, Object> artifacts) {
this.artifacts = artifacts; this.artifacts = artifacts;
return this; return this;
} }
public NodeTemplate putArtifactsItem(String key, String artifactsItem) { public NodeTemplate putArtifactsItem(String key, Object artifactsItem) {
if (this.artifacts == null) { if (this.artifacts == null) {
this.artifacts = new HashMap<String, String>(); this.artifacts = new HashMap<String, Object>();
} }
this.artifacts.put(key, artifactsItem); this.artifacts.put(key, artifactsItem);
return this; return this;
...@@ -139,22 +139,22 @@ public class NodeTemplate { ...@@ -139,22 +139,22 @@ public class NodeTemplate {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Map<String, String> getArtifacts() { public Map<String, Object> getArtifacts() {
return artifacts; return artifacts;
} }
public void setArtifacts(Map<String, String> artifacts) { public void setArtifacts(Map<String, Object> artifacts) {
this.artifacts = artifacts; this.artifacts = artifacts;
} }
public NodeTemplate properties(Map<String, String> properties) { public NodeTemplate properties(Map<String, Object> properties) {
this.properties = properties; this.properties = properties;
return this; return this;
} }
public NodeTemplate putPropertiesItem(String key, String propertiesItem) { public NodeTemplate putPropertiesItem(String key, Object propertiesItem) {
if (this.properties == null) { if (this.properties == null) {
this.properties = new HashMap<String, String>(); this.properties = new HashMap<String, Object>();
} }
this.properties.put(key, propertiesItem); this.properties.put(key, propertiesItem);
return this; return this;
...@@ -167,22 +167,22 @@ public class NodeTemplate { ...@@ -167,22 +167,22 @@ public class NodeTemplate {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Map<String, String> getProperties() { public Map<String, Object> getProperties() {
return properties; return properties;
} }
public void setProperties(Map<String, String> properties) { public void setProperties(Map<String, Object> properties) {
this.properties = properties; this.properties = properties;
} }
public NodeTemplate interfaces(Map<String, String> interfaces) { public NodeTemplate interfaces(Map<String, Object> interfaces) {
this.interfaces = interfaces; this.interfaces = interfaces;
return this; return this;
} }
public NodeTemplate putInterfacesItem(String key, String interfacesItem) { public NodeTemplate putInterfacesItem(String key, Object interfacesItem) {
if (this.interfaces == null) { if (this.interfaces == null) {
this.interfaces = new HashMap<String, String>(); this.interfaces = new HashMap<String, Object>();
} }
this.interfaces.put(key, interfacesItem); this.interfaces.put(key, interfacesItem);
return this; return this;
...@@ -195,22 +195,22 @@ public class NodeTemplate { ...@@ -195,22 +195,22 @@ public class NodeTemplate {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Map<String, String> getInterfaces() { public Map<String, Object> getInterfaces() {
return interfaces; return interfaces;
} }
public void setInterfaces(Map<String, String> interfaces) { public void setInterfaces(Map<String, Object> interfaces) {
this.interfaces = interfaces; this.interfaces = interfaces;
} }
public NodeTemplate capabilities(Map<String, String> capabilities) { public NodeTemplate capabilities(Map<String, Object> capabilities) {
this.capabilities = capabilities; this.capabilities = capabilities;
return this; return this;
} }
public NodeTemplate putCapabilitiesItem(String key, String capabilitiesItem) { public NodeTemplate putCapabilitiesItem(String key, Object capabilitiesItem) {
if (this.capabilities == null) { if (this.capabilities == null) {
this.capabilities = new HashMap<String, String>(); this.capabilities = new HashMap<String, Object>();
} }
this.capabilities.put(key, capabilitiesItem); this.capabilities.put(key, capabilitiesItem);
return this; return this;
...@@ -223,22 +223,22 @@ public class NodeTemplate { ...@@ -223,22 +223,22 @@ public class NodeTemplate {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Map<String, String> getCapabilities() { public Map<String, Object> getCapabilities() {
return capabilities; return capabilities;
} }
public void setCapabilities(Map<String, String> capabilities) { public void setCapabilities(Map<String, Object> capabilities) {
this.capabilities = capabilities; this.capabilities = capabilities;
} }
public NodeTemplate workflows(Map<String, String> workflows) { public NodeTemplate workflows(Map<String, Object> workflows) {
this.workflows = workflows; this.workflows = workflows;
return this; return this;
} }
public NodeTemplate putWorkflowsItem(String key, String workflowsItem) { public NodeTemplate putWorkflowsItem(String key, Object workflowsItem) {
if (this.workflows == null) { if (this.workflows == null) {
this.workflows = new HashMap<String, String>(); this.workflows = new HashMap<String, Object>();
} }
this.workflows.put(key, workflowsItem); this.workflows.put(key, workflowsItem);
return this; return this;
...@@ -251,11 +251,11 @@ public class NodeTemplate { ...@@ -251,11 +251,11 @@ public class NodeTemplate {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Map<String, String> getWorkflows() { public Map<String, Object> getWorkflows() {
return workflows; return workflows;
} }
public void setWorkflows(Map<String, String> workflows) { public void setWorkflows(Map<String, Object> workflows) {
this.workflows = workflows; this.workflows = workflows;
} }
......
...@@ -17,7 +17,7 @@ import javax.validation.constraints.*; ...@@ -17,7 +17,7 @@ import javax.validation.constraints.*;
* TopologyTemplate * TopologyTemplate
*/ */
@Validated @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 { public class TopologyTemplate {
@JsonProperty("description") @JsonProperty("description")
...@@ -25,30 +25,31 @@ public class TopologyTemplate { ...@@ -25,30 +25,31 @@ public class TopologyTemplate {
@JsonProperty("inputs") @JsonProperty("inputs")
@Valid @Valid
private List<Map<String, String>> inputs = null; private List<Map<String, Object>> inputs = null;
@JsonProperty("policies") @JsonProperty("policies")
@Valid @Valid
private List<Map<String, String>> policies = null; private List<Map<String, Object>> policies = null;
@JsonProperty("outputs") @JsonProperty("outputs")
@Valid @Valid
private List<Map<String, String>> outputs = null; private List<Map<String, Object>> outputs = null;
@JsonProperty("node_templates") @JsonProperty("node_templates")
private NodeTemplate nodeTemplates = null; @Valid
private Map<String, Object> nodeTemplates = null;
@JsonProperty("relationship_templates") @JsonProperty("relationship_templates")
@Valid @Valid
private Map<String, String> relationshipTemplates = null; private Map<String, Object> relationshipTemplates = null;
@JsonProperty("groups") @JsonProperty("groups")
@Valid @Valid
private Map<String, String> groups = null; private Map<String, Object> groups = null;
@JsonProperty("substitution_mappings") @JsonProperty("substitution_mappings")
@Valid @Valid
private Map<String, String> substitutionMappings = null; private Map<String, Object> substitutionMappings = null;
public TopologyTemplate description(String description) { public TopologyTemplate description(String description) {
this.description = description; this.description = description;
...@@ -70,14 +71,14 @@ public class TopologyTemplate { ...@@ -70,14 +71,14 @@ public class TopologyTemplate {
this.description = description; this.description = description;
} }
public TopologyTemplate inputs(List<Map<String, String>> inputs) { public TopologyTemplate inputs(List<Map<String, Object>> inputs) {
this.inputs = inputs; this.inputs = inputs;
return this; return this;
} }
public TopologyTemplate addInputsItem(Map<String, String> inputsItem) { public TopologyTemplate addInputsItem(Map<String, Object> inputsItem) {
if (this.inputs == null) { if (this.inputs == null) {
this.inputs = new ArrayList<Map<String, String>>(); this.inputs = new ArrayList<Map<String, Object>>();
} }
this.inputs.add(inputsItem); this.inputs.add(inputsItem);
return this; return this;
...@@ -91,22 +92,22 @@ public class TopologyTemplate { ...@@ -91,22 +92,22 @@ public class TopologyTemplate {
@Valid @Valid
public List<Map<String, String>> getInputs() { public List<Map<String, Object>> getInputs() {
return inputs; return inputs;
} }
public void setInputs(List<Map<String, String>> inputs) { public void setInputs(List<Map<String, Object>> inputs) {
this.inputs = inputs; this.inputs = inputs;
} }
public TopologyTemplate policies(List<Map<String, String>> policies) { public TopologyTemplate policies(List<Map<String, Object>> policies) {
this.policies = policies; this.policies = policies;
return this; return this;
} }
public TopologyTemplate addPoliciesItem(Map<String, String> policiesItem) { public TopologyTemplate addPoliciesItem(Map<String, Object> policiesItem) {
if (this.policies == null) { if (this.policies == null) {
this.policies = new ArrayList<Map<String, String>>(); this.policies = new ArrayList<Map<String, Object>>();
} }
this.policies.add(policiesItem); this.policies.add(policiesItem);
return this; return this;
...@@ -120,22 +121,22 @@ public class TopologyTemplate { ...@@ -120,22 +121,22 @@ public class TopologyTemplate {
@Valid @Valid
public List<Map<String, String>> getPolicies() { public List<Map<String, Object>> getPolicies() {
return policies; return policies;
} }
public void setPolicies(List<Map<String, String>> policies) { public void setPolicies(List<Map<String, Object>> policies) {
this.policies = policies; this.policies = policies;
} }
public TopologyTemplate outputs(List<Map<String, String>> outputs) { public TopologyTemplate outputs(List<Map<String, Object>> outputs) {
this.outputs = outputs; this.outputs = outputs;
return this; return this;
} }
public TopologyTemplate addOutputsItem(Map<String, String> outputsItem) { public TopologyTemplate addOutputsItem(Map<String, Object> outputsItem) {
if (this.outputs == null) { if (this.outputs == null) {
this.outputs = new ArrayList<Map<String, String>>(); this.outputs = new ArrayList<Map<String, Object>>();
} }
this.outputs.add(outputsItem); this.outputs.add(outputsItem);
return this; return this;
...@@ -149,43 +150,50 @@ public class TopologyTemplate { ...@@ -149,43 +150,50 @@ public class TopologyTemplate {
@Valid @Valid
public List<Map<String, String>> getOutputs() { public List<Map<String, Object>> getOutputs() {
return outputs; return outputs;
} }
public void setOutputs(List<Map<String, String>> outputs) { public void setOutputs(List<Map<String, Object>> outputs) {
this.outputs = outputs; this.outputs = outputs;
} }
public TopologyTemplate nodeTemplates(NodeTemplate nodeTemplates) { public TopologyTemplate nodeTemplates(Map<String, Object> nodeTemplates) {
this.nodeTemplates = nodeTemplates; this.nodeTemplates = nodeTemplates;
return this; 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 * Get nodeTemplates
* @return nodeTemplates * @return nodeTemplates
**/ **/
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
@Valid
public NodeTemplate getNodeTemplates() { public Map<String, Object> getNodeTemplates() {
return nodeTemplates; return nodeTemplates;
} }
public void setNodeTemplates(NodeTemplate nodeTemplates) { public void setNodeTemplates(Map<String, Object> nodeTemplates) {
this.nodeTemplates = nodeTemplates; this.nodeTemplates = nodeTemplates;
} }
public TopologyTemplate relationshipTemplates(Map<String, String> relationshipTemplates) { public TopologyTemplate relationshipTemplates(Map<String, Object> relationshipTemplates) {
this.relationshipTemplates = relationshipTemplates; this.relationshipTemplates = relationshipTemplates;
return this; return this;
} }
public TopologyTemplate putRelationshipTemplatesItem(String key, String relationshipTemplatesItem) { public TopologyTemplate putRelationshipTemplatesItem(String key, Object relationshipTemplatesItem) {
if (this.relationshipTemplates == null) { if (this.relationshipTemplates == null) {
this.relationshipTemplates = new HashMap<String, String>(); this.relationshipTemplates = new HashMap<String, Object>();
} }
this.relationshipTemplates.put(key, relationshipTemplatesItem); this.relationshipTemplates.put(key, relationshipTemplatesItem);
return this; return this;
...@@ -198,22 +206,22 @@ public class TopologyTemplate { ...@@ -198,22 +206,22 @@ public class TopologyTemplate {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Map<String, String> getRelationshipTemplates() { public Map<String, Object> getRelationshipTemplates() {
return relationshipTemplates; return relationshipTemplates;
} }
public void setRelationshipTemplates(Map<String, String> relationshipTemplates) { public void setRelationshipTemplates(Map<String, Object> relationshipTemplates) {
this.relationshipTemplates = relationshipTemplates; this.relationshipTemplates = relationshipTemplates;
} }
public TopologyTemplate groups(Map<String, String> groups) { public TopologyTemplate groups(Map<String, Object> groups) {
this.groups = groups; this.groups = groups;
return this; return this;
} }
public TopologyTemplate putGroupsItem(String key, String groupsItem) { public TopologyTemplate putGroupsItem(String key, Object groupsItem) {
if (this.groups == null) { if (this.groups == null) {
this.groups = new HashMap<String, String>(); this.groups = new HashMap<String, Object>();
} }
this.groups.put(key, groupsItem); this.groups.put(key, groupsItem);
return this; return this;
...@@ -226,22 +234,22 @@ public class TopologyTemplate { ...@@ -226,22 +234,22 @@ public class TopologyTemplate {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Map<String, String> getGroups() { public Map<String, Object> getGroups() {
return groups; return groups;
} }
public void setGroups(Map<String, String> groups) { public void setGroups(Map<String, Object> groups) {
this.groups = groups; this.groups = groups;
} }
public TopologyTemplate substitutionMappings(Map<String, String> substitutionMappings) { public TopologyTemplate substitutionMappings(Map<String, Object> substitutionMappings) {
this.substitutionMappings = substitutionMappings; this.substitutionMappings = substitutionMappings;
return this; return this;
} }
public TopologyTemplate putSubstitutionMappingsItem(String key, String substitutionMappingsItem) { public TopologyTemplate putSubstitutionMappingsItem(String key, Object substitutionMappingsItem) {
if (this.substitutionMappings == null) { if (this.substitutionMappings == null) {
this.substitutionMappings = new HashMap<String, String>(); this.substitutionMappings = new HashMap<String, Object>();
} }
this.substitutionMappings.put(key, substitutionMappingsItem); this.substitutionMappings.put(key, substitutionMappingsItem);
return this; return this;
...@@ -254,11 +262,11 @@ public class TopologyTemplate { ...@@ -254,11 +262,11 @@ public class TopologyTemplate {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Map<String, String> getSubstitutionMappings() { public Map<String, Object> getSubstitutionMappings() {
return substitutionMappings; return substitutionMappings;
} }
public void setSubstitutionMappings(Map<String, String> substitutionMappings) { public void setSubstitutionMappings(Map<String, Object> substitutionMappings) {
this.substitutionMappings = substitutionMappings; this.substitutionMappings = substitutionMappings;
} }
......
...@@ -3,6 +3,8 @@ package nl.uva.sne.drip.model; ...@@ -3,6 +3,8 @@ package nl.uva.sne.drip.model;
import java.util.Objects; import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; 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.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -12,14 +14,19 @@ import java.util.Map; ...@@ -12,14 +14,19 @@ import java.util.Map;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import org.springframework.data.annotation.Id;
/** /**
* ToscaTemplate * ToscaTemplate
*/ */
@Validated @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 {
@Id
@JsonIgnore
private String id;
@JsonProperty("tosca_definitions_version") @JsonProperty("tosca_definitions_version")
private String toscaDefinitionsVersion = null; private String toscaDefinitionsVersion = null;
...@@ -35,7 +42,7 @@ public class ToscaTemplate { ...@@ -35,7 +42,7 @@ public class ToscaTemplate {
@JsonProperty("repositories") @JsonProperty("repositories")
@Valid @Valid
private List<Map<String, String>> repositories = null; private Map<String, String> repositories = null;
@JsonProperty("dsl_definitions") @JsonProperty("dsl_definitions")
@Valid @Valid
...@@ -43,34 +50,34 @@ public class ToscaTemplate { ...@@ -43,34 +50,34 @@ public class ToscaTemplate {
@JsonProperty("node_types") @JsonProperty("node_types")
@Valid @Valid
private Map<String, String> nodeTypes = null; private Map<String, Object> nodeTypes = null;
@JsonProperty("topology_template") @JsonProperty("topology_template")
private TopologyTemplate topologyTemplate = null; private TopologyTemplate topologyTemplate = null;
@JsonProperty("relationship_types") @JsonProperty("relationship_types")
@Valid @Valid
private Map<String, String> relationshipTypes = null; private Map<String, Object> relationshipTypes = null;
@JsonProperty("relationship_templates") @JsonProperty("relationship_templates")
@Valid @Valid
private Map<String, String> relationshipTemplates = null; private Map<String, Object> relationshipTemplates = null;
@JsonProperty("capability_types") @JsonProperty("capability_types")
@Valid @Valid
private Map<String, String> capabilityTypes = null; private Map<String, Object> capabilityTypes = null;
@JsonProperty("artifact_types") @JsonProperty("artifact_types")
@Valid @Valid
private Map<String, String> artifactTypes = null; private Map<String, Object> artifactTypes = null;
@JsonProperty("data_types") @JsonProperty("data_types")
@Valid @Valid
private Map<String, String> dataTypes = null; private Map<String, Object> dataTypes = null;
@JsonProperty("interface_types") @JsonProperty("interface_types")
@Valid @Valid
private Map<String, String> interfaceTypes = null; private Map<String, Object> interfaceTypes = null;
@JsonProperty("policy_types") @JsonProperty("policy_types")
@Valid @Valid
...@@ -78,7 +85,7 @@ public class ToscaTemplate { ...@@ -78,7 +85,7 @@ public class ToscaTemplate {
@JsonProperty("group_types") @JsonProperty("group_types")
@Valid @Valid
private Map<String, String> groupTypes = null; private Map<String, Object> groupTypes = null;
@JsonProperty("description") @JsonProperty("description")
private String description = null; private String description = null;
...@@ -91,13 +98,23 @@ public class ToscaTemplate { ...@@ -91,13 +98,23 @@ public class ToscaTemplate {
return this; return this;
} }
@JsonIgnore
public String getId() {
return id;
}
public void setID(String id) {
this.id = id;
}
/** /**
* Get toscaDefinitionsVersion * Get toscaDefinitionsVersion
*
* @return toscaDefinitionsVersion * @return toscaDefinitionsVersion
**/ *
*/
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public String getToscaDefinitionsVersion() { public String getToscaDefinitionsVersion() {
return toscaDefinitionsVersion; return toscaDefinitionsVersion;
} }
...@@ -113,11 +130,12 @@ public class ToscaTemplate { ...@@ -113,11 +130,12 @@ public class ToscaTemplate {
/** /**
* Get toscaDefaultNamespace * Get toscaDefaultNamespace
*
* @return toscaDefaultNamespace * @return toscaDefaultNamespace
**/ *
*/
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public String getToscaDefaultNamespace() { public String getToscaDefaultNamespace() {
return toscaDefaultNamespace; return toscaDefaultNamespace;
} }
...@@ -133,11 +151,12 @@ public class ToscaTemplate { ...@@ -133,11 +151,12 @@ public class ToscaTemplate {
/** /**
* Get templateName * Get templateName
*
* @return templateName * @return templateName
**/ *
*/
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public String getTemplateName() { public String getTemplateName() {
return templateName; return templateName;
} }
...@@ -161,8 +180,10 @@ public class ToscaTemplate { ...@@ -161,8 +180,10 @@ public class ToscaTemplate {
/** /**
* Get imports * Get imports
*
* @return imports * @return imports
**/ *
*/
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
@Valid @Valid
...@@ -175,32 +196,32 @@ public class ToscaTemplate { ...@@ -175,32 +196,32 @@ public class ToscaTemplate {
this.imports = imports; this.imports = imports;
} }
public ToscaTemplate repositories(List<Map<String, String>> repositories) { public ToscaTemplate repositories(Map<String, String> repositories) {
this.repositories = repositories; this.repositories = repositories;
return this; return this;
} }
public ToscaTemplate addRepositoriesItem(Map<String, String> repositoriesItem) { public ToscaTemplate putRepositoriesItem(String key, String repositoriesItem) {
if (this.repositories == null) { if (this.repositories == null) {
this.repositories = new ArrayList<Map<String, String>>(); this.repositories = new HashMap<String, String>();
} }
this.repositories.add(repositoriesItem); this.repositories.put(key, repositoriesItem);
return this; return this;
} }
/** /**
* Get repositories * Get repositories
*
* @return repositories * @return repositories
**/ *
*/
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
@Valid public Map<String, String> getRepositories() {
public List<Map<String, String>> getRepositories() {
return repositories; return repositories;
} }
public void setRepositories(List<Map<String, String>> repositories) { public void setRepositories(Map<String, String> repositories) {
this.repositories = repositories; this.repositories = repositories;
} }
...@@ -219,11 +240,12 @@ public class ToscaTemplate { ...@@ -219,11 +240,12 @@ public class ToscaTemplate {
/** /**
* Get dslDefinitions * Get dslDefinitions
*
* @return dslDefinitions * @return dslDefinitions
**/ *
*/
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Map<String, String> getDslDefinitions() { public Map<String, String> getDslDefinitions() {
return dslDefinitions; return dslDefinitions;
} }
...@@ -232,14 +254,14 @@ public class ToscaTemplate { ...@@ -232,14 +254,14 @@ public class ToscaTemplate {
this.dslDefinitions = dslDefinitions; this.dslDefinitions = dslDefinitions;
} }
public ToscaTemplate nodeTypes(Map<String, String> nodeTypes) { public ToscaTemplate nodeTypes(Map<String, Object> nodeTypes) {
this.nodeTypes = nodeTypes; this.nodeTypes = nodeTypes;
return this; return this;
} }
public ToscaTemplate putNodeTypesItem(String key, String nodeTypesItem) { public ToscaTemplate putNodeTypesItem(String key, Object nodeTypesItem) {
if (this.nodeTypes == null) { if (this.nodeTypes == null) {
this.nodeTypes = new HashMap<String, String>(); this.nodeTypes = new HashMap<String, Object>();
} }
this.nodeTypes.put(key, nodeTypesItem); this.nodeTypes.put(key, nodeTypesItem);
return this; return this;
...@@ -247,16 +269,17 @@ public class ToscaTemplate { ...@@ -247,16 +269,17 @@ public class ToscaTemplate {
/** /**
* Get nodeTypes * Get nodeTypes
*
* @return nodeTypes * @return nodeTypes
**/ *
*/
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Map<String, Object> getNodeTypes() {
public Map<String, String> getNodeTypes() {
return nodeTypes; return nodeTypes;
} }
public void setNodeTypes(Map<String, String> nodeTypes) { public void setNodeTypes(Map<String, Object> nodeTypes) {
this.nodeTypes = nodeTypes; this.nodeTypes = nodeTypes;
} }
...@@ -267,8 +290,10 @@ public class ToscaTemplate { ...@@ -267,8 +290,10 @@ public class ToscaTemplate {
/** /**
* Get topologyTemplate * Get topologyTemplate
*
* @return topologyTemplate * @return topologyTemplate
**/ *
*/
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
@Valid @Valid
...@@ -281,14 +306,14 @@ public class ToscaTemplate { ...@@ -281,14 +306,14 @@ public class ToscaTemplate {
this.topologyTemplate = topologyTemplate; this.topologyTemplate = topologyTemplate;
} }
public ToscaTemplate relationshipTypes(Map<String, String> relationshipTypes) { public ToscaTemplate relationshipTypes(Map<String, Object> relationshipTypes) {
this.relationshipTypes = relationshipTypes; this.relationshipTypes = relationshipTypes;
return this; return this;
} }
public ToscaTemplate putRelationshipTypesItem(String key, String relationshipTypesItem) { public ToscaTemplate putRelationshipTypesItem(String key, Object relationshipTypesItem) {
if (this.relationshipTypes == null) { if (this.relationshipTypes == null) {
this.relationshipTypes = new HashMap<String, String>(); this.relationshipTypes = new HashMap<String, Object>();
} }
this.relationshipTypes.put(key, relationshipTypesItem); this.relationshipTypes.put(key, relationshipTypesItem);
return this; return this;
...@@ -296,27 +321,28 @@ public class ToscaTemplate { ...@@ -296,27 +321,28 @@ public class ToscaTemplate {
/** /**
* Get relationshipTypes * Get relationshipTypes
*
* @return relationshipTypes * @return relationshipTypes
**/ *
*/
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Map<String, Object> getRelationshipTypes() {
public Map<String, String> getRelationshipTypes() {
return relationshipTypes; return relationshipTypes;
} }
public void setRelationshipTypes(Map<String, String> relationshipTypes) { public void setRelationshipTypes(Map<String, Object> relationshipTypes) {
this.relationshipTypes = relationshipTypes; this.relationshipTypes = relationshipTypes;
} }
public ToscaTemplate relationshipTemplates(Map<String, String> relationshipTemplates) { public ToscaTemplate relationshipTemplates(Map<String, Object> relationshipTemplates) {
this.relationshipTemplates = relationshipTemplates; this.relationshipTemplates = relationshipTemplates;
return this; return this;
} }
public ToscaTemplate putRelationshipTemplatesItem(String key, String relationshipTemplatesItem) { public ToscaTemplate putRelationshipTemplatesItem(String key, Object relationshipTemplatesItem) {
if (this.relationshipTemplates == null) { if (this.relationshipTemplates == null) {
this.relationshipTemplates = new HashMap<String, String>(); this.relationshipTemplates = new HashMap<String, Object>();
} }
this.relationshipTemplates.put(key, relationshipTemplatesItem); this.relationshipTemplates.put(key, relationshipTemplatesItem);
return this; return this;
...@@ -324,27 +350,28 @@ public class ToscaTemplate { ...@@ -324,27 +350,28 @@ public class ToscaTemplate {
/** /**
* Get relationshipTemplates * Get relationshipTemplates
*
* @return relationshipTemplates * @return relationshipTemplates
**/ *
*/
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Map<String, Object> getRelationshipTemplates() {
public Map<String, String> getRelationshipTemplates() {
return relationshipTemplates; return relationshipTemplates;
} }
public void setRelationshipTemplates(Map<String, String> relationshipTemplates) { public void setRelationshipTemplates(Map<String, Object> relationshipTemplates) {
this.relationshipTemplates = relationshipTemplates; this.relationshipTemplates = relationshipTemplates;
} }
public ToscaTemplate capabilityTypes(Map<String, String> capabilityTypes) { public ToscaTemplate capabilityTypes(Map<String, Object> capabilityTypes) {
this.capabilityTypes = capabilityTypes; this.capabilityTypes = capabilityTypes;
return this; return this;
} }
public ToscaTemplate putCapabilityTypesItem(String key, String capabilityTypesItem) { public ToscaTemplate putCapabilityTypesItem(String key, Object capabilityTypesItem) {
if (this.capabilityTypes == null) { if (this.capabilityTypes == null) {
this.capabilityTypes = new HashMap<String, String>(); this.capabilityTypes = new HashMap<String, Object>();
} }
this.capabilityTypes.put(key, capabilityTypesItem); this.capabilityTypes.put(key, capabilityTypesItem);
return this; return this;
...@@ -352,27 +379,28 @@ public class ToscaTemplate { ...@@ -352,27 +379,28 @@ public class ToscaTemplate {
/** /**
* Get capabilityTypes * Get capabilityTypes
*
* @return capabilityTypes * @return capabilityTypes
**/ *
*/
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Map<String, Object> getCapabilityTypes() {
public Map<String, String> getCapabilityTypes() {
return capabilityTypes; return capabilityTypes;
} }
public void setCapabilityTypes(Map<String, String> capabilityTypes) { public void setCapabilityTypes(Map<String, Object> capabilityTypes) {
this.capabilityTypes = capabilityTypes; this.capabilityTypes = capabilityTypes;
} }
public ToscaTemplate artifactTypes(Map<String, String> artifactTypes) { public ToscaTemplate artifactTypes(Map<String, Object> artifactTypes) {
this.artifactTypes = artifactTypes; this.artifactTypes = artifactTypes;
return this; return this;
} }
public ToscaTemplate putArtifactTypesItem(String key, String artifactTypesItem) { public ToscaTemplate putArtifactTypesItem(String key, Object artifactTypesItem) {
if (this.artifactTypes == null) { if (this.artifactTypes == null) {
this.artifactTypes = new HashMap<String, String>(); this.artifactTypes = new HashMap<String, Object>();
} }
this.artifactTypes.put(key, artifactTypesItem); this.artifactTypes.put(key, artifactTypesItem);
return this; return this;
...@@ -380,27 +408,28 @@ public class ToscaTemplate { ...@@ -380,27 +408,28 @@ public class ToscaTemplate {
/** /**
* Get artifactTypes * Get artifactTypes
*
* @return artifactTypes * @return artifactTypes
**/ *
*/
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Map<String, Object> getArtifactTypes() {
public Map<String, String> getArtifactTypes() {
return artifactTypes; return artifactTypes;
} }
public void setArtifactTypes(Map<String, String> artifactTypes) { public void setArtifactTypes(Map<String, Object> artifactTypes) {
this.artifactTypes = artifactTypes; this.artifactTypes = artifactTypes;
} }
public ToscaTemplate dataTypes(Map<String, String> dataTypes) { public ToscaTemplate dataTypes(Map<String, Object> dataTypes) {
this.dataTypes = dataTypes; this.dataTypes = dataTypes;
return this; return this;
} }
public ToscaTemplate putDataTypesItem(String key, String dataTypesItem) { public ToscaTemplate putDataTypesItem(String key, Object dataTypesItem) {
if (this.dataTypes == null) { if (this.dataTypes == null) {
this.dataTypes = new HashMap<String, String>(); this.dataTypes = new HashMap<String, Object>();
} }
this.dataTypes.put(key, dataTypesItem); this.dataTypes.put(key, dataTypesItem);
return this; return this;
...@@ -408,27 +437,28 @@ public class ToscaTemplate { ...@@ -408,27 +437,28 @@ public class ToscaTemplate {
/** /**
* Get dataTypes * Get dataTypes
*
* @return dataTypes * @return dataTypes
**/ *
*/
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Map<String, Object> getDataTypes() {
public Map<String, String> getDataTypes() {
return dataTypes; return dataTypes;
} }
public void setDataTypes(Map<String, String> dataTypes) { public void setDataTypes(Map<String, Object> dataTypes) {
this.dataTypes = dataTypes; this.dataTypes = dataTypes;
} }
public ToscaTemplate interfaceTypes(Map<String, String> interfaceTypes) { public ToscaTemplate interfaceTypes(Map<String, Object> interfaceTypes) {
this.interfaceTypes = interfaceTypes; this.interfaceTypes = interfaceTypes;
return this; return this;
} }
public ToscaTemplate putInterfaceTypesItem(String key, String interfaceTypesItem) { public ToscaTemplate putInterfaceTypesItem(String key, Object interfaceTypesItem) {
if (this.interfaceTypes == null) { if (this.interfaceTypes == null) {
this.interfaceTypes = new HashMap<String, String>(); this.interfaceTypes = new HashMap<String, Object>();
} }
this.interfaceTypes.put(key, interfaceTypesItem); this.interfaceTypes.put(key, interfaceTypesItem);
return this; return this;
...@@ -436,16 +466,17 @@ public class ToscaTemplate { ...@@ -436,16 +466,17 @@ public class ToscaTemplate {
/** /**
* Get interfaceTypes * Get interfaceTypes
*
* @return interfaceTypes * @return interfaceTypes
**/ *
*/
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Map<String, Object> getInterfaceTypes() {
public Map<String, String> getInterfaceTypes() {
return interfaceTypes; return interfaceTypes;
} }
public void setInterfaceTypes(Map<String, String> interfaceTypes) { public void setInterfaceTypes(Map<String, Object> interfaceTypes) {
this.interfaceTypes = interfaceTypes; this.interfaceTypes = interfaceTypes;
} }
...@@ -464,11 +495,12 @@ public class ToscaTemplate { ...@@ -464,11 +495,12 @@ public class ToscaTemplate {
/** /**
* Get policyTypes * Get policyTypes
*
* @return policyTypes * @return policyTypes
**/ *
*/
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Map<String, String> getPolicyTypes() { public Map<String, String> getPolicyTypes() {
return policyTypes; return policyTypes;
} }
...@@ -477,14 +509,14 @@ public class ToscaTemplate { ...@@ -477,14 +509,14 @@ public class ToscaTemplate {
this.policyTypes = policyTypes; this.policyTypes = policyTypes;
} }
public ToscaTemplate groupTypes(Map<String, String> groupTypes) { public ToscaTemplate groupTypes(Map<String, Object> groupTypes) {
this.groupTypes = groupTypes; this.groupTypes = groupTypes;
return this; return this;
} }
public ToscaTemplate putGroupTypesItem(String key, String groupTypesItem) { public ToscaTemplate putGroupTypesItem(String key, Object groupTypesItem) {
if (this.groupTypes == null) { if (this.groupTypes == null) {
this.groupTypes = new HashMap<String, String>(); this.groupTypes = new HashMap<String, Object>();
} }
this.groupTypes.put(key, groupTypesItem); this.groupTypes.put(key, groupTypesItem);
return this; return this;
...@@ -492,16 +524,17 @@ public class ToscaTemplate { ...@@ -492,16 +524,17 @@ public class ToscaTemplate {
/** /**
* Get groupTypes * Get groupTypes
*
* @return groupTypes * @return groupTypes
**/ *
*/
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Map<String, Object> getGroupTypes() {
public Map<String, String> getGroupTypes() {
return groupTypes; return groupTypes;
} }
public void setGroupTypes(Map<String, String> groupTypes) { public void setGroupTypes(Map<String, Object> groupTypes) {
this.groupTypes = groupTypes; this.groupTypes = groupTypes;
} }
...@@ -512,11 +545,12 @@ public class ToscaTemplate { ...@@ -512,11 +545,12 @@ public class ToscaTemplate {
/** /**
* Get description * Get description
*
* @return description * @return description
**/ *
*/
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public String getDescription() { public String getDescription() {
return description; return description;
} }
...@@ -532,11 +566,12 @@ public class ToscaTemplate { ...@@ -532,11 +566,12 @@ public class ToscaTemplate {
/** /**
* Get templateAuthor * Get templateAuthor
*
* @return templateAuthor * @return templateAuthor
**/ *
*/
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public String getTemplateAuthor() { public String getTemplateAuthor() {
return templateAuthor; return templateAuthor;
} }
...@@ -545,7 +580,6 @@ public class ToscaTemplate { ...@@ -545,7 +580,6 @@ public class ToscaTemplate {
this.templateAuthor = templateAuthor; this.templateAuthor = templateAuthor;
} }
@Override @Override
public boolean equals(java.lang.Object o) { public boolean equals(java.lang.Object o) {
if (this == o) { if (this == o) {
...@@ -555,24 +589,24 @@ public class ToscaTemplate { ...@@ -555,24 +589,24 @@ public class ToscaTemplate {
return false; return false;
} }
ToscaTemplate toscaTemplate = (ToscaTemplate) o; ToscaTemplate toscaTemplate = (ToscaTemplate) o;
return Objects.equals(this.toscaDefinitionsVersion, toscaTemplate.toscaDefinitionsVersion) && return Objects.equals(this.toscaDefinitionsVersion, toscaTemplate.toscaDefinitionsVersion)
Objects.equals(this.toscaDefaultNamespace, toscaTemplate.toscaDefaultNamespace) && && Objects.equals(this.toscaDefaultNamespace, toscaTemplate.toscaDefaultNamespace)
Objects.equals(this.templateName, toscaTemplate.templateName) && && Objects.equals(this.templateName, toscaTemplate.templateName)
Objects.equals(this.imports, toscaTemplate.imports) && && Objects.equals(this.imports, toscaTemplate.imports)
Objects.equals(this.repositories, toscaTemplate.repositories) && && Objects.equals(this.repositories, toscaTemplate.repositories)
Objects.equals(this.dslDefinitions, toscaTemplate.dslDefinitions) && && Objects.equals(this.dslDefinitions, toscaTemplate.dslDefinitions)
Objects.equals(this.nodeTypes, toscaTemplate.nodeTypes) && && Objects.equals(this.nodeTypes, toscaTemplate.nodeTypes)
Objects.equals(this.topologyTemplate, toscaTemplate.topologyTemplate) && && Objects.equals(this.topologyTemplate, toscaTemplate.topologyTemplate)
Objects.equals(this.relationshipTypes, toscaTemplate.relationshipTypes) && && Objects.equals(this.relationshipTypes, toscaTemplate.relationshipTypes)
Objects.equals(this.relationshipTemplates, toscaTemplate.relationshipTemplates) && && Objects.equals(this.relationshipTemplates, toscaTemplate.relationshipTemplates)
Objects.equals(this.capabilityTypes, toscaTemplate.capabilityTypes) && && Objects.equals(this.capabilityTypes, toscaTemplate.capabilityTypes)
Objects.equals(this.artifactTypes, toscaTemplate.artifactTypes) && && Objects.equals(this.artifactTypes, toscaTemplate.artifactTypes)
Objects.equals(this.dataTypes, toscaTemplate.dataTypes) && && Objects.equals(this.dataTypes, toscaTemplate.dataTypes)
Objects.equals(this.interfaceTypes, toscaTemplate.interfaceTypes) && && Objects.equals(this.interfaceTypes, toscaTemplate.interfaceTypes)
Objects.equals(this.policyTypes, toscaTemplate.policyTypes) && && Objects.equals(this.policyTypes, toscaTemplate.policyTypes)
Objects.equals(this.groupTypes, toscaTemplate.groupTypes) && && Objects.equals(this.groupTypes, toscaTemplate.groupTypes)
Objects.equals(this.description, toscaTemplate.description) && && Objects.equals(this.description, toscaTemplate.description)
Objects.equals(this.templateAuthor, toscaTemplate.templateAuthor); && Objects.equals(this.templateAuthor, toscaTemplate.templateAuthor);
} }
@Override @Override
...@@ -618,4 +652,3 @@ public class ToscaTemplate { ...@@ -618,4 +652,3 @@ public class ToscaTemplate {
return o.toString().replace("\n", "\n "); return o.toString().replace("\n", "\n ");
} }
} }
...@@ -13,7 +13,7 @@ import javax.validation.constraints.*; ...@@ -13,7 +13,7 @@ import javax.validation.constraints.*;
* User * User
*/ */
@Validated @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 { public class User {
@JsonProperty("id") @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);
}
}
...@@ -9,3 +9,6 @@ db.host=127.0.0.1 ...@@ -9,3 +9,6 @@ db.host=127.0.0.1
db.name=drip db.name=drip
db.username=drip-user db.username=drip-user
db.password=drip-pass db.password=drip-pass
spring.jackson.deserialization.UNWRAP_ROOT_VALUE=true
\ No newline at end of file
...@@ -17,6 +17,7 @@ paths: ...@@ -17,6 +17,7 @@ paths:
post: post:
summary: "upload a tosca template description file" summary: "upload a tosca template description file"
description: "" description: ""
operationId: "uploadToscaTemplate"
consumes: consumes:
- "multipart/form-data" - "multipart/form-data"
parameters: parameters:
...@@ -26,17 +27,21 @@ paths: ...@@ -26,17 +27,21 @@ paths:
description: "tosca Template description" description: "tosca Template description"
required: true required: true
responses: responses:
200:
description: "successful operation"
schema:
type: "string"
405: 405:
description: "Invalid input" description: "Invalid input"
security: security:
- drip_auth: - drip_auth:
- "write:ToscaTemplate" - "write:ToscaTemplate"
- "read:ToscaTemplate" - "read:ToscaTemplate"
/topolog_template/{id}: /tosca_template/{id}:
get: get:
summary: "Find topolog template by ID" summary: "Find topolog template by ID"
description: "Returns a single topolog template" description: "Returns a single topolog template"
operationId: "getToscaTemplateById" operationId: "getToscaTemplateByID"
produces: produces:
- "text/plain" - "text/plain"
parameters: parameters:
...@@ -44,11 +49,12 @@ paths: ...@@ -44,11 +49,12 @@ paths:
in: "path" in: "path"
description: "ID of topolog template to return" description: "ID of topolog template to return"
required: true required: true
type: "integer" type: "string"
format: "int64"
responses: responses:
200: 200:
description: "successful operation" description: "successful operation"
schema:
type: "string"
400: 400:
description: "Invalid ID supplied" description: "Invalid ID supplied"
404: 404:
...@@ -59,14 +65,14 @@ paths: ...@@ -59,14 +65,14 @@ paths:
- drip_auth: - drip_auth:
- "write:ToscaTemplate" - "write:ToscaTemplate"
- "read:ToscaTemplate" - "read:ToscaTemplate"
post: put:
summary: "Updates exisintg topolog template in the store" summary: "Updates exisintg topolog template"
description: "" description: ""
operationId: "updateToscaTemplate" operationId: "updateToscaTemplateByID"
consumes: consumes:
- "multipart/form-data" - "multipart/form-data"
produces: produces:
- "application/json" - "text/plain"
parameters: parameters:
- in: "formData" - in: "formData"
name: "file" name: "file"
...@@ -76,11 +82,12 @@ paths: ...@@ -76,11 +82,12 @@ paths:
in: "path" in: "path"
description: "ID of topolog template to return" description: "ID of topolog template to return"
required: true required: true
type: "integer" type: "string"
format: "int64"
responses: responses:
200: 200:
description: "successful operation" description: "successful operation"
schema:
type: "string"
400: 400:
description: "Invalid ID supplied" description: "Invalid ID supplied"
404: 404:
...@@ -94,20 +101,18 @@ paths: ...@@ -94,20 +101,18 @@ paths:
delete: delete:
summary: "Deletes a tosca topolog template" summary: "Deletes a tosca topolog template"
description: "" description: ""
operationId: "deleteToscaTemplateByID"
parameters: parameters:
- name: "api_key"
in: "header"
required: false
type: "string"
- name: "id" - name: "id"
in: "path" in: "path"
description: "ID of topolog template to return" description: "ID of topolog template to return"
required: true required: true
type: "integer" type: "string"
format: "int64"
responses: responses:
200: 200:
description: "successful operation" description: "successful operation"
schema:
type: "string"
400: 400:
description: "Invalid ID supplied" description: "Invalid ID supplied"
404: 404:
...@@ -120,6 +125,7 @@ paths: ...@@ -120,6 +125,7 @@ paths:
get: get:
summary: "plan tosca template" summary: "plan tosca template"
description: "Returns the ID of the planed topolog template" description: "Returns the ID of the planed topolog template"
operationId: "planToscaTemplateByID"
produces: produces:
- "text/plain" - "text/plain"
parameters: parameters:
...@@ -127,11 +133,12 @@ paths: ...@@ -127,11 +133,12 @@ paths:
in: "path" in: "path"
description: "ID of topolog template to plan" description: "ID of topolog template to plan"
required: true required: true
type: "integer" type: "string"
format: "int64"
responses: responses:
200: 200:
description: "successful operation" description: "successful operation"
schema:
type: "string"
400: 400:
description: "Invalid ID supplied" description: "Invalid ID supplied"
404: 404:
...@@ -146,6 +153,7 @@ paths: ...@@ -146,6 +153,7 @@ paths:
get: get:
summary: "get the plan tosca template" summary: "get the plan tosca template"
description: "Returns the plan topolog template" description: "Returns the plan topolog template"
operationId: "getPlanToscaTemplateByID"
produces: produces:
- "text/plain" - "text/plain"
parameters: parameters:
...@@ -153,11 +161,12 @@ paths: ...@@ -153,11 +161,12 @@ paths:
in: "path" in: "path"
description: "ID of topolog template plan" description: "ID of topolog template plan"
required: true required: true
type: "integer" type: "string"
format: "int64"
responses: responses:
200: 200:
description: "successful operation" description: "successful operation"
schema:
type: "string"
400: 400:
description: "Invalid ID supplied" description: "Invalid ID supplied"
404: 404:
...@@ -171,7 +180,8 @@ paths: ...@@ -171,7 +180,8 @@ paths:
/provisioner/provision/{id}: /provisioner/provision/{id}:
get: get:
summary: "provision tosca template" summary: "provision tosca template"
description: "Returns the provision ID" description: "provosions the operationId: Plan Tosca Template Returns the provision ID"
operationId: "provisionPlanToscaTemplateByID"
produces: produces:
- "text/plain" - "text/plain"
parameters: parameters:
...@@ -179,11 +189,12 @@ paths: ...@@ -179,11 +189,12 @@ paths:
in: "path" in: "path"
description: "ID of topolog template to plan" description: "ID of topolog template to plan"
required: true required: true
type: "integer" type: "string"
format: "int64"
responses: responses:
200: 200:
description: "successful operation" description: "successful operation"
schema:
type: "string"
400: 400:
description: "Invalid ID supplied" description: "Invalid ID supplied"
404: 404:
...@@ -198,6 +209,7 @@ paths: ...@@ -198,6 +209,7 @@ paths:
get: get:
summary: "the provisioned tosca template" summary: "the provisioned tosca template"
description: "Returns the provisioned tosca template" description: "Returns the provisioned tosca template"
operationId: "getProvisionToscaTemplateByID"
produces: produces:
- "text/plain" - "text/plain"
parameters: parameters:
...@@ -205,11 +217,12 @@ paths: ...@@ -205,11 +217,12 @@ paths:
in: "path" in: "path"
description: "ID of topolog template to plan" description: "ID of topolog template to plan"
required: true required: true
type: "integer" type: "string"
format: "int64"
responses: responses:
200: 200:
description: "successful operation" description: "successful operation"
schema:
type: "string"
400: 400:
description: "Invalid ID supplied" description: "Invalid ID supplied"
404: 404:
...@@ -224,6 +237,7 @@ paths: ...@@ -224,6 +237,7 @@ paths:
get: get:
summary: "deploy the software tosca template" summary: "deploy the software tosca template"
description: "Returns the deployment ID" description: "Returns the deployment ID"
operationId: "deployProvisionToscaTemplateByID"
produces: produces:
- "text/plain" - "text/plain"
parameters: parameters:
...@@ -231,11 +245,12 @@ paths: ...@@ -231,11 +245,12 @@ paths:
in: "path" in: "path"
description: "ID of topolog template to deploy" description: "ID of topolog template to deploy"
required: true required: true
type: "integer" type: "string"
format: "int64"
responses: responses:
200: 200:
description: "successful operation" description: "successful operation"
schema:
type: "string"
400: 400:
description: "Invalid ID supplied" description: "Invalid ID supplied"
404: 404:
...@@ -250,6 +265,7 @@ paths: ...@@ -250,6 +265,7 @@ paths:
get: get:
summary: "get the deployment topolog template" summary: "get the deployment topolog template"
description: "Returns the deployment topolog template" description: "Returns the deployment topolog template"
operationId: "getDeployToscaTemplateByID"
produces: produces:
- "text/plain" - "text/plain"
parameters: parameters:
...@@ -257,11 +273,12 @@ paths: ...@@ -257,11 +273,12 @@ paths:
in: "path" in: "path"
description: "ID of topolog template to deploy" description: "ID of topolog template to deploy"
required: true required: true
type: "integer" type: "string"
format: "int64"
responses: responses:
200: 200:
description: "successful operation" description: "successful operation"
schema:
type: "string"
400: 400:
description: "Invalid ID supplied" description: "Invalid ID supplied"
404: 404:
...@@ -276,6 +293,7 @@ paths: ...@@ -276,6 +293,7 @@ paths:
post: post:
summary: "Create credentials" summary: "Create credentials"
description: "Creates credentials" description: "Creates credentials"
operationId: "createCredentials"
produces: produces:
- "application/json" - "application/json"
consumes: consumes:
...@@ -290,6 +308,8 @@ paths: ...@@ -290,6 +308,8 @@ paths:
responses: responses:
200: 200:
description: "successful operation" description: "successful operation"
schema:
type: "string"
400: 400:
description: "Invalid ID supplied" description: "Invalid ID supplied"
404: 404:
...@@ -298,11 +318,12 @@ paths: ...@@ -298,11 +318,12 @@ paths:
description: "Invalid input" description: "Invalid input"
security: security:
- drip_auth: - drip_auth:
- "admin:User" - "write:Credentials"
- "read:Credentials"
/user: /user:
post: post:
summary: "Create user" summary: "Create user"
description: "This can only be done by the logged in user." description: "This can only be done by admin."
operationId: "createUser" operationId: "createUser"
produces: produces:
- "application/json" - "application/json"
...@@ -314,8 +335,12 @@ paths: ...@@ -314,8 +335,12 @@ paths:
schema: schema:
$ref: "#/definitions/User" $ref: "#/definitions/User"
responses: responses:
default: 200:
description: "successful operation" description: "successful operation"
schema:
type: "string"
409:
description: "already exists"
security: security:
- drip_auth: - drip_auth:
- "admin:User" - "admin:User"
...@@ -325,7 +350,6 @@ paths: ...@@ -325,7 +350,6 @@ paths:
- "user" - "user"
summary: "Logs user into the system" summary: "Logs user into the system"
description: "" description: ""
operationId: "loginUser"
produces: produces:
- "application/json" - "application/json"
parameters: parameters:
...@@ -359,7 +383,6 @@ paths: ...@@ -359,7 +383,6 @@ paths:
get: get:
summary: "Logs out current logged in user session" summary: "Logs out current logged in user session"
description: "" description: ""
operationId: "logoutUser"
produces: produces:
- "application/json" - "application/json"
parameters: [] parameters: []
...@@ -370,7 +393,6 @@ paths: ...@@ -370,7 +393,6 @@ paths:
get: get:
summary: "Get user by user name" summary: "Get user by user name"
description: "" description: ""
operationId: "getUserByName"
produces: produces:
- "application/json" - "application/json"
parameters: parameters:
...@@ -396,7 +418,6 @@ paths: ...@@ -396,7 +418,6 @@ paths:
- "user" - "user"
summary: "Updated user" summary: "Updated user"
description: "This can only be done by the logged in user." description: "This can only be done by the logged in user."
operationId: "updateUser"
produces: produces:
- "application/json" - "application/json"
parameters: parameters:
...@@ -422,7 +443,6 @@ paths: ...@@ -422,7 +443,6 @@ paths:
delete: delete:
summary: "Delete user" summary: "Delete user"
description: "This can only be done by the logged in user." description: "This can only be done by the logged in user."
operationId: "deleteUser"
produces: produces:
- "application/json" - "application/json"
parameters: parameters:
...@@ -448,10 +468,8 @@ securityDefinitions: ...@@ -448,10 +468,8 @@ securityDefinitions:
write:ToscaTemplate: "modify topolog template in your account" write:ToscaTemplate: "modify topolog template in your account"
read:ToscaTemplate: "read your topolog template" read:ToscaTemplate: "read your topolog template"
admin:User: "Grants access to admin operations" admin:User: "Grants access to admin operations"
api_key: write:Credentials: "modify cloud credentials in your account"
type: "apiKey" read:Credentials: "read your cloud credentials"
name: "api_key"
in: "header"
definitions: definitions:
User: User:
type: "object" type: "object"
...@@ -489,8 +507,6 @@ definitions: ...@@ -489,8 +507,6 @@ definitions:
additionalProperties: additionalProperties:
type: string type: string
repositories: repositories:
type: "array"
items:
type: object type: object
additionalProperties: additionalProperties:
type: string type: string
...@@ -501,33 +517,33 @@ definitions: ...@@ -501,33 +517,33 @@ definitions:
node_types: node_types:
type: object type: object
additionalProperties: additionalProperties:
type: string type: object
topology_template: topology_template:
$ref: "#/definitions/TopologyTemplate" $ref: "#/definitions/TopologyTemplate"
relationship_types: relationship_types:
type: object type: object
additionalProperties: additionalProperties:
type: string type: object
relationship_templates: relationship_templates:
type: object type: object
additionalProperties: additionalProperties:
type: string type: object
capability_types: capability_types:
type: object type: object
additionalProperties: additionalProperties:
type: string type: object
artifact_types: artifact_types:
type: object type: object
additionalProperties: additionalProperties:
type: string type: object
data_types: data_types:
type: object type: object
additionalProperties: additionalProperties:
type: string type: object
interface_types: interface_types:
type: object type: object
additionalProperties: additionalProperties:
type: string type: object
policy_types: policy_types:
type: object type: object
additionalProperties: additionalProperties:
...@@ -535,7 +551,7 @@ definitions: ...@@ -535,7 +551,7 @@ definitions:
group_types: group_types:
type: object type: object
additionalProperties: additionalProperties:
type: string type: object
description: description:
type: "string" type: "string"
template_author: template_author:
...@@ -550,33 +566,35 @@ definitions: ...@@ -550,33 +566,35 @@ definitions:
items: items:
type: object type: object
additionalProperties: additionalProperties:
type: string type: object
policies: policies:
type: "array" type: "array"
items: items:
type: object type: object
additionalProperties: additionalProperties:
type: string type: object
outputs: outputs:
type: "array" type: "array"
items: items:
type: object type: object
additionalProperties: additionalProperties:
type: string type: object
node_templates: node_templates:
$ref: "#/definitions/NodeTemplate" type: object
additionalProperties:
type: object
relationship_templates: relationship_templates:
type: object type: object
additionalProperties: additionalProperties:
type: string type: object
groups: groups:
type: object type: object
additionalProperties: additionalProperties:
type: string type: object
substitution_mappings: substitution_mappings:
type: object type: object
additionalProperties: additionalProperties:
type: string type: object
NodeTemplate: NodeTemplate:
type: "object" type: "object"
properties: properties:
...@@ -589,27 +607,27 @@ definitions: ...@@ -589,27 +607,27 @@ definitions:
items: items:
type: object type: object
additionalProperties: additionalProperties:
type: string type: object
artifacts: artifacts:
type: object type: object
additionalProperties: additionalProperties:
type: string type: object
properties: properties:
type: object type: object
additionalProperties: additionalProperties:
type: string type: object
interfaces: interfaces:
type: object type: object
additionalProperties: additionalProperties:
type: string type: object
capabilities: capabilities:
type: object type: object
additionalProperties: additionalProperties:
type: string type: object
workflows: workflows:
type: object type: object
additionalProperties: additionalProperties:
type: string type: object
Credentials: Credentials:
type: "object" type: "object"
properties: 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