push addional 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 / 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 static org.openecomp.sdcrests.common.RestConstants.USER_HEADER_PARAM;
24 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
25
26 import io.swagger.annotations.Api;
27 import io.swagger.annotations.ApiOperation;
28 import io.swagger.annotations.ApiParam;
29 import org.apache.cxf.jaxrs.ext.multipart.Attachment;
30 import org.apache.cxf.jaxrs.ext.multipart.Multipart;
31 import org.openecomp.sdc.versioning.dao.types.Version;
32 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessEntityDto;
33 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessRequestDto;
34 import org.springframework.validation.annotation.Validated;
35
36 import javax.validation.Valid;
37 import javax.validation.constraints.NotNull;
38 import javax.validation.constraints.Pattern;
39 import javax.ws.rs.Consumes;
40 import javax.ws.rs.DELETE;
41 import javax.ws.rs.GET;
42 import javax.ws.rs.HeaderParam;
43 import javax.ws.rs.POST;
44 import javax.ws.rs.PUT;
45 import javax.ws.rs.Path;
46 import javax.ws.rs.PathParam;
47 import javax.ws.rs.Produces;
48 import javax.ws.rs.QueryParam;
49 import javax.ws.rs.core.MediaType;
50 import javax.ws.rs.core.Response;
51
52 @Path("/v1.0/vendor-software-products/{vspId}/components/{componentId}/processes")
53 @Produces(MediaType.APPLICATION_JSON)
54 @Consumes(MediaType.APPLICATION_JSON)
55 @Api(value = "Vendor Software Product Component Processes")
56 @Validated
57 public interface ComponentProcesses {
58   @GET
59   @Path("/")
60   @ApiOperation(value = "List vendor software product component processes",
61       response = ProcessEntityDto.class,
62       responseContainer = "List")
63   Response list(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
64                 @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
65                     String componentId,
66                 @Pattern(regexp = Version.VERSION_REGEX,
67                     message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
68                     String version,
69                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
70                     String user);
71
72   @DELETE
73   @Path("/")
74   @ApiOperation(value = "Delete vendor software product processes",
75       responseContainer = "List")
76   Response deleteList(
77       @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
78       @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
79           String componentId,
80       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
81
82   @POST
83   @Path("/")
84   @ApiOperation(value = "Create a vendor software product process")
85   Response create(@Valid ProcessRequestDto request,
86                   @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
87                   @ApiParam(value = "Vendor software product component Id")
88                   @PathParam("componentId") String componentId,
89                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
90                       String user);
91
92   @GET
93   @Path("/{processId}")
94   @ApiOperation(value = "Get vendor software product process",
95       response = ProcessEntityDto.class)
96   Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
97                @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
98                    String componentId,
99                @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
100                    String processId,
101                @Pattern(regexp = Version.VERSION_REGEX,
102                    message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
103                    String version,
104                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
105                    String user);
106
107   @DELETE
108   @Path("/{processId}")
109   @ApiOperation(value = "Delete vendor software product process")
110   Response delete(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
111                   @ApiParam(value = "Vendor software product component Id")
112                   @PathParam("componentId") String componentId,
113                   @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
114                       String processId,
115                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
116                       String user);
117
118   @PUT
119   @Path("/{processId}")
120   @ApiOperation(value = "Update vendor software product process")
121   Response update(@Valid ProcessRequestDto request,
122                   @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
123                   @ApiParam(value = "Vendor software product component Id")
124                   @PathParam("componentId") String componentId,
125                   @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
126                       String processId,
127                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
128                       String user);
129
130   @GET
131   @Path("/{processId}/upload")
132   @Produces(MediaType.APPLICATION_OCTET_STREAM)
133   @ApiOperation(value = "Get vendor software product process uploaded file")
134   Response getUploadedFile(
135       @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
136       @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
137           String componentId,
138       @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
139           String processId,
140       @Pattern(regexp = Version.VERSION_REGEX, message = Version.VERSION_STRING_VIOLATION_MSG)
141       @QueryParam("version") String version,
142       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
143
144   @DELETE
145   @Path("/{processId}/upload")
146   @ApiOperation(value = "Delete vendor software product process uploaded file")
147   Response deleteUploadedFile(
148       @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
149       @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
150           String componentId,
151       @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
152           String processId,
153       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
154
155   @POST
156   @Path("/{processId}/upload")
157   @Consumes(MediaType.MULTIPART_FORM_DATA)
158   @ApiOperation(value = "Update vendor software product process upload")
159   Response uploadFile(@Multipart("upload") Attachment attachment,
160                       @ApiParam(value = "Vendor software product Id") @PathParam("vspId")
161                           String vspId,
162                       @ApiParam(value = "Vendor software product component Id")
163                       @PathParam("componentId") String componentId,
164                       @ApiParam(value = "Vendor software product process Id")
165                       @PathParam("processId") String processId,
166                       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
167                           String user);
168 }