push addional 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 static org.openecomp.sdcrests.common.RestConstants.USER_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}/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 {
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 component Id") @PathParam("componentId")
65                     String componentId,
66                 @Pattern(regexp = Version.VERSION_REGEX,
67                     message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
68                     String version,
69                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
70                     String user);
71
72   @POST
73   @Path("/")
74   @ApiOperation(value = "Create a vendor software product NIC")
75   Response create(@Valid NicRequestDto request,
76                   @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
77                   @ApiParam(value = "Vendor software product component Id")
78                   @PathParam("componentId") String componentId,
79                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
80                       String user);
81
82   @GET
83   @Path("/{nicId}")
84   @ApiOperation(value = "Get vendor software product NIC",
85       response = NicDto.class)
86   Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
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                @Pattern(regexp = Version.VERSION_REGEX,
91                    message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
92                    String version,
93                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
94                    String user);
95
96   @DELETE
97   @Path("/{nicId}")
98   @ApiOperation(value = "Delete vendor software product NIC")
99   Response delete(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
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_HEADER_PARAM)
105                       String user);
106
107   @PUT
108   @Path("/{nicId}")
109   @ApiOperation(value = "Update vendor software product NIC")
110   Response update(@Valid NicRequestDto request,
111                   @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
112                   @ApiParam(value = "Vendor software product component Id")
113                   @PathParam("componentId") String componentId,
114                   @ApiParam(value = "Vendor software product NIC Id") @PathParam("nicId")
115                       String nicId,
116                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
117                       String user);
118
119   @GET
120   @Path("/{nicId}/questionnaire")
121   @ApiOperation(value = "Get vendor software product component NIC questionnaire",
122       response = QuestionnaireResponseDto.class)
123   Response getQuestionnaire(
124       @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
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       @Pattern(regexp = Version.VERSION_REGEX, message = Version.VERSION_STRING_VIOLATION_MSG)
129       @QueryParam("version") String version,
130       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
131
132   @PUT
133   @Path("/{nicId}/questionnaire")
134   @ApiOperation(value = "Update vendor software product component NIC questionnaire")
135   Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
136                                @ApiParam(value = "Vendor software product Id") @PathParam("vspId")
137                                    String vspId,
138                                @ApiParam(value = "Vendor software product component Id")
139                                @PathParam("componentId") String componentId,
140                                @ApiParam(value = "Vendor software product NIC Id")
141                                @PathParam("nicId") String nicId,
142                                @NotNull(message = USER_MISSING_ERROR_MSG)
143                                @HeaderParam(USER_HEADER_PARAM) String user);
144 }