2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 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.ComputeDetailsDto;
32 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComputeDto;
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" +
48 @Produces(MediaType.APPLICATION_JSON)
49 @Consumes(MediaType.APPLICATION_JSON)
50 @OpenAPIDefinition(info = @Info(title= "Vendor Software Product Component Compute-flavors"))
52 public interface Compute extends VspEntities {
56 @Operation(description = "Get list of vendor software product component compute-flavors", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation =ComputeDto.class)))))
57 Response list(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
58 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
59 @Parameter(description = "Vendor software product component Id") @PathParam("componentId")
61 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
65 @Path("/{computeFlavorId}")
66 @Operation(description = "Get vendor software product component compute-flavor", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation =ComputeDetailsDto.class)))))
67 Response get(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
68 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
69 @Parameter(description = "Vendor software product component Id") @PathParam("componentId")
71 @Parameter(description = "Vendor software product compute-flavor Id") @PathParam
74 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
79 @Operation(description = "Create a vendor software product component compute-flavor")
80 Response create(@Valid ComputeDetailsDto request,
81 @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
82 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
83 @Parameter(description = "Vendor software product component Id")
84 @PathParam("componentId") String componentId,
85 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
89 @Path("/{computeFlavorId}")
90 @Operation(description = "Update vendor software product component compute-flavor")
91 Response update(@Valid ComputeDetailsDto request,
92 @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
93 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
94 @Parameter(description = "Vendor software product component Id")
95 @PathParam("componentId") String componentId,
96 @Parameter(description = "Vendor software product compute-flavor Id") @PathParam
98 String computeFlavorId,
99 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
103 @Path("/{computeFlavorId}/questionnaire")
104 @Operation(description = "Update vendor software product component compute-flavor questionnaire")
105 Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
106 @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
107 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
108 @Parameter(description = "Vendor software product component Id")
109 @PathParam("componentId") String componentId,
110 @Parameter(description = "Vendor software product compute-flavor Id") @PathParam
112 String computeFlavorId,
113 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
117 @Path("/{computeFlavorId}")
118 @Operation(description = "Delete vendor software product component compute-flavor")
119 Response delete(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
120 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
121 @Parameter(description = "Vendor software product component Id")
122 @PathParam("componentId") String componentId,
123 @Parameter(description = "Vendor software product compute-flavor Id") @PathParam
125 String computeFlavorId,
126 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
130 @Path("/{computeFlavorId}/questionnaire")
131 @Operation(description = "Get vendor software product component compute-flavor questionnaire", responses = @ApiResponse(content = @Content(schema = @Schema(implementation =QuestionnaireResponseDto.class))))
132 Response getQuestionnaire(
133 @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
134 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
135 @Parameter(description = "Vendor software product component Id") @PathParam("componentId")
137 @Parameter(description = "Vendor software product compute-flavor Id") @PathParam
138 ("computeFlavorId") String computeId,
139 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);