re base code
[sdc.git] / openecomp-be / api / openecomp-sdc-rest-webapp / vendor-software-products-rest / vendor-software-products-rest-services / src / main / java / org / openecomp / sdcrests / vsp / rest / OrchestrationTemplateCandidate.java
1 /*
2  * Copyright © 2016-2018 European Support Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.openecomp.sdcrests.vsp.rest;
18
19 import io.swagger.annotations.Api;
20 import io.swagger.annotations.ApiOperation;
21 import io.swagger.annotations.ApiParam;
22 import org.apache.cxf.jaxrs.ext.multipart.Attachment;
23 import org.apache.cxf.jaxrs.ext.multipart.Multipart;
24 import org.openecomp.sdcrests.vendorsoftwareproducts.types.FileDataStructureDto;
25 import org.openecomp.sdcrests.vendorsoftwareproducts.types.UploadFileResponseDto;
26 import org.springframework.validation.annotation.Validated;
27
28 import javax.validation.Valid;
29 import javax.validation.constraints.NotNull;
30 import javax.ws.rs.*;
31 import javax.ws.rs.core.MediaType;
32 import javax.ws.rs.core.Response;
33 import java.io.File;
34 import java.io.IOException;
35 import java.lang.reflect.InvocationTargetException;
36
37 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
38 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
39
40 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/orchestration-template-candidate")
41 @Produces(MediaType.APPLICATION_JSON)
42 @Consumes(MediaType.APPLICATION_JSON)
43 @Api(value = "Orchestration Template Candidate")
44 @Validated
45 public interface OrchestrationTemplateCandidate extends VspEntities {
46
47   @POST
48   @Path("/")
49   @Consumes(MediaType.MULTIPART_FORM_DATA)
50   Response upload(
51       @PathParam("vspId") String vspId,
52       @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
53       @Multipart("upload") Attachment fileToUpload,
54       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
55
56   @GET
57   @Path("/")
58   @Produces(MediaType.APPLICATION_OCTET_STREAM)
59   @ApiOperation(value = "Get uploaded Network Package file",
60       notes = "Downloads in uploaded Network Package file",
61       response = File.class)
62   Response get(
63       @PathParam("vspId") String vspId,
64       @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
65       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user)
66       throws IOException;
67
68   @DELETE
69   @Path("/")
70   @ApiOperation(value = "Delete orchestration template candidate file and its files data structure")
71   Response abort(
72       @PathParam("vspId") String vspId,
73       @ApiParam(value = "Version Id") @PathParam("versionId") String versionId)
74       throws Exception;
75
76   @PUT
77   @Path("/process")
78   @ApiOperation(value = "process Orchestration Template Candidate",
79       response = UploadFileResponseDto.class)
80   Response process(
81       @PathParam("vspId") String vspId,
82       @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
83       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user)
84       throws InvocationTargetException, IllegalAccessException;
85
86   @PUT
87   @Path("/manifest")
88   @ApiOperation(value = "Update an existing vendor software product")
89   Response updateFilesDataStructure(
90       @PathParam("vspId") String vspId,
91       @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
92       @Valid FileDataStructureDto fileDataStructureDto,
93       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user)
94       throws Exception;
95
96   @GET
97   @Path("/manifest")
98   @ApiOperation(value = "Get uploaded HEAT file files data structure",
99       notes = "Downloads the latest HEAT package",
100       response = FileDataStructureDto.class)
101   Response getFilesDataStructure(
102       @PathParam("vspId") String vspId,
103       @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
104       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user)
105       throws Exception;
106 }