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