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 io.swagger.v3.oas.annotations.OpenAPIDefinition;
24 import io.swagger.v3.oas.annotations.Operation;
25 import io.swagger.v3.oas.annotations.Parameter;
26 import io.swagger.v3.oas.annotations.info.Info;
27 import io.swagger.v3.oas.annotations.media.ArraySchema;
28 import io.swagger.v3.oas.annotations.media.Content;
29 import io.swagger.v3.oas.annotations.media.Schema;
30 import io.swagger.v3.oas.annotations.responses.ApiResponse;
31 import org.openecomp.sdcrests.vendorsoftwareproducts.types.NicDto;
32 import org.openecomp.sdcrests.vendorsoftwareproducts.types.NicRequestDto;
33 import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
34 import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.IsValidJson;
35 import org.springframework.validation.annotation.Validated;
37 import javax.validation.Valid;
38 import javax.validation.constraints.NotNull;
40 import javax.ws.rs.core.MediaType;
41 import javax.ws.rs.core.Response;
43 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
44 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
46 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/components/{componentId}/nics")
47 @Produces(MediaType.APPLICATION_JSON)
48 @Consumes(MediaType.APPLICATION_JSON)
49 @OpenAPIDefinition(info = @Info(title="Vendor Software Product Component NICs"))
51 public interface Nics extends VspEntities {
54 @Operation(description = "List vendor software product component NICs",responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = NicDto.class)))))
55 Response list(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
56 @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
57 @Parameter(description = "Vendor software product component Id") @PathParam("componentId")
59 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
64 @Operation(description = "Create a vendor software product NIC")
65 Response create(@Valid NicRequestDto request,
66 @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
67 @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
68 @Parameter(description = "Vendor software product component Id")
69 @PathParam("componentId") String componentId,
70 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
75 @Operation(description = "Get vendor software product NIC", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = NicDto.class))))
76 Response get(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
77 @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
78 @Parameter(description = "Vendor software product component Id") @PathParam("componentId")
80 @Parameter(description = "Vendor software product NIC Id") @PathParam("nicId") String nicId,
81 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
86 @Operation(description = "Delete vendor software product NIC")
87 Response delete(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
88 @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
89 @Parameter(description = "Vendor software product component Id")
90 @PathParam("componentId") String componentId,
91 @Parameter(description = "Vendor software product NIC Id") @PathParam("nicId")
93 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
98 @Operation(description = "Update vendor software product NIC")
99 Response update(@Valid NicRequestDto request,
100 @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
101 @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
102 @Parameter(description = "Vendor software product component Id")
103 @PathParam("componentId") String componentId,
104 @Parameter(description = "Vendor software product NIC Id") @PathParam("nicId")
106 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
110 @Path("/{nicId}/questionnaire")
111 @Operation(description = "Get vendor software product component NIC questionnaire", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = QuestionnaireResponseDto.class))))
112 Response getQuestionnaire(
113 @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
114 @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
115 @Parameter(description = "Vendor software product component Id") @PathParam("componentId")
117 @Parameter(description = "Vendor software product NIC Id") @PathParam("nicId") String nicId,
118 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
121 @Path("/{nicId}/questionnaire")
122 @Operation(description = "Update vendor software product component NIC questionnaire")
123 Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
124 @Parameter(description = "Vendor software product Id") @PathParam("vspId")
126 @Parameter(description = "Vendor software product version Id") @PathParam("versionId") String versionId,
127 @Parameter(description = "Vendor software product component Id")
128 @PathParam("componentId") String componentId,
129 @Parameter(description = "Vendor software product NIC Id")
130 @PathParam("nicId") String nicId,
131 @NotNull(message = USER_MISSING_ERROR_MSG)
132 @HeaderParam(USER_ID_HEADER_PARAM) String user);