Add collaboration feature
[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.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;
25
26 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
27 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
28
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")
33 @Validated
34 public interface Images extends VspEntities {
35
36   @GET
37   @Path("/")
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")
44                     String componentId,
45                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
46                     String user);
47
48   @POST
49   @Path("/")
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)
57                       String user);
58
59   @GET
60   @Path("/schema")
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")
64                               String 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);
70
71   /*@GET
72   @Path("/{imageId}")
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")
78                    String componentId,
79                @ApiParam(value = "Vendor software product image Id") @PathParam("imageId")
80                    String imageId,
81                @Pattern(regexp = Version.VERSION_REGEX,
82                    message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
83                    String version,
84                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
85                    String user);*/
86
87   @GET
88   @Path("/{imageId}")
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")
95                    String componentId,
96                @ApiParam(value = "Vendor software product Image Id") @PathParam
97                    ("imageId")
98                    String imageId,
99                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
100                    String user);
101
102   @DELETE
103   @Path("/{imageId}")
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")
110                       String imageId,
111                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
112                       String user);
113
114   @PUT
115   @Path("/{imageId}")
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")
123                       String imageId,
124                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
125                       String user);
126
127   @PUT
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);
141
142   @GET
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")
150           String 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);
154 }