20fe64b88fc5d686e3cd014fdc6d86af09f3a897
[sdc.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 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.PackageInfoDto;
27 import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
28 import org.openecomp.sdcrests.vendorsoftwareproducts.types.VersionSoftwareProductActionRequestDto;
29 import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspComputeDto;
30 import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspCreationDto;
31 import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDescriptionDto;
32 import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.IsValidJson;
33 import org.springframework.validation.annotation.Validated;
34
35 import javax.validation.Valid;
36 import javax.validation.constraints.NotNull;
37 import javax.ws.rs.Consumes;
38 import javax.ws.rs.DELETE;
39 import javax.ws.rs.GET;
40 import javax.ws.rs.HeaderParam;
41 import javax.ws.rs.POST;
42 import javax.ws.rs.PUT;
43 import javax.ws.rs.Path;
44 import javax.ws.rs.PathParam;
45 import javax.ws.rs.Produces;
46 import javax.ws.rs.QueryParam;
47 import javax.ws.rs.core.MediaType;
48 import javax.ws.rs.core.Response;
49 import java.io.File;
50 import java.io.IOException;
51
52 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
53 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
54 @Path("/v1.0/vendor-software-products")
55 @Produces(MediaType.APPLICATION_JSON)
56 @Consumes(MediaType.APPLICATION_JSON)
57 @Api(value = "Vendor Software Products")
58 @Validated
59 public interface VendorSoftwareProducts extends VspEntities {
60
61   @POST
62   @Path("/")
63   @ApiOperation(value = "Create a new vendor software product",
64       response = VspCreationDto.class)
65   Response createVsp(@Valid VspDescriptionDto vspDescriptionDto,
66                      @NotNull(message = USER_MISSING_ERROR_MSG)
67                      @HeaderParam(USER_ID_HEADER_PARAM) String user);
68
69   @GET
70   @Path("/")
71   @ApiOperation(value = "Get list of vendor software products and their description",
72       responseContainer = "List")
73   Response listVsps(@ApiParam(
74       value = "Currently supported values: 'Final' - only vendor software products with final "
75           + " version will be return - with their latest final version")
76                     @QueryParam("versionFilter") String versionFilter,
77                     @NotNull(message = USER_MISSING_ERROR_MSG)
78                     @HeaderParam(USER_ID_HEADER_PARAM) String user);
79
80
81   @GET
82   @Path("/{vspId}/versions/{versionId}")
83   @ApiOperation(value = "Get details of a vendor software product")
84   Response getVsp(@PathParam("vspId") String vspId,
85                   @PathParam("versionId") String versionId,
86                   @NotNull(message = USER_MISSING_ERROR_MSG)
87                   @HeaderParam(USER_ID_HEADER_PARAM) String user);
88
89   @PUT
90   @Path("/{vspId}/versions/{versionId}")
91   @ApiOperation(value = "Update an existing vendor software product")
92   Response updateVsp(@PathParam("vspId") String vspId,
93                      @PathParam("versionId") String versionId,
94                      @Valid VspDescriptionDto vspDescriptionDto,
95                      @NotNull(message = USER_MISSING_ERROR_MSG)
96                      @HeaderParam(USER_ID_HEADER_PARAM) String user);
97
98   @DELETE
99   @Path("/{vspId}")
100   @ApiOperation(value = "Deletes vendor software product by given id")
101   Response deleteVsp(@PathParam("vspId") String vspId,
102                      @NotNull(message = USER_MISSING_ERROR_MSG)
103                      @HeaderParam(USER_ID_HEADER_PARAM) String user);
104
105   @GET
106   @Path("/packages")
107   @ApiOperation(value = "Get list of translated CSAR files details",
108       response = PackageInfoDto.class,
109       responseContainer = "List")
110   Response listPackages(@ApiParam("Category") @QueryParam("category") String category,
111                         @ApiParam("Sub-category") @QueryParam("subCategory") String subCategory,
112                         @NotNull(message = USER_MISSING_ERROR_MSG)
113                         @HeaderParam(USER_ID_HEADER_PARAM) String user);
114
115   @GET
116   @Path("/{vspId}/versions/{versionId}/orchestration-template")
117   @Produces(MediaType.APPLICATION_OCTET_STREAM)
118   @ApiOperation(value = "Get Orchestration Template (HEAT) file",
119       notes = "Downloads the latest HEAT package",
120       response = File.class)
121   Response getOrchestrationTemplate(
122       @PathParam("vspId") String vspId,
123       @PathParam("versionId") String versionId,
124       @HeaderParam(USER_ID_HEADER_PARAM) String user);
125
126
127   @GET
128   @Path("/validation-vsp")
129   Response getValidationVsp(
130       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user)
131       throws Exception;
132
133   @PUT
134   @Path("/{vspId}/versions/{versionId}/actions")
135   @ApiOperation(value = "Actions on a vendor software product",
136       notes = "Performs one of the following actions on a vendor software product: |"
137           + "Checkout: Locks it for edits by other users. Only the locking user sees the edited "
138           + "version.|"
139           + "Undo_Checkout: Unlocks it and deletes the edits that were done.|"
140           + "Checkin: Unlocks it and activates the edited version to all users.| "
141           + "Submit: Finalize its active version.|"
142           + "Create_Package: Creates a CSAR zip file.|")
143   Response actOnVendorSoftwareProduct(@PathParam("vspId") String vspId,
144                                       @PathParam("versionId") String versionId,
145                                       VersionSoftwareProductActionRequestDto request,
146                                       @NotNull(message = USER_MISSING_ERROR_MSG)
147                                       @HeaderParam(USER_ID_HEADER_PARAM) String user)
148       throws IOException;
149
150   @GET
151   @Path("/packages/{vspId}")
152   @Produces(MediaType.APPLICATION_OCTET_STREAM)
153   @ApiOperation(value = "Get translated CSAR file",
154       notes = "Exports translated file to a zip file",
155       response = File.class)
156   Response getTranslatedFile(@PathParam("vspId") String vspId,
157                              @QueryParam("versionId") String versionId,
158                              @HeaderParam(USER_ID_HEADER_PARAM) String user);
159
160   @GET
161   @Path("/{vspId}/versions/{versionId}/questionnaire")
162   @ApiOperation(value = "Get vendor software product questionnaire",
163       response = QuestionnaireResponseDto.class)
164   Response getQuestionnaire(@PathParam("vspId") String vspId,
165                             @PathParam("versionId") String versionId,
166                             @NotNull(message = USER_MISSING_ERROR_MSG)
167                             @HeaderParam(USER_ID_HEADER_PARAM) String user);
168
169   @PUT
170   @Path("/{vspId}/versions/{versionId}/questionnaire")
171   @ApiOperation(value = "Update vendor software product questionnaire")
172   Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
173                                @PathParam("vspId") String vspId,
174                                @PathParam("versionId") String versionId,
175                                @NotNull(message = USER_MISSING_ERROR_MSG)
176                                @HeaderParam(USER_ID_HEADER_PARAM) String user);
177
178
179   @PUT
180   @Path("/{vspId}/versions/{versionId}/heal")
181   @ApiOperation(value = "Checkout and heal vendor software product questionnaire",
182       response = QuestionnaireResponseDto.class)
183   Response heal(@PathParam("vspId") String vspId,
184                 @PathParam("versionId") String versionId,
185                 @NotNull(message = USER_MISSING_ERROR_MSG)
186                 @HeaderParam(USER_ID_HEADER_PARAM) String user);
187
188
189   @GET
190   @Path("/{vspId}/versions/{versionId}/vspInformationArtifact")
191   @Produces(MediaType.TEXT_PLAIN)
192   @ApiOperation(value = "Get vendor software product information artifact for specified version",
193       response = File.class)
194   Response getVspInformationArtifact(@PathParam("vspId") String vspId,
195                                      @PathParam("versionId") String versionId,
196                                      @NotNull(message = USER_MISSING_ERROR_MSG)
197                                      @HeaderParam(USER_ID_HEADER_PARAM) String user);
198
199   @GET
200   @Path("/{vspId}/versions/{versionId}/compute-flavors")
201   @ApiOperation(value = "Get list of vendor software product compute-flavors",
202       response = VspComputeDto.class,
203       responseContainer = "List")
204   Response listCompute(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String
205                            vspId,
206                        @PathParam("versionId") String versionId,
207                        @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
208                            String user);
209
210   @PUT
211   @Path("/reSubmitAll")
212   @ApiOperation(value = "Performs healing ,check out, check in and submit for Network Package " +
213       "Based VSPs",
214       notes
215       = "Please note - only submitted VSPs will be processed")
216   Response reSubmitAll(@NotNull(message = USER_MISSING_ERROR_MSG)
217                        @HeaderParam(USER_ID_HEADER_PARAM) String user) throws IOException;
218 }