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.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.sdcrests.vendorsoftwareproducts.types.ComputeDetailsDto;
33 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComputeDto;
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 static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
45 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
47 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/components/{componentId" +
49 @Produces(MediaType.APPLICATION_JSON)
50 @Consumes(MediaType.APPLICATION_JSON)
51 @Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Vendor Software Product Component Compute-flavors")})
53 public interface Compute extends VspEntities {
57 @Operation(description = "Get list of vendor software product component compute-flavors", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation =ComputeDto.class)))))
58 Response list(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
59 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
60 @Parameter(description = "Vendor software product component Id") @PathParam("componentId")
62 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
66 @Path("/{computeFlavorId}")
67 @Operation(description = "Get vendor software product component compute-flavor", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation =ComputeDetailsDto.class)))))
68 Response get(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
69 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
70 @Parameter(description = "Vendor software product component Id") @PathParam("componentId")
72 @Parameter(description = "Vendor software product compute-flavor Id") @PathParam
75 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
80 @Operation(description = "Create a vendor software product component compute-flavor")
81 Response create(@Valid ComputeDetailsDto request,
82 @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
83 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
84 @Parameter(description = "Vendor software product component Id")
85 @PathParam("componentId") String componentId,
86 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
90 @Path("/{computeFlavorId}")
91 @Operation(description = "Update vendor software product component compute-flavor")
92 Response update(@Valid ComputeDetailsDto request,
93 @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 @Parameter(description = "Vendor software product compute-flavor Id") @PathParam
99 String computeFlavorId,
100 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
104 @Path("/{computeFlavorId}/questionnaire")
105 @Operation(description = "Update vendor software product component compute-flavor questionnaire")
106 Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
107 @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
108 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
109 @Parameter(description = "Vendor software product component Id")
110 @PathParam("componentId") String componentId,
111 @Parameter(description = "Vendor software product compute-flavor Id") @PathParam
113 String computeFlavorId,
114 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
118 @Path("/{computeFlavorId}")
119 @Operation(description = "Delete vendor software product component compute-flavor")
120 Response delete(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
121 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
122 @Parameter(description = "Vendor software product component Id")
123 @PathParam("componentId") String componentId,
124 @Parameter(description = "Vendor software product compute-flavor Id") @PathParam
126 String computeFlavorId,
127 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
131 @Path("/{computeFlavorId}/questionnaire")
132 @Operation(description = "Get vendor software product component compute-flavor questionnaire", responses = @ApiResponse(content = @Content(schema = @Schema(implementation =QuestionnaireResponseDto.class))))
133 Response getQuestionnaire(
134 @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
135 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
136 @Parameter(description = "Vendor software product component Id") @PathParam("componentId")
138 @Parameter(description = "Vendor software product compute-flavor Id") @PathParam
139 ("computeFlavorId") String computeId,
140 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);