1 package org.openecomp.sdcrests.vsp.rest;
3 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
4 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
6 import io.swagger.annotations.Api;
7 import io.swagger.annotations.ApiOperation;
8 import io.swagger.annotations.ApiParam;
9 import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
10 import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ImageData;
11 import org.openecomp.sdc.versioning.dao.types.Version;
12 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageDto;
13 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageRequestDto;
14 import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
15 import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.IsValidJson;
16 import org.springframework.validation.annotation.Validated;
18 import javax.validation.Valid;
19 import javax.validation.constraints.NotNull;
20 import javax.validation.constraints.Pattern;
21 import javax.ws.rs.Consumes;
22 import javax.ws.rs.DELETE;
23 import javax.ws.rs.GET;
24 import javax.ws.rs.HeaderParam;
25 import javax.ws.rs.POST;
26 import javax.ws.rs.PUT;
27 import javax.ws.rs.Path;
28 import javax.ws.rs.PathParam;
29 import javax.ws.rs.Produces;
30 import javax.ws.rs.QueryParam;
31 import javax.ws.rs.core.MediaType;
32 import javax.ws.rs.core.Response;
34 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/components/{componentId}/images")
35 @Produces(MediaType.APPLICATION_JSON)
36 @Consumes(MediaType.APPLICATION_JSON)
37 @Api(value = "Vendor Software Product Images")
39 public interface Images extends VspEntities {
43 @ApiOperation(value = "List vendor software product component images",
44 response = ImageDto.class,
45 responseContainer = "List")
46 Response list(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
47 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
48 @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
50 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
55 @ApiOperation(value = "Create a vendor software product component image")
56 Response create(@Valid ImageRequestDto request,
57 @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
58 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
59 @ApiParam(value = "Vendor software product component Id")
60 @PathParam("componentId") String componentId,
61 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
66 //@ApiOperation(value = "Get schema for vendor software product component Image" ,
67 // response = QuestionnaireResponseDto.class)
68 Response getImageSchema(@ApiParam(value = "Vendor software product Id") @PathParam("vspId")
70 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
71 @ApiParam(value = "Vendor software product component Id")
72 @PathParam("componentId") String componentId,@NotNull
73 (message = USER_MISSING_ERROR_MSG) @HeaderParam
74 (USER_ID_HEADER_PARAM) String user);
78 @ApiOperation(value = "Get vendor software product component Image",
79 response = ImageDto.class,
80 responseContainer = "ImageEntityResponse")
81 Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
82 @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
84 @ApiParam(value = "Vendor software product image Id") @PathParam("imageId")
86 @Pattern(regexp = Version.VERSION_REGEX,
87 message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
89 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
94 @ApiOperation(value = "Get vendor software product component Image",
95 response = ImageDto.class,
96 responseContainer = "CompositionEntityResponse")
97 Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
98 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
99 @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
101 @ApiParam(value = "Vendor software product Image Id") @PathParam
104 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
109 @ApiOperation(value = "Delete vendor software product Image")
110 Response delete(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
111 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
112 @ApiParam(value = "Vendor software product component Id")
113 @PathParam("componentId") String componentId,
114 @ApiParam(value = "Vendor software product Image Id") @PathParam("imageId")
116 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
121 @ApiOperation(value = "Update vendor software product Image")
122 Response update(@Valid ImageRequestDto request,
123 @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
124 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
125 @ApiParam(value = "Vendor software product component Id")
126 @PathParam("componentId") String componentId,
127 @ApiParam(value = "Vendor software product Image Id") @PathParam("imageId")
129 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
133 @Path("/{imageId}/questionnaire")
134 @ApiOperation(value = "Update vendor software product component image questionnaire")
135 Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
136 @ApiParam(value = "Vendor software product Id")
137 @PathParam("vspId") String vspId,
138 @ApiParam(value = "Version Id")
139 @PathParam("versionId") String versionId,
140 @ApiParam(value = "Vendor software product component Id")
141 @PathParam("componentId") String componentId,
142 @ApiParam(value = "Vendor software product image Id")
143 @PathParam ("imageId") String imageId,
144 @NotNull(message = USER_MISSING_ERROR_MSG)
145 @HeaderParam(USER_ID_HEADER_PARAM) String user);
148 @Path("/{imageId}/questionnaire")
149 @ApiOperation(value = "Get vendor software product component image questionnaire",
150 response = QuestionnaireResponseDto.class)
151 Response getQuestionnaire(
152 @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
153 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
154 @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
156 @ApiParam(value = "Vendor software product image Id") @PathParam
157 ("imageId") String imageId,
158 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);