Create new VSP, onboard from TOSCA file - UI
[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 / ComponentProcesses.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdcrests.vsp.rest;
22
23 import io.swagger.annotations.Api;
24 import io.swagger.annotations.ApiOperation;
25 import io.swagger.annotations.ApiParam;
26 import org.apache.cxf.jaxrs.ext.multipart.Attachment;
27 import org.apache.cxf.jaxrs.ext.multipart.Multipart;
28 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessEntityDto;
29 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessRequestDto;
30 import org.springframework.validation.annotation.Validated;
31
32 import javax.validation.Valid;
33 import javax.validation.constraints.NotNull;
34 import javax.ws.rs.*;
35 import javax.ws.rs.core.MediaType;
36 import javax.ws.rs.core.Response;
37
38 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
39 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
40
41 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/components/{componentId}/processes")
42 @Produces(MediaType.APPLICATION_JSON)
43 @Consumes(MediaType.APPLICATION_JSON)
44 @Api(value = "Vendor Software Product Component Processes")
45 @Validated
46 public interface ComponentProcesses extends VspEntities {
47   @GET
48   @Path("/")
49   @ApiOperation(value = "List vendor software product component processes",
50       response = ProcessEntityDto.class,
51       responseContainer = "List")
52   Response list(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
53                 @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
54                 @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
55                     String componentId,
56                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
57                     String user);
58
59   @DELETE
60   @Path("/")
61   @ApiOperation(value = "Delete vendor software product processes",
62       responseContainer = "List")
63   Response deleteList(
64       @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
65       @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
66       @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
67           String componentId,
68       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
69
70   @POST
71   @Path("/")
72   @ApiOperation(value = "Create a vendor software product process")
73   Response create(@Valid ProcessRequestDto request,
74                   @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
75                   @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
76                   @ApiParam(value = "Vendor software product component Id")
77                   @PathParam("componentId") String componentId,
78                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
79                       String user);
80
81   @GET
82   @Path("/{processId}")
83   @ApiOperation(value = "Get vendor software product process",
84       response = ProcessEntityDto.class)
85   Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
86                @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
87                @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
88                    String componentId,
89                @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
90                    String processId,
91                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
92                    String user);
93
94   @DELETE
95   @Path("/{processId}")
96   @ApiOperation(value = "Delete vendor software product process")
97   Response delete(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
98                   @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
99                   @ApiParam(value = "Vendor software product component Id")
100                   @PathParam("componentId") String componentId,
101                   @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
102                       String processId,
103                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
104                       String user);
105
106   @PUT
107   @Path("/{processId}")
108   @ApiOperation(value = "Update vendor software product process")
109   Response update(@Valid ProcessRequestDto request,
110                   @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
111                   @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
112                   @ApiParam(value = "Vendor software product component Id")
113                   @PathParam("componentId") String componentId,
114                   @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
115                       String processId,
116                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
117                       String user);
118
119   @GET
120   @Path("/{processId}/upload")
121   @Produces(MediaType.APPLICATION_OCTET_STREAM)
122   @ApiOperation(value = "Get vendor software product process uploaded file")
123   Response getUploadedFile(
124       @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
125       @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
126       @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
127           String componentId,
128       @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
129           String processId,
130       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
131
132   @DELETE
133   @Path("/{processId}/upload")
134   @ApiOperation(value = "Delete vendor software product process uploaded file")
135   Response deleteUploadedFile(
136       @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
137       @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
138       @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
139           String componentId,
140       @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
141           String processId,
142       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
143
144   @POST
145   @Path("/{processId}/upload")
146   @Consumes(MediaType.MULTIPART_FORM_DATA)
147   @ApiOperation(value = "Update vendor software product process upload")
148   Response uploadFile(@Multipart("upload") Attachment attachment,
149                       @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
150                       @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
151                       @ApiParam(value = "Vendor software product component Id")
152                       @PathParam("componentId") String componentId,
153                       @ApiParam(value = "Vendor software product process Id")
154                       @PathParam("processId") String processId,
155                       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
156                           String user);
157 }