[SDC-29] Amdocs OnBoard 1707 initial commit.
[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_ID_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}/versions/{versionId}/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 extends VspEntities {
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 version Id") @PathParam("versionId") String versionId,
65                 @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
66                     String componentId,
67                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
68                     String user);
69
70   @DELETE
71   @Path("/")
72   @ApiOperation(value = "Delete vendor software product processes",
73       responseContainer = "List")
74   Response deleteList(
75       @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
76       @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
77       @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
78           String componentId,
79       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
80
81   @POST
82   @Path("/")
83   @ApiOperation(value = "Create a vendor software product process")
84   Response create(@Valid ProcessRequestDto request,
85                   @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")
88                   @PathParam("componentId") String componentId,
89                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_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 version Id") @PathParam("versionId") String versionId,
98                @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
99                    String componentId,
100                @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
101                    String processId,
102                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
103                    String user);
104
105   @DELETE
106   @Path("/{processId}")
107   @ApiOperation(value = "Delete vendor software product process")
108   Response delete(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
109                   @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
110                   @ApiParam(value = "Vendor software product component Id")
111                   @PathParam("componentId") String componentId,
112                   @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
113                       String processId,
114                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
115                       String user);
116
117   @PUT
118   @Path("/{processId}")
119   @ApiOperation(value = "Update vendor software product process")
120   Response update(@Valid ProcessRequestDto request,
121                   @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
122                   @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
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_ID_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 version Id") @PathParam("versionId") String versionId,
137       @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
138           String componentId,
139       @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
140           String processId,
141       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
142
143   @DELETE
144   @Path("/{processId}/upload")
145   @ApiOperation(value = "Delete vendor software product process uploaded file")
146   Response deleteUploadedFile(
147       @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
148       @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
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_ID_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") String vspId,
161                       @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
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_ID_HEADER_PARAM)
167                           String user);
168 }