1 package org.openecomp.sdcrests.vsp.rest;
3 import io.swagger.annotations.Api;
4 import io.swagger.annotations.ApiOperation;
5 import io.swagger.annotations.ApiParam;
6 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageDto;
7 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageRequestDto;
8 import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
9 import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.IsValidJson;
10 import org.springframework.validation.annotation.Validated;
12 import javax.validation.Valid;
13 import javax.validation.constraints.NotNull;
14 import javax.ws.rs.Consumes;
15 import javax.ws.rs.DELETE;
16 import javax.ws.rs.GET;
17 import javax.ws.rs.HeaderParam;
18 import javax.ws.rs.POST;
19 import javax.ws.rs.PUT;
20 import javax.ws.rs.Path;
21 import javax.ws.rs.PathParam;
22 import javax.ws.rs.Produces;
23 import javax.ws.rs.core.MediaType;
24 import javax.ws.rs.core.Response;
26 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
27 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
29 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/components/{componentId}/images")
30 @Produces(MediaType.APPLICATION_JSON)
31 @Consumes(MediaType.APPLICATION_JSON)
32 @Api(value = "Vendor Software Product Images")
34 public interface Images extends VspEntities {
38 @ApiOperation(value = "List vendor software product component images",
39 response = ImageDto.class,
40 responseContainer = "List")
41 Response list(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
42 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
43 @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
45 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
50 @ApiOperation(value = "Create a vendor software product component image")
51 Response create(@Valid ImageRequestDto request,
52 @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
53 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
54 @ApiParam(value = "Vendor software product component Id")
55 @PathParam("componentId") String componentId,
56 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
61 //@ApiOperation(value = "Get schema for vendor software product component Image" ,
62 // response = QuestionnaireResponseDto.class)
63 Response getImageSchema(@ApiParam(value = "Vendor software product Id") @PathParam("vspId")
65 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
66 @ApiParam(value = "Vendor software product component Id")
67 @PathParam("componentId") String componentId,@NotNull
68 (message = USER_MISSING_ERROR_MSG) @HeaderParam
69 (USER_ID_HEADER_PARAM) String user);
73 @ApiOperation(value = "Get vendor software product component Image",
74 response = ImageDto.class,
75 responseContainer = "ImageEntityResponse")
76 Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
77 @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
79 @ApiParam(value = "Vendor software product image Id") @PathParam("imageId")
81 @Pattern(regexp = Version.VERSION_REGEX,
82 message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
84 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
89 @ApiOperation(value = "Get vendor software product component Image",
90 response = ImageDto.class,
91 responseContainer = "CompositionEntityResponse")
92 Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
93 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
94 @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
96 @ApiParam(value = "Vendor software product Image Id") @PathParam
99 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
104 @ApiOperation(value = "Delete vendor software product Image")
105 Response delete(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
106 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
107 @ApiParam(value = "Vendor software product component Id")
108 @PathParam("componentId") String componentId,
109 @ApiParam(value = "Vendor software product Image Id") @PathParam("imageId")
111 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
116 @ApiOperation(value = "Update vendor software product Image")
117 Response update(@Valid ImageRequestDto request,
118 @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
119 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
120 @ApiParam(value = "Vendor software product component Id")
121 @PathParam("componentId") String componentId,
122 @ApiParam(value = "Vendor software product Image Id") @PathParam("imageId")
124 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
128 @Path("/{imageId}/questionnaire")
129 @ApiOperation(value = "Update vendor software product component image questionnaire")
130 Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
131 @ApiParam(value = "Vendor software product Id")
132 @PathParam("vspId") String vspId,
133 @ApiParam(value = "Version Id")
134 @PathParam("versionId") String versionId,
135 @ApiParam(value = "Vendor software product component Id")
136 @PathParam("componentId") String componentId,
137 @ApiParam(value = "Vendor software product image Id")
138 @PathParam ("imageId") String imageId,
139 @NotNull(message = USER_MISSING_ERROR_MSG)
140 @HeaderParam(USER_ID_HEADER_PARAM) String user);
143 @Path("/{imageId}/questionnaire")
144 @ApiOperation(value = "Get vendor software product component image questionnaire",
145 response = QuestionnaireResponseDto.class)
146 Response getQuestionnaire(
147 @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
148 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
149 @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
151 @ApiParam(value = "Vendor software product image Id") @PathParam
152 ("imageId") String imageId,
153 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);