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