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