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 / Processes.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}/processes")
50 @Produces(MediaType.APPLICATION_JSON)
51 @Consumes(MediaType.APPLICATION_JSON)
52 @Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Vendor Software Product Processes")})
53 @Validated
54 public interface Processes {
55   @GET
56   @Path("/")
57   @Operation(description = "List vendor software product 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                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
61                     String user);
62
63   @DELETE
64   @Path("/")
65   @Operation(description = "Delete vendor software product processes", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = List.class))))
66   Response deleteList(
67       @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
68       @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
69       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
70
71   @POST
72   @Path("/")
73   @Operation(description = "Create a vendor software product process")
74   Response create(@Valid ProcessRequestDto request,
75                   @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
76                   @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
77                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
78                       String user);
79
80   @GET
81   @Path("/{processId}")
82   @Operation(description = "Get vendor software product process", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessEntityDto.class))))
83   Response get(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
84                @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
85                @Parameter(description = "Vendor software product process Id") @PathParam("processId")
86                    String processId,
87                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
88                    String user);
89
90   @DELETE
91   @Path("/{processId}")
92   @Operation(description = "Delete vendor software product process")
93   Response delete(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
94                   @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
95                   @Parameter(description = "Vendor software product process Id") @PathParam("processId")
96                       String processId,
97                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
98                       String user);
99
100   @PUT
101   @Path("/{processId}")
102   @Operation(description = "Update vendor software product process")
103   Response update(@Valid ProcessRequestDto request,
104                   @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
105                   @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
106                   @Parameter(description = "Vendor software product process Id") @PathParam("processId")
107                       String processId,
108                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
109                       String user);
110
111   @GET
112   @Path("/{processId}/upload")
113   @Produces(MediaType.APPLICATION_OCTET_STREAM)
114   @Operation(description = "Get vendor software product process uploaded file")
115   Response getUploadedFile(
116       @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
117       @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
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) String user);
121
122   @DELETE
123   @Path("/{processId}/upload")
124   @Operation(description = "Delete vendor software product process uploaded file")
125   Response deleteUploadedFile(
126       @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
127       @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
128       @Parameter(description = "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   @POST
133   @Path("/{processId}/upload")
134   @Consumes(MediaType.MULTIPART_FORM_DATA)
135   @Operation(description = "Update vendor software product process upload")
136   Response uploadFile(@Multipart("upload") Attachment attachment,
137                       @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
138                       @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
139                       @Parameter(description = "Vendor software product process Id")
140                       @PathParam("processId") String processId,
141                       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
142                           String user);
143 }