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.annotations.Api;
24 import io.swagger.annotations.ApiOperation;
25 import io.swagger.annotations.ApiParam;
26 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageDto;
27 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageRequestDto;
28 import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
29 import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.IsValidJson;
30 import org.springframework.validation.annotation.Validated;
32 import javax.validation.Valid;
33 import javax.validation.constraints.NotNull;
35 import javax.ws.rs.core.MediaType;
36 import javax.ws.rs.core.Response;
38 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
39 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
41 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/components/{componentId}/images")
42 @Produces(MediaType.APPLICATION_JSON)
43 @Consumes(MediaType.APPLICATION_JSON)
44 @Api(value = "Vendor Software Product Images")
46 public interface Images extends VspEntities {
50 @ApiOperation(value = "List vendor software product component images",
51 response = ImageDto.class,
52 responseContainer = "List")
53 Response list(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
54 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
55 @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
57 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
62 @ApiOperation(value = "Create a vendor software product component image")
63 Response create(@Valid ImageRequestDto request,
64 @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
65 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
66 @ApiParam(value = "Vendor software product component Id")
67 @PathParam("componentId") String componentId,
68 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
73 //@ApiOperation(value = "Get schema for vendor software product component Image" ,
74 // response = QuestionnaireResponseDto.class)
75 Response getImageSchema(@ApiParam(value = "Vendor software product Id") @PathParam("vspId")
77 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
78 @ApiParam(value = "Vendor software product component Id")
79 @PathParam("componentId") String componentId,@NotNull
80 (message = USER_MISSING_ERROR_MSG) @HeaderParam
81 (USER_ID_HEADER_PARAM) String user);
85 @ApiOperation(value = "Get vendor software product component Image",
86 response = ImageDto.class,
87 responseContainer = "ImageEntityResponse")
88 Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
89 @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
91 @ApiParam(value = "Vendor software product image Id") @PathParam("imageId")
93 @Pattern(regexp = Version.VERSION_REGEX,
94 message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
96 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
101 @ApiOperation(value = "Get vendor software product component Image",
102 response = ImageDto.class,
103 responseContainer = "CompositionEntityResponse")
104 Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
105 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
106 @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
108 @ApiParam(value = "Vendor software product Image Id") @PathParam
111 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
116 @ApiOperation(value = "Delete vendor software product Image")
117 Response delete(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
118 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
119 @ApiParam(value = "Vendor software product component Id")
120 @PathParam("componentId") String componentId,
121 @ApiParam(value = "Vendor software product Image Id") @PathParam("imageId")
123 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
128 @ApiOperation(value = "Update vendor software product Image")
129 Response update(@Valid ImageRequestDto request,
130 @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
131 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
132 @ApiParam(value = "Vendor software product component Id")
133 @PathParam("componentId") String componentId,
134 @ApiParam(value = "Vendor software product Image Id") @PathParam("imageId")
136 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
140 @Path("/{imageId}/questionnaire")
141 @ApiOperation(value = "Update vendor software product component image questionnaire")
142 Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
143 @ApiParam(value = "Vendor software product Id")
144 @PathParam("vspId") String vspId,
145 @ApiParam(value = "Version Id")
146 @PathParam("versionId") String versionId,
147 @ApiParam(value = "Vendor software product component Id")
148 @PathParam("componentId") String componentId,
149 @ApiParam(value = "Vendor software product image Id")
150 @PathParam ("imageId") String imageId,
151 @NotNull(message = USER_MISSING_ERROR_MSG)
152 @HeaderParam(USER_ID_HEADER_PARAM) String user);
155 @Path("/{imageId}/questionnaire")
156 @ApiOperation(value = "Get vendor software product component image questionnaire",
157 response = QuestionnaireResponseDto.class)
158 Response getQuestionnaire(
159 @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
160 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
161 @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
163 @ApiParam(value = "Vendor software product image Id") @PathParam
164 ("imageId") String imageId,
165 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);