2 * Copyright © 2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 package org.openecomp.sdcrests.vsp.rest;
20 import io.swagger.annotations.Api;
21 import io.swagger.annotations.ApiOperation;
22 import io.swagger.annotations.ApiParam;
23 import org.openecomp.sdcrests.item.types.ItemCreationDto;
24 import org.openecomp.sdcrests.vendorsoftwareproducts.types.PackageInfoDto;
25 import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
26 import org.openecomp.sdcrests.vendorsoftwareproducts.types.VersionSoftwareProductActionRequestDto;
27 import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspComputeDto;
28 import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDescriptionDto;
29 import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspRequestDto;
30 import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.IsValidJson;
31 import org.springframework.validation.annotation.Validated;
33 import javax.validation.Valid;
34 import javax.validation.constraints.NotNull;
35 import javax.ws.rs.Consumes;
36 import javax.ws.rs.DELETE;
37 import javax.ws.rs.GET;
38 import javax.ws.rs.HeaderParam;
39 import javax.ws.rs.POST;
40 import javax.ws.rs.PUT;
41 import javax.ws.rs.Path;
42 import javax.ws.rs.PathParam;
43 import javax.ws.rs.Produces;
44 import javax.ws.rs.QueryParam;
45 import javax.ws.rs.core.MediaType;
46 import javax.ws.rs.core.Response;
48 import java.io.IOException;
50 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
51 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
53 @Path("/v1.0/vendor-software-products")
54 @Produces(MediaType.APPLICATION_JSON)
55 @Consumes(MediaType.APPLICATION_JSON)
56 @Api(value = "Vendor Software Products")
58 public interface VendorSoftwareProducts extends VspEntities {
62 @ApiOperation(value = "Create a new vendor software product",
63 response = ItemCreationDto.class)
64 Response createVsp(@Valid VspRequestDto vspRequestDto,
65 @NotNull(message = USER_MISSING_ERROR_MSG)
66 @HeaderParam(USER_ID_HEADER_PARAM) String user);
70 @ApiOperation(value = "Get list of vendor software products and their description",
71 responseContainer = "List")
72 Response listVsps(@ApiParam(
73 value = "Currently supported values: 'Certified' - only vendor software products with final "
74 + " version will be return - with their latest final version")
75 @QueryParam("versionFilter") String versionStatus,
76 @NotNull(message = USER_MISSING_ERROR_MSG)
77 @HeaderParam(USER_ID_HEADER_PARAM) String user);
80 @Path("/{vspId}/versions/{versionId}")
81 @ApiOperation(value = "Get details of a vendor software product")
82 Response getVsp(@PathParam("vspId") String vspId,
83 @PathParam("versionId") String versionId,
84 @NotNull(message = USER_MISSING_ERROR_MSG)
85 @HeaderParam(USER_ID_HEADER_PARAM) String user);
88 @Path("/{vspId}/versions/{versionId}")
89 @ApiOperation(value = "Update an existing vendor software product")
90 Response updateVsp(@PathParam("vspId") String vspId,
91 @PathParam("versionId") String versionId,
92 @Valid VspDescriptionDto vspDescriptionDto,
93 @NotNull(message = USER_MISSING_ERROR_MSG)
94 @HeaderParam(USER_ID_HEADER_PARAM) String user);
98 @ApiOperation(value = "Deletes vendor software product by given id")
99 Response deleteVsp(@PathParam("vspId") String vspId,
100 @NotNull(message = USER_MISSING_ERROR_MSG)
101 @HeaderParam(USER_ID_HEADER_PARAM) String user);
105 @ApiOperation(value = "Get list of translated CSAR files details",
106 response = PackageInfoDto.class,
107 responseContainer = "List")
108 Response listPackages(@ApiParam("Category") @QueryParam("category") String category,
109 @ApiParam("Sub-category") @QueryParam("subCategory") String subCategory,
110 @NotNull(message = USER_MISSING_ERROR_MSG)
111 @HeaderParam(USER_ID_HEADER_PARAM) String user);
114 @Path("/{vspId}/versions/{versionId}/orchestration-template")
115 @Produces(MediaType.APPLICATION_OCTET_STREAM)
116 @ApiOperation(value = "Get Orchestration Template (HEAT) file",
117 notes = "Downloads the latest HEAT package",
118 response = File.class)
119 Response getOrchestrationTemplate(
120 @PathParam("vspId") String vspId,
121 @PathParam("versionId") String versionId,
122 @HeaderParam(USER_ID_HEADER_PARAM) String user);
126 @Path("/validation-vsp")
127 Response getValidationVsp(
128 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user)
132 @Path("/{vspId}/versions/{versionId}/actions")
133 @ApiOperation(value = "Actions on a vendor software product",
134 notes = "Performs one of the following actions on a vendor software product: |"
135 + "Checkout: Locks it for edits by other users. Only the locking user sees the edited "
137 + "Undo_Checkout: Unlocks it and deletes the edits that were done.|"
138 + "Checkin: Unlocks it and activates the edited version to all users.| "
139 + "Submit: Finalize its active version.|"
140 + "Create_Package: Creates a CSAR zip file.|")
141 Response actOnVendorSoftwareProduct(VersionSoftwareProductActionRequestDto request,
142 @PathParam("vspId") String vspId,
143 @PathParam("versionId") String versionId,
144 @NotNull(message = USER_MISSING_ERROR_MSG)
145 @HeaderParam(USER_ID_HEADER_PARAM) String user)
149 @Path("/packages/{vspId}")
150 @Produces(MediaType.APPLICATION_OCTET_STREAM)
151 @ApiOperation(value = "Get translated CSAR file",
152 notes = "Exports translated file to a zip file",
153 response = File.class)
154 Response getTranslatedFile(@PathParam("vspId") String vspId,
155 @QueryParam("versionId") String versionId,
156 @HeaderParam(USER_ID_HEADER_PARAM) String user);
159 @Path("/{vspId}/versions/{versionId}/questionnaire")
160 @ApiOperation(value = "Get vendor software product questionnaire",
161 response = QuestionnaireResponseDto.class)
162 Response getQuestionnaire(@PathParam("vspId") String vspId,
163 @PathParam("versionId") String versionId,
164 @NotNull(message = USER_MISSING_ERROR_MSG)
165 @HeaderParam(USER_ID_HEADER_PARAM) String user);
168 @Path("/{vspId}/versions/{versionId}/questionnaire")
169 @ApiOperation(value = "Update vendor software product questionnaire")
170 Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
171 @PathParam("vspId") String vspId,
172 @PathParam("versionId") String versionId,
173 @NotNull(message = USER_MISSING_ERROR_MSG)
174 @HeaderParam(USER_ID_HEADER_PARAM) String user);
178 @Path("/{vspId}/versions/{versionId}/heal")
179 @ApiOperation(value = "Checkout and heal vendor software product questionnaire",
180 response = QuestionnaireResponseDto.class)
181 Response heal(@PathParam("vspId") String vspId,
182 @PathParam("versionId") String versionId,
183 @NotNull(message = USER_MISSING_ERROR_MSG)
184 @HeaderParam(USER_ID_HEADER_PARAM) String user);
188 @Path("/{vspId}/versions/{versionId}/vspInformationArtifact")
189 @Produces(MediaType.TEXT_PLAIN)
190 @ApiOperation(value = "Get vendor software product information artifact for specified version",
191 response = File.class)
192 Response getVspInformationArtifact(@PathParam("vspId") String vspId,
193 @PathParam("versionId") String versionId,
194 @NotNull(message = USER_MISSING_ERROR_MSG)
195 @HeaderParam(USER_ID_HEADER_PARAM) String user);
198 @Path("/{vspId}/versions/{versionId}/compute-flavors")
199 @ApiOperation(value = "Get list of vendor software product compute-flavors",
200 response = VspComputeDto.class,
201 responseContainer = "List")
202 Response listComputes(@ApiParam(value = "Vendor software product Id")
203 @PathParam("vspId") String vspId,
204 @PathParam("versionId") String versionId,
205 @NotNull(message = USER_MISSING_ERROR_MSG)
206 @HeaderParam(USER_ID_HEADER_PARAM) String user);