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.sdc.vendorsoftwareproduct.types.composition.ComponentData;
32 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDto;
33 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentRequestDto;
34 import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
35 import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.IsValidJson;
36 import org.springframework.validation.annotation.Validated;
38 import javax.validation.Valid;
39 import javax.validation.constraints.NotNull;
41 import javax.ws.rs.core.MediaType;
42 import javax.ws.rs.core.Response;
44 import java.util.List;
46 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
47 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
49 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/components")
50 @Produces(MediaType.APPLICATION_JSON)
51 @Consumes(MediaType.APPLICATION_JSON)
52 @OpenAPIDefinition(info = @Info(title="Vendor Software Product Components"))
54 public interface Components extends VspEntities {
57 @Operation(description = "List vendor software product components", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ComponentDto.class)))))
58 Response list(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
59 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
60 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
65 @Operation(description = "Delete vendor software product components", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = List.class))))
67 @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
68 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
69 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
73 @Operation(description = "Create a vendor software product component")
74 Response create(@Valid ComponentRequestDto request,
75 @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
76 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
77 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
81 @Path("/{componentId}")
82 @Operation(description = "Get vendor software product component", responses = @ApiResponse(content = @Content(schema = @Schema(implementation =ComponentData.class))))
83 Response get(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
84 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
85 @Parameter(description = "Vendor software product component Id")
86 @PathParam("componentId") String componentId,
87 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
91 @Path("/{componentId}")
92 @Operation(description = "Delete vendor software product component")
93 Response delete(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
94 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
95 @Parameter(description = "Vendor software product component Id")
96 @PathParam("componentId") String componentId,
97 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
101 @Path("/{componentId}")
102 @Operation(description = "Update vendor software product component")
103 Response update(@Valid ComponentRequestDto request,
104 @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
105 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
106 @Parameter(description = "Vendor software product component Id")
107 @PathParam("componentId") String componentId,
108 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
112 @Path("/{componentId}/questionnaire")
113 @Operation(description = "Get vendor software product component questionnaire",responses = @ApiResponse(content = @Content(schema = @Schema(implementation =QuestionnaireResponseDto.class))))
114 Response getQuestionnaire(
115 @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
116 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
117 @Parameter(description = "Vendor software product component Id")
118 @PathParam("componentId") String componentId,
119 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
122 @Path("/{componentId}/questionnaire")
123 @Operation(description = "Update vendor software product component questionnaire")
124 Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
125 @Parameter(description = "Vendor software product Id") @PathParam("vspId")
127 @Parameter(description = "Version Id") @PathParam("versionId")
129 @Parameter(description = "Vendor software product component Id")
130 @PathParam("componentId") String componentId,
131 @NotNull(message = USER_MISSING_ERROR_MSG)
132 @HeaderParam(USER_ID_HEADER_PARAM) String user);