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