Added oparent to sdc main
[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 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdcrests.vsp.rest;
22
23 import io.swagger.annotations.Api;
24 import io.swagger.annotations.ApiOperation;
25 import io.swagger.annotations.ApiParam;
26 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageDto;
27 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageRequestDto;
28 import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
29 import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.IsValidJson;
30 import org.springframework.validation.annotation.Validated;
31
32 import javax.validation.Valid;
33 import javax.validation.constraints.NotNull;
34 import javax.ws.rs.*;
35 import javax.ws.rs.core.MediaType;
36 import javax.ws.rs.core.Response;
37
38 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
39 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
40
41 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/components/{componentId}/images")
42 @Produces(MediaType.APPLICATION_JSON)
43 @Consumes(MediaType.APPLICATION_JSON)
44 @Api(value = "Vendor Software Product Images")
45 @Validated
46 public interface Images extends VspEntities {
47
48   @GET
49   @Path("/")
50   @ApiOperation(value = "List vendor software product component images",
51       response = ImageDto.class,
52       responseContainer = "List")
53   Response list(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
54                 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
55                 @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
56                     String componentId,
57                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
58                     String user);
59
60   @POST
61   @Path("/")
62   @ApiOperation(value = "Create a vendor software product component image")
63   Response create(@Valid ImageRequestDto request,
64                   @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
65                   @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
66                   @ApiParam(value = "Vendor software product component Id")
67                   @PathParam("componentId") String componentId,
68                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
69                       String user);
70
71   @GET
72   @Path("/schema")
73   //@ApiOperation(value = "Get schema for vendor software product component Image" ,
74   // response = QuestionnaireResponseDto.class)
75   Response getImageSchema(@ApiParam(value = "Vendor software product Id") @PathParam("vspId")
76                               String vspId,
77                           @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
78                           @ApiParam(value = "Vendor software product component Id")
79                           @PathParam("componentId") String componentId,@NotNull
80                               (message = USER_MISSING_ERROR_MSG) @HeaderParam
81                               (USER_ID_HEADER_PARAM) String user);
82
83   /*@GET
84   @Path("/{imageId}")
85   @ApiOperation(value = "Get vendor software product component Image",
86       response = ImageDto.class,
87       responseContainer = "ImageEntityResponse")
88   Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
89                @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
90                    String componentId,
91                @ApiParam(value = "Vendor software product image Id") @PathParam("imageId")
92                    String imageId,
93                @Pattern(regexp = Version.VERSION_REGEX,
94                    message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
95                    String version,
96                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
97                    String user);*/
98
99   @GET
100   @Path("/{imageId}")
101   @ApiOperation(value = "Get vendor software product component Image",
102       response = ImageDto.class,
103       responseContainer = "CompositionEntityResponse")
104   Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
105                @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
106                @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
107                    String componentId,
108                @ApiParam(value = "Vendor software product Image Id") @PathParam
109                    ("imageId")
110                    String imageId,
111                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
112                    String user);
113
114   @DELETE
115   @Path("/{imageId}")
116   @ApiOperation(value = "Delete vendor software product Image")
117   Response delete(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
118                   @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
119                   @ApiParam(value = "Vendor software product component Id")
120                   @PathParam("componentId") String componentId,
121                   @ApiParam(value = "Vendor software product Image Id") @PathParam("imageId")
122                       String imageId,
123                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
124                       String user);
125
126   @PUT
127   @Path("/{imageId}")
128   @ApiOperation(value = "Update vendor software product Image")
129   Response update(@Valid ImageRequestDto request,
130                   @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
131                   @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
132                   @ApiParam(value = "Vendor software product component Id")
133                   @PathParam("componentId") String componentId,
134                   @ApiParam(value = "Vendor software product Image Id") @PathParam("imageId")
135                       String imageId,
136                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
137                       String user);
138
139   @PUT
140   @Path("/{imageId}/questionnaire")
141   @ApiOperation(value = "Update vendor software product component image questionnaire")
142   Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
143                                @ApiParam(value = "Vendor software product Id")
144                                @PathParam("vspId") String vspId,
145                                @ApiParam(value = "Version Id")
146                                @PathParam("versionId") String versionId,
147                                @ApiParam(value = "Vendor software product component Id")
148                                @PathParam("componentId") String componentId,
149                                @ApiParam(value = "Vendor software product image Id")
150                                @PathParam ("imageId") String imageId,
151                                @NotNull(message = USER_MISSING_ERROR_MSG)
152                                @HeaderParam(USER_ID_HEADER_PARAM) String user);
153
154   @GET
155   @Path("/{imageId}/questionnaire")
156   @ApiOperation(value = "Get vendor software product component image questionnaire",
157       response = QuestionnaireResponseDto.class)
158   Response getQuestionnaire(
159       @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
160       @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
161       @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
162           String componentId,
163       @ApiParam(value = "Vendor software product image Id") @PathParam
164           ("imageId") String imageId,
165       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
166 }