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.ImageDto;
33 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageRequestDto;
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}/images")
48 @Produces(MediaType.APPLICATION_JSON)
49 @Consumes(MediaType.APPLICATION_JSON)
50 @Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Vendor Software Product Images")})
52 public interface Images extends VspEntities {
56 @Operation(description = "List vendor software product component images",responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ImageDto.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)
66 @Operation(description = "Create a vendor software product component image")
67 Response create(@Valid ImageRequestDto request,
68 @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")
71 @PathParam("componentId") String componentId,
72 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
77 //@Operation(description = "Get schema for vendor software product component Image" ,
78 // response = QuestionnaireResponseDto.class)
79 Response getImageSchema(@Parameter(description = "Vendor software product Id") @PathParam("vspId")
81 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
82 @Parameter(description = "Vendor software product component Id")
83 @PathParam("componentId") String componentId,@NotNull
84 (message = USER_MISSING_ERROR_MSG) @HeaderParam
85 (USER_ID_HEADER_PARAM) String user);
89 @Operation(description = "Get vendor software product component Image",
90 response = ImageDto.class,
91 responseContainer = "ImageEntityResponse")
92 Response get(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
93 @Parameter(description = "Vendor software product component Id") @PathParam("componentId")
95 @Parameter(description = "Vendor software product image Id") @PathParam("imageId")
97 @Pattern(regexp = Version.VERSION_REGEX,
98 message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
100 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
105 @Operation(description = "Get vendor software product component Image",responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ImageDto.class))))
106 Response get(@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")
110 @Parameter(description = "Vendor software product Image Id") @PathParam
113 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
118 @Operation(description = "Delete vendor software product Image")
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 Image Id") @PathParam("imageId")
125 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
130 @Operation(description = "Update vendor software product Image")
131 Response update(@Valid ImageRequestDto request,
132 @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
133 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
134 @Parameter(description = "Vendor software product component Id")
135 @PathParam("componentId") String componentId,
136 @Parameter(description = "Vendor software product Image Id") @PathParam("imageId")
138 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
142 @Path("/{imageId}/questionnaire")
143 @Operation(description = "Update vendor software product component image questionnaire")
144 Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
145 @Parameter(description = "Vendor software product Id")
146 @PathParam("vspId") String vspId,
147 @Parameter(description = "Version Id")
148 @PathParam("versionId") String versionId,
149 @Parameter(description = "Vendor software product component Id")
150 @PathParam("componentId") String componentId,
151 @Parameter(description = "Vendor software product image Id")
152 @PathParam ("imageId") String imageId,
153 @NotNull(message = USER_MISSING_ERROR_MSG)
154 @HeaderParam(USER_ID_HEADER_PARAM) String user);
157 @Path("/{imageId}/questionnaire")
158 @Operation(description = "Get vendor software product component image questionnaire", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = QuestionnaireResponseDto.class))))
159 Response getQuestionnaire(
160 @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
161 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
162 @Parameter(description = "Vendor software product component Id") @PathParam("componentId")
164 @Parameter(description = "Vendor software product image Id") @PathParam
165 ("imageId") String imageId,
166 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);