re base code
[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 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;
11
12 import javax.validation.Valid;
13 import javax.validation.constraints.NotNull;
14 import javax.ws.rs.*;
15 import javax.ws.rs.core.MediaType;
16 import javax.ws.rs.core.Response;
17
18 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
19 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
20
21 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/components/{componentId}/images")
22 @Produces(MediaType.APPLICATION_JSON)
23 @Consumes(MediaType.APPLICATION_JSON)
24 @Api(value = "Vendor Software Product Images")
25 @Validated
26 public interface Images extends VspEntities {
27
28   @GET
29   @Path("/")
30   @ApiOperation(value = "List vendor software product component images",
31       response = ImageDto.class,
32       responseContainer = "List")
33   Response list(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
34                 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
35                 @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
36                     String componentId,
37                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
38                     String user);
39
40   @POST
41   @Path("/")
42   @ApiOperation(value = "Create a vendor software product component image")
43   Response create(@Valid ImageRequestDto request,
44                   @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
45                   @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
46                   @ApiParam(value = "Vendor software product component Id")
47                   @PathParam("componentId") String componentId,
48                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
49                       String user);
50
51   @GET
52   @Path("/schema")
53   //@ApiOperation(value = "Get schema for vendor software product component Image" ,
54   // response = QuestionnaireResponseDto.class)
55   Response getImageSchema(@ApiParam(value = "Vendor software product Id") @PathParam("vspId")
56                               String vspId,
57                           @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
58                           @ApiParam(value = "Vendor software product component Id")
59                           @PathParam("componentId") String componentId,@NotNull
60                               (message = USER_MISSING_ERROR_MSG) @HeaderParam
61                               (USER_ID_HEADER_PARAM) String user);
62
63   /*@GET
64   @Path("/{imageId}")
65   @ApiOperation(value = "Get vendor software product component Image",
66       response = ImageDto.class,
67       responseContainer = "ImageEntityResponse")
68   Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
69                @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
70                    String componentId,
71                @ApiParam(value = "Vendor software product image Id") @PathParam("imageId")
72                    String imageId,
73                @Pattern(regexp = Version.VERSION_REGEX,
74                    message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
75                    String version,
76                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
77                    String user);*/
78
79   @GET
80   @Path("/{imageId}")
81   @ApiOperation(value = "Get vendor software product component Image",
82       response = ImageDto.class,
83       responseContainer = "CompositionEntityResponse")
84   Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
85                @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
86                @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
87                    String componentId,
88                @ApiParam(value = "Vendor software product Image Id") @PathParam
89                    ("imageId")
90                    String imageId,
91                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
92                    String user);
93
94   @DELETE
95   @Path("/{imageId}")
96   @ApiOperation(value = "Delete vendor software product Image")
97   Response delete(@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")
100                   @PathParam("componentId") String componentId,
101                   @ApiParam(value = "Vendor software product Image Id") @PathParam("imageId")
102                       String imageId,
103                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
104                       String user);
105
106   @PUT
107   @Path("/{imageId}")
108   @ApiOperation(value = "Update vendor software product Image")
109   Response update(@Valid ImageRequestDto request,
110                   @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}/questionnaire")
121   @ApiOperation(value = "Update vendor software product component image questionnaire")
122   Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
123                                @ApiParam(value = "Vendor software product Id")
124                                @PathParam("vspId") String vspId,
125                                @ApiParam(value = "Version Id")
126                                @PathParam("versionId") String versionId,
127                                @ApiParam(value = "Vendor software product component Id")
128                                @PathParam("componentId") String componentId,
129                                @ApiParam(value = "Vendor software product image Id")
130                                @PathParam ("imageId") String imageId,
131                                @NotNull(message = USER_MISSING_ERROR_MSG)
132                                @HeaderParam(USER_ID_HEADER_PARAM) String user);
133
134   @GET
135   @Path("/{imageId}/questionnaire")
136   @ApiOperation(value = "Get vendor software product component image questionnaire",
137       response = QuestionnaireResponseDto.class)
138   Response getQuestionnaire(
139       @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
140       @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
141       @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
142           String componentId,
143       @ApiParam(value = "Vendor software product image Id") @PathParam
144           ("imageId") String imageId,
145       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
146 }