2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.sdcrests.vsp.rest;
23 import static org.openecomp.sdcrests.common.RestConstants.USER_HEADER_PARAM;
24 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
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;
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;
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")
57 public interface Nics {
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")
66 @Pattern(regexp = Version.VERSION_REGEX,
67 message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
69 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
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)
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")
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")
93 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
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")
104 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
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")
116 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
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")
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);
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")
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);