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