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 / Nics.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.openecomp.sdcrests.vendorsoftwareproducts.types.NicDto;
33 import org.openecomp.sdcrests.vendorsoftwareproducts.types.NicRequestDto;
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}/nics")
48 @Produces(MediaType.APPLICATION_JSON)
49 @Consumes(MediaType.APPLICATION_JSON)
50 @Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Vendor Software Product Component NICs")})
51 @Validated
52 public interface Nics extends VspEntities {
53   @GET
54   @Path("/")
55   @Operation(description = "List vendor software product component NICs",responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = NicDto.class)))))
56   Response list(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
57                 @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
58                 @Parameter(description = "Vendor software product component Id") @PathParam("componentId")
59                     String componentId,
60                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
61                     String user);
62
63   @POST
64   @Path("/")
65   @Operation(description = "Create a vendor software product NIC")
66   Response create(@Valid NicRequestDto request,
67                   @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
68                   @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
69                   @Parameter(description = "Vendor software product component Id")
70                   @PathParam("componentId") String componentId,
71                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
72                       String user);
73
74   @GET
75   @Path("/{nicId}")
76   @Operation(description = "Get vendor software product NIC", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = NicDto.class))))
77   Response get(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
78                @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
79                @Parameter(description = "Vendor software product component Id") @PathParam("componentId")
80                    String componentId,
81                @Parameter(description = "Vendor software product NIC Id") @PathParam("nicId") String nicId,
82                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
83                    String user);
84
85   @DELETE
86   @Path("/{nicId}")
87   @Operation(description = "Delete vendor software product NIC")
88   Response delete(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
89                   @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
90                   @Parameter(description = "Vendor software product component Id")
91                   @PathParam("componentId") String componentId,
92                   @Parameter(description = "Vendor software product NIC Id") @PathParam("nicId")
93                       String nicId,
94                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
95                       String user);
96
97   @PUT
98   @Path("/{nicId}")
99   @Operation(description = "Update vendor software product NIC")
100   Response update(@Valid NicRequestDto request,
101                   @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 NIC Id") @PathParam("nicId")
106                       String nicId,
107                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
108                       String user);
109
110   @GET
111   @Path("/{nicId}/questionnaire")
112   @Operation(description = "Get vendor software product component NIC questionnaire", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = QuestionnaireResponseDto.class))))
113   Response getQuestionnaire(
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") @PathParam("componentId")
117           String componentId,
118       @Parameter(description = "Vendor software product NIC Id") @PathParam("nicId") String nicId,
119       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
120
121   @PUT
122   @Path("/{nicId}/questionnaire")
123   @Operation(description = "Update vendor software product component NIC questionnaire")
124   Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
125                                @Parameter(description = "Vendor software product Id") @PathParam("vspId")
126                                    String vspId,
127                                @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
128                                @Parameter(description = "Vendor software product component Id")
129                                @PathParam("componentId") String componentId,
130                                @Parameter(description = "Vendor software product NIC Id")
131                                @PathParam("nicId") String nicId,
132                                @NotNull(message = USER_MISSING_ERROR_MSG)
133                                @HeaderParam(USER_ID_HEADER_PARAM) String user);
134 }