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