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 / Compute.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2019 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.openecomp.sdcrests.vendorsoftwareproducts.types.ComputeDetailsDto;
33 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComputeDto;
34 import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
35 import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.IsValidJson;
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 static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
45 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
46
47 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/components/{componentId" +
48     "}/compute-flavors")
49 @Produces(MediaType.APPLICATION_JSON)
50 @Consumes(MediaType.APPLICATION_JSON)
51 @Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Vendor Software Product Component Compute-flavors")})
52 @Validated
53 public interface Compute extends VspEntities {
54
55   @GET
56   @Path("/")
57   @Operation(description = "Get list of vendor software product component compute-flavors", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation =ComputeDto.class)))))
58   Response list(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
59                 @Parameter(description = "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   @GET
66   @Path("/{computeFlavorId}")
67   @Operation(description = "Get vendor software product component compute-flavor", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation =ComputeDetailsDto.class)))))
68   Response get(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
69                @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
70                @Parameter(description = "Vendor software product component Id") @PathParam("componentId")
71                    String componentId,
72                @Parameter(description = "Vendor software product compute-flavor Id") @PathParam
73                    ("computeFlavorId")
74                    String computeId,
75                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
76                    String user);
77
78   @POST
79   @Path("/")
80   @Operation(description = "Create a vendor software product component compute-flavor")
81   Response create(@Valid ComputeDetailsDto request,
82                   @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
83                   @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
84                   @Parameter(description = "Vendor software product component Id")
85                   @PathParam("componentId") String componentId,
86                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
87                       String user);
88
89   @PUT
90   @Path("/{computeFlavorId}")
91   @Operation(description = "Update vendor software product component compute-flavor")
92   Response update(@Valid ComputeDetailsDto request,
93                   @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
94                   @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
95                   @Parameter(description = "Vendor software product component Id")
96                   @PathParam("componentId") String componentId,
97                   @Parameter(description = "Vendor software product compute-flavor Id") @PathParam
98                       ("computeFlavorId")
99                       String computeFlavorId,
100                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
101                       String user);
102
103   @PUT
104   @Path("/{computeFlavorId}/questionnaire")
105   @Operation(description = "Update vendor software product component compute-flavor questionnaire")
106   Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
107                   @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
108                   @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
109                   @Parameter(description = "Vendor software product component Id")
110                   @PathParam("componentId") String componentId,
111                   @Parameter(description = "Vendor software product compute-flavor Id") @PathParam
112                       ("computeFlavorId")
113                       String computeFlavorId,
114                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
115                       String user);
116
117   @DELETE
118   @Path("/{computeFlavorId}")
119   @Operation(description = "Delete vendor software product component compute-flavor")
120   Response delete(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
121                   @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
122                   @Parameter(description = "Vendor software product component Id")
123                   @PathParam("componentId") String componentId,
124                   @Parameter(description = "Vendor software product compute-flavor Id") @PathParam
125                       ("computeFlavorId")
126                       String computeFlavorId,
127                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
128                       String user);
129
130   @GET
131   @Path("/{computeFlavorId}/questionnaire")
132   @Operation(description = "Get vendor software product component compute-flavor questionnaire", responses = @ApiResponse(content = @Content(schema = @Schema(implementation =QuestionnaireResponseDto.class))))
133   Response getQuestionnaire(
134       @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
135       @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
136       @Parameter(description = "Vendor software product component Id") @PathParam("componentId")
137           String componentId,
138       @Parameter(description = "Vendor software product compute-flavor Id") @PathParam
139           ("computeFlavorId") String computeId,
140       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
141 }