0f56c4e5a9d9884aca438d9f3546358b0aa6d1bb
[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.OpenAPIDefinition;
24 import io.swagger.v3.oas.annotations.Operation;
25 import io.swagger.v3.oas.annotations.Parameter;
26 import io.swagger.v3.oas.annotations.info.Info;
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 org.openecomp.sdcrests.vendorsoftwareproducts.types.NicDto;
32 import org.openecomp.sdcrests.vendorsoftwareproducts.types.NicRequestDto;
33 import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
34 import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.IsValidJson;
35 import org.springframework.validation.annotation.Validated;
36
37 import javax.validation.Valid;
38 import javax.validation.constraints.NotNull;
39 import javax.ws.rs.*;
40 import javax.ws.rs.core.MediaType;
41 import javax.ws.rs.core.Response;
42
43 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
44 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
45
46 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/components/{componentId}/nics")
47 @Produces(MediaType.APPLICATION_JSON)
48 @Consumes(MediaType.APPLICATION_JSON)
49 @OpenAPIDefinition(info = @Info(title="Vendor Software Product Component NICs"))
50 @Validated
51 public interface Nics extends VspEntities {
52   @GET
53   @Path("/")
54   @Operation(description = "List vendor software product component NICs",responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = NicDto.class)))))
55   Response list(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
56                 @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
57                 @Parameter(description = "Vendor software product component Id") @PathParam("componentId")
58                     String componentId,
59                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
60                     String user);
61
62   @POST
63   @Path("/")
64   @Operation(description = "Create a vendor software product NIC")
65   Response create(@Valid NicRequestDto request,
66                   @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
67                   @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
68                   @Parameter(description = "Vendor software product component Id")
69                   @PathParam("componentId") String componentId,
70                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
71                       String user);
72
73   @GET
74   @Path("/{nicId}")
75   @Operation(description = "Get vendor software product NIC", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = NicDto.class))))
76   Response get(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
77                @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
78                @Parameter(description = "Vendor software product component Id") @PathParam("componentId")
79                    String componentId,
80                @Parameter(description = "Vendor software product NIC Id") @PathParam("nicId") String nicId,
81                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
82                    String user);
83
84   @DELETE
85   @Path("/{nicId}")
86   @Operation(description = "Delete vendor software product NIC")
87   Response delete(@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")
90                   @PathParam("componentId") String componentId,
91                   @Parameter(description = "Vendor software product NIC Id") @PathParam("nicId")
92                       String nicId,
93                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
94                       String user);
95
96   @PUT
97   @Path("/{nicId}")
98   @Operation(description = "Update vendor software product NIC")
99   Response update(@Valid NicRequestDto request,
100                   @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
101                   @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
102                   @Parameter(description = "Vendor software product component Id")
103                   @PathParam("componentId") String componentId,
104                   @Parameter(description = "Vendor software product NIC Id") @PathParam("nicId")
105                       String nicId,
106                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
107                       String user);
108
109   @GET
110   @Path("/{nicId}/questionnaire")
111   @Operation(description = "Get vendor software product component NIC questionnaire", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = QuestionnaireResponseDto.class))))
112   Response getQuestionnaire(
113       @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
114       @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
115       @Parameter(description = "Vendor software product component Id") @PathParam("componentId")
116           String componentId,
117       @Parameter(description = "Vendor software product NIC Id") @PathParam("nicId") String nicId,
118       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
119
120   @PUT
121   @Path("/{nicId}/questionnaire")
122   @Operation(description = "Update vendor software product component NIC questionnaire")
123   Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
124                                @Parameter(description = "Vendor software product Id") @PathParam("vspId")
125                                    String vspId,
126                                @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
127                                @Parameter(description = "Vendor software product component Id")
128                                @PathParam("componentId") String componentId,
129                                @Parameter(description = "Vendor software product NIC Id")
130                                @PathParam("nicId") String nicId,
131                                @NotNull(message = USER_MISSING_ERROR_MSG)
132                                @HeaderParam(USER_ID_HEADER_PARAM) String user);
133 }