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=========================================================
20 package org.openecomp.sdcrests.vsp.rest;
22 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
23 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
25 import io.swagger.v3.oas.annotations.Operation;
26 import io.swagger.v3.oas.annotations.Parameter;
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 io.swagger.v3.oas.annotations.tags.Tag;
32 import io.swagger.v3.oas.annotations.tags.Tags;
33 import javax.validation.Valid;
34 import javax.validation.constraints.NotNull;
35 import javax.ws.rs.Consumes;
36 import javax.ws.rs.DELETE;
37 import javax.ws.rs.GET;
38 import javax.ws.rs.HeaderParam;
39 import javax.ws.rs.POST;
40 import javax.ws.rs.PUT;
41 import javax.ws.rs.Path;
42 import javax.ws.rs.PathParam;
43 import javax.ws.rs.Produces;
44 import javax.ws.rs.core.MediaType;
45 import javax.ws.rs.core.Response;
46 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComputeDetailsDto;
47 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComputeDto;
48 import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
49 import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.IsValidJson;
50 import org.springframework.validation.annotation.Validated;
52 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/components/{componentId" + "}/compute-flavors")
53 @Produces(MediaType.APPLICATION_JSON)
54 @Consumes(MediaType.APPLICATION_JSON)
55 @Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Vendor Software Product Component Compute-flavors")})
57 public interface Compute extends VspEntities {
61 @Operation(description = "Get list of vendor software product component compute-flavors", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ComputeDto.class)))))
62 Response list(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
63 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
64 @Parameter(description = "Vendor software product component Id") @PathParam("componentId") String componentId,
65 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
68 @Path("/{computeFlavorId}")
69 @Operation(description = "Get vendor software product component compute-flavor", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ComputeDetailsDto.class)))))
70 Response get(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
71 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
72 @Parameter(description = "Vendor software product component Id") @PathParam("componentId") String componentId,
73 @Parameter(description = "Vendor software product compute-flavor Id") @PathParam("computeFlavorId") String computeId,
74 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
78 @Operation(description = "Create a vendor software product component compute-flavor")
79 Response create(@Valid ComputeDetailsDto request, @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
80 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
81 @Parameter(description = "Vendor software product component Id") @PathParam("componentId") String componentId,
82 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
85 @Path("/{computeFlavorId}")
86 @Operation(description = "Update vendor software product component compute-flavor")
87 Response update(@Valid ComputeDetailsDto request, @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
88 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
89 @Parameter(description = "Vendor software product component Id") @PathParam("componentId") String componentId,
90 @Parameter(description = "Vendor software product compute-flavor Id") @PathParam("computeFlavorId") String computeFlavorId,
91 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
94 @Path("/{computeFlavorId}/questionnaire")
95 @Operation(description = "Update vendor software product component compute-flavor questionnaire")
96 Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
97 @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
98 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
99 @Parameter(description = "Vendor software product component Id") @PathParam("componentId") String componentId,
100 @Parameter(description = "Vendor software product compute-flavor Id") @PathParam("computeFlavorId") String computeFlavorId,
101 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
104 @Path("/{computeFlavorId}")
105 @Operation(description = "Delete vendor software product component compute-flavor")
106 Response delete(@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") @PathParam("componentId") String componentId,
109 @Parameter(description = "Vendor software product compute-flavor Id") @PathParam("computeFlavorId") String computeFlavorId,
110 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
113 @Path("/{computeFlavorId}/questionnaire")
114 @Operation(description = "Get vendor software product component compute-flavor questionnaire", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = QuestionnaireResponseDto.class))))
115 Response getQuestionnaire(@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") @PathParam("componentId") String componentId,
118 @Parameter(description = "Vendor software product compute-flavor Id") @PathParam("computeFlavorId") String computeId,
119 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);