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.ImageDto;
32 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageRequestDto;
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}/images")
47 @Produces(MediaType.APPLICATION_JSON)
48 @Consumes(MediaType.APPLICATION_JSON)
49 @OpenAPIDefinition(info = @Info(title = "Vendor Software Product Images"))
51 public interface Images extends VspEntities {
55 @Operation(description = "List vendor software product component images",responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ImageDto.class)))))
56 Response list(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
57 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
58 @Parameter(description = "Vendor software product component Id") @PathParam("componentId")
60 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
65 @Operation(description = "Create a vendor software product component image")
66 Response create(@Valid ImageRequestDto request,
67 @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")
70 @PathParam("componentId") String componentId,
71 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
76 //@Operation(description = "Get schema for vendor software product component Image" ,
77 // response = QuestionnaireResponseDto.class)
78 Response getImageSchema(@Parameter(description = "Vendor software product Id") @PathParam("vspId")
80 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
81 @Parameter(description = "Vendor software product component Id")
82 @PathParam("componentId") String componentId,@NotNull
83 (message = USER_MISSING_ERROR_MSG) @HeaderParam
84 (USER_ID_HEADER_PARAM) String user);
88 @Operation(description = "Get vendor software product component Image",
89 response = ImageDto.class,
90 responseContainer = "ImageEntityResponse")
91 Response get(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
92 @Parameter(description = "Vendor software product component Id") @PathParam("componentId")
94 @Parameter(description = "Vendor software product image Id") @PathParam("imageId")
96 @Pattern(regexp = Version.VERSION_REGEX,
97 message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
99 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
104 @Operation(description = "Get vendor software product component Image",responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ImageDto.class))))
105 Response get(@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") @PathParam("componentId")
109 @Parameter(description = "Vendor software product Image Id") @PathParam
112 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
117 @Operation(description = "Delete vendor software product Image")
118 Response delete(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
119 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
120 @Parameter(description = "Vendor software product component Id")
121 @PathParam("componentId") String componentId,
122 @Parameter(description = "Vendor software product Image Id") @PathParam("imageId")
124 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
129 @Operation(description = "Update vendor software product Image")
130 Response update(@Valid ImageRequestDto request,
131 @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
132 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
133 @Parameter(description = "Vendor software product component Id")
134 @PathParam("componentId") String componentId,
135 @Parameter(description = "Vendor software product Image Id") @PathParam("imageId")
137 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
141 @Path("/{imageId}/questionnaire")
142 @Operation(description = "Update vendor software product component image questionnaire")
143 Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
144 @Parameter(description = "Vendor software product Id")
145 @PathParam("vspId") String vspId,
146 @Parameter(description = "Version Id")
147 @PathParam("versionId") String versionId,
148 @Parameter(description = "Vendor software product component Id")
149 @PathParam("componentId") String componentId,
150 @Parameter(description = "Vendor software product image Id")
151 @PathParam ("imageId") String imageId,
152 @NotNull(message = USER_MISSING_ERROR_MSG)
153 @HeaderParam(USER_ID_HEADER_PARAM) String user);
156 @Path("/{imageId}/questionnaire")
157 @Operation(description = "Get vendor software product component image questionnaire", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = QuestionnaireResponseDto.class))))
158 Response getQuestionnaire(
159 @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
160 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
161 @Parameter(description = "Vendor software product component Id") @PathParam("componentId")
163 @Parameter(description = "Vendor software product image Id") @PathParam
164 ("imageId") String imageId,
165 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);