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 / ComponentMonitoringUploads.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.MonitoringUploadStatusDto;
35 import org.springframework.validation.annotation.Validated;
36
37 import javax.validation.constraints.NotNull;
38 import javax.ws.rs.*;
39 import javax.ws.rs.core.MediaType;
40 import javax.ws.rs.core.Response;
41
42 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
43 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
44
45 @Path(
46     "/v1.0/vendor-software-products/{vspId}/versions/{versionId}/components/{componentId}/uploads/")
47 @Produces(MediaType.APPLICATION_JSON)
48 @Consumes(MediaType.APPLICATION_JSON)
49 @Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Vendor Software Product Component Uploads")})
50 @Validated
51 public interface ComponentMonitoringUploads extends VspEntities {
52   @POST
53   @Path("types/{type}/")
54   @Consumes(MediaType.MULTIPART_FORM_DATA)
55   @Operation(description = "Upload file for component by type")
56   Response upload(@Multipart("upload") Attachment attachment,
57                   @Parameter(description = "Vendor software product Id") @PathParam("vspId")
58                       String vspId,
59                   @Parameter(description = "Vendor software product version Id")
60                   @PathParam("versionId") String versionId,
61                   @Parameter(description = "Component Id") @PathParam("componentId") String
62                       componentId,
63                   @Parameter(description = "Upload Type") @PathParam("type") String type,
64                   @NotNull(message = USER_MISSING_ERROR_MSG)
65                   @HeaderParam(USER_ID_HEADER_PARAM) String user) throws Exception;
66
67   @DELETE
68   @Path("types/{type}")
69   @Operation(description = "Delete file uploaded for component")
70   Response delete(
71       @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
72       @Parameter(description = "Vendor software product version Id") @PathParam("versionId")
73           String versionId,
74       @Parameter(description = "Component Id") @PathParam("componentId") String componentId,
75       @Parameter(description = "Upload Type") @PathParam("type") String type,
76       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user)
77       throws Exception;
78
79   @GET
80   @Path("")
81   @Operation(description = "Get the filenames of uploaded files by type", responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation =MonitoringUploadStatusDto.class)))))
82   Response list(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
83                 @Parameter(description = "Vendor software product version Id") @PathParam("versionId")
84                     String versionId,
85                 @Parameter(description = "Vendor software product component Id") @PathParam("componentId")
86                     String componentId,
87                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
88                     String user);
89 }