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.Operation;
24 import io.swagger.v3.oas.annotations.Parameter;
25 import io.swagger.v3.oas.annotations.info.Info;
26 import io.swagger.v3.oas.annotations.media.ArraySchema;
27 import io.swagger.v3.oas.annotations.media.Content;
28 import io.swagger.v3.oas.annotations.media.Schema;
29 import io.swagger.v3.oas.annotations.responses.ApiResponse;
30 import io.swagger.v3.oas.annotations.tags.Tag;
31 import io.swagger.v3.oas.annotations.tags.Tags;
32 import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData;
33 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDto;
34 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentRequestDto;
35 import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
36 import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.IsValidJson;
37 import org.springframework.validation.annotation.Validated;
39 import javax.validation.Valid;
40 import javax.validation.constraints.NotNull;
42 import javax.ws.rs.core.MediaType;
43 import javax.ws.rs.core.Response;
45 import java.util.List;
47 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
48 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
50 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/components")
51 @Produces(MediaType.APPLICATION_JSON)
52 @Consumes(MediaType.APPLICATION_JSON)
53 @Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Vendor Software Product Components")})
55 public interface Components extends VspEntities {
58 @Operation(description = "List vendor software product components", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ComponentDto.class)))))
59 Response list(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
60 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
61 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
66 @Operation(description = "Delete vendor software product components", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = List.class))))
68 @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
69 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
70 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
74 @Operation(description = "Create a vendor software product component")
75 Response create(@Valid ComponentRequestDto request,
76 @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
77 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
78 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
82 @Path("/{componentId}")
83 @Operation(description = "Get vendor software product component", responses = @ApiResponse(content = @Content(schema = @Schema(implementation =ComponentData.class))))
84 Response get(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
85 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
86 @Parameter(description = "Vendor software product component Id")
87 @PathParam("componentId") String componentId,
88 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
92 @Path("/{componentId}")
93 @Operation(description = "Delete vendor software product component")
94 Response delete(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
95 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
96 @Parameter(description = "Vendor software product component Id")
97 @PathParam("componentId") String componentId,
98 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
102 @Path("/{componentId}")
103 @Operation(description = "Update vendor software product component")
104 Response update(@Valid ComponentRequestDto request,
105 @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
106 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
107 @Parameter(description = "Vendor software product component Id")
108 @PathParam("componentId") String componentId,
109 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
113 @Path("/{componentId}/questionnaire")
114 @Operation(description = "Get vendor software product component questionnaire",responses = @ApiResponse(content = @Content(schema = @Schema(implementation =QuestionnaireResponseDto.class))))
115 Response getQuestionnaire(
116 @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
117 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
118 @Parameter(description = "Vendor software product component Id")
119 @PathParam("componentId") String componentId,
120 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
123 @Path("/{componentId}/questionnaire")
124 @Operation(description = "Update vendor software product component questionnaire")
125 Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
126 @Parameter(description = "Vendor software product Id") @PathParam("vspId")
128 @Parameter(description = "Version Id") @PathParam("versionId")
130 @Parameter(description = "Vendor software product component Id")
131 @PathParam("componentId") String componentId,
132 @NotNull(message = USER_MISSING_ERROR_MSG)
133 @HeaderParam(USER_ID_HEADER_PARAM) String user);