[SDC] Onboarding 1710 rebase.
[sdc.git] / openecomp-be / api / openecomp-sdc-rest-webapp / vendor-software-products-rest / vendor-software-products-rest-services / src / main / java / org / openecomp / sdcrests / vsp / rest / Images.java
1 package org.openecomp.sdcrests.vsp.rest;
2
3 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
4 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
5
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;
17
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;
33
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")
38 @Validated
39 public interface Images extends VspEntities {
40
41   @GET
42   @Path("/")
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")
49                     String componentId,
50                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
51                     String user);
52
53   @POST
54   @Path("/")
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)
62                       String user);
63
64   @GET
65   @Path("/schema")
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")
69                               String 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);
75
76   /*@GET
77   @Path("/{imageId}")
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")
83                    String componentId,
84                @ApiParam(value = "Vendor software product image Id") @PathParam("imageId")
85                    String imageId,
86                @Pattern(regexp = Version.VERSION_REGEX,
87                    message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
88                    String version,
89                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
90                    String user);*/
91
92   @GET
93   @Path("/{imageId}")
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")
100                    String componentId,
101                @ApiParam(value = "Vendor software product Image Id") @PathParam
102                    ("imageId")
103                    String imageId,
104                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
105                    String user);
106
107   @DELETE
108   @Path("/{imageId}")
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")
115                       String imageId,
116                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
117                       String user);
118
119   @PUT
120   @Path("/{imageId}")
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")
128                       String imageId,
129                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
130                       String user);
131
132   @PUT
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);
146
147   @GET
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")
155           String 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);
159 }