2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.sdcrests.vsp.rest;
23 import io.swagger.annotations.Api;
24 import io.swagger.annotations.ApiOperation;
25 import io.swagger.annotations.ApiParam;
26 import org.openecomp.sdcrests.item.types.ItemCreationDto;
27 import org.openecomp.sdcrests.vendorsoftwareproducts.types.PackageInfoDto;
28 import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
29 import org.openecomp.sdcrests.vendorsoftwareproducts.types.VersionSoftwareProductActionRequestDto;
30 import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspComputeDto;
31 import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDescriptionDto;
32 import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspRequestDto;
33 import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.IsValidJson;
34 import org.springframework.validation.annotation.Validated;
36 import javax.validation.Valid;
37 import javax.validation.constraints.NotNull;
38 import javax.ws.rs.Consumes;
39 import javax.ws.rs.DELETE;
40 import javax.ws.rs.GET;
41 import javax.ws.rs.HeaderParam;
42 import javax.ws.rs.POST;
43 import javax.ws.rs.PUT;
44 import javax.ws.rs.Path;
45 import javax.ws.rs.PathParam;
46 import javax.ws.rs.Produces;
47 import javax.ws.rs.QueryParam;
48 import javax.ws.rs.core.MediaType;
49 import javax.ws.rs.core.Response;
51 import java.io.IOException;
53 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
54 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
56 @Path("/v1.0/vendor-software-products")
57 @Produces(MediaType.APPLICATION_JSON)
58 @Consumes(MediaType.APPLICATION_JSON)
59 @Api(value = "Vendor Software Products")
61 public interface VendorSoftwareProducts extends VspEntities {
65 @ApiOperation(value = "Create a new vendor software product",
66 response = ItemCreationDto.class)
67 Response createVsp(@Valid VspRequestDto vspRequestDto,
68 @NotNull(message = USER_MISSING_ERROR_MSG)
69 @HeaderParam(USER_ID_HEADER_PARAM) String user);
73 @ApiOperation(value = "Get list of vendor software products and their description",
74 responseContainer = "List")
75 Response listVsps(@ApiParam(
76 value = "Currently supported values: 'Certified' - only vendor software products with final "
77 + " version will be return - with their latest final version")
78 @QueryParam("versionFilter") String versionStatus,
79 @NotNull(message = USER_MISSING_ERROR_MSG)
80 @HeaderParam(USER_ID_HEADER_PARAM) String user);
83 @Path("/{vspId}/versions/{versionId}")
84 @ApiOperation(value = "Get details of a vendor software product")
85 Response getVsp(@PathParam("vspId") String vspId,
86 @PathParam("versionId") String versionId,
87 @NotNull(message = USER_MISSING_ERROR_MSG)
88 @HeaderParam(USER_ID_HEADER_PARAM) String user);
91 @Path("/{vspId}/versions/{versionId}")
92 @ApiOperation(value = "Update an existing vendor software product")
93 Response updateVsp(@PathParam("vspId") String vspId,
94 @PathParam("versionId") String versionId,
95 @Valid VspDescriptionDto vspDescriptionDto,
96 @NotNull(message = USER_MISSING_ERROR_MSG)
97 @HeaderParam(USER_ID_HEADER_PARAM) String user);
101 @ApiOperation(value = "Deletes vendor software product by given id")
102 Response deleteVsp(@PathParam("vspId") String vspId,
103 @NotNull(message = USER_MISSING_ERROR_MSG)
104 @HeaderParam(USER_ID_HEADER_PARAM) String user);
108 @ApiOperation(value = "Get list of translated CSAR files details",
109 response = PackageInfoDto.class,
110 responseContainer = "List")
111 Response listPackages(@ApiParam("Category") @QueryParam("category") String category,
112 @ApiParam("Sub-category") @QueryParam("subCategory") String subCategory,
113 @NotNull(message = USER_MISSING_ERROR_MSG)
114 @HeaderParam(USER_ID_HEADER_PARAM) String user);
117 @Path("/{vspId}/versions/{versionId}/orchestration-template")
118 @Produces(MediaType.APPLICATION_OCTET_STREAM)
119 @ApiOperation(value = "Get Orchestration Template (HEAT) file",
120 notes = "Downloads the latest HEAT package",
121 response = File.class)
122 Response getOrchestrationTemplate(
123 @PathParam("vspId") String vspId,
124 @PathParam("versionId") String versionId,
125 @HeaderParam(USER_ID_HEADER_PARAM) String user);
129 @Path("/validation-vsp")
130 Response getValidationVsp(
131 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user)
135 @Path("/{vspId}/versions/{versionId}/actions")
136 @ApiOperation(value = "Actions on a vendor software product",
137 notes = "Performs one of the following actions on a vendor software product: |"
138 + "Checkout: Locks it for edits by other users. Only the locking user sees the edited "
140 + "Undo_Checkout: Unlocks it and deletes the edits that were done.|"
141 + "Checkin: Unlocks it and activates the edited version to all users.| "
142 + "Submit: Finalize its active version.|"
143 + "Create_Package: Creates a CSAR zip file.|")
144 Response actOnVendorSoftwareProduct(VersionSoftwareProductActionRequestDto request,
145 @PathParam("vspId") String vspId,
146 @PathParam("versionId") String versionId,
147 @NotNull(message = USER_MISSING_ERROR_MSG)
148 @HeaderParam(USER_ID_HEADER_PARAM) String user)
152 @Path("/packages/{vspId}")
153 @Produces(MediaType.APPLICATION_OCTET_STREAM)
154 @ApiOperation(value = "Get translated CSAR file",
155 notes = "Exports translated file to a zip file",
156 response = File.class)
157 Response getTranslatedFile(@PathParam("vspId") String vspId,
158 @QueryParam("versionId") String versionId,
159 @HeaderParam(USER_ID_HEADER_PARAM) String user);
162 @Path("/{vspId}/versions/{versionId}/questionnaire")
163 @ApiOperation(value = "Get vendor software product questionnaire",
164 response = QuestionnaireResponseDto.class)
165 Response getQuestionnaire(@PathParam("vspId") String vspId,
166 @PathParam("versionId") String versionId,
167 @NotNull(message = USER_MISSING_ERROR_MSG)
168 @HeaderParam(USER_ID_HEADER_PARAM) String user);
171 @Path("/{vspId}/versions/{versionId}/questionnaire")
172 @ApiOperation(value = "Update vendor software product questionnaire")
173 Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
174 @PathParam("vspId") String vspId,
175 @PathParam("versionId") String versionId,
176 @NotNull(message = USER_MISSING_ERROR_MSG)
177 @HeaderParam(USER_ID_HEADER_PARAM) String user);
181 @Path("/{vspId}/versions/{versionId}/heal")
182 @ApiOperation(value = "Checkout and heal vendor software product questionnaire",
183 response = QuestionnaireResponseDto.class)
184 Response heal(@PathParam("vspId") String vspId,
185 @PathParam("versionId") String versionId,
186 @NotNull(message = USER_MISSING_ERROR_MSG)
187 @HeaderParam(USER_ID_HEADER_PARAM) String user);
191 @Path("/{vspId}/versions/{versionId}/vspInformationArtifact")
192 @Produces(MediaType.TEXT_PLAIN)
193 @ApiOperation(value = "Get vendor software product information artifact for specified version",
194 response = File.class)
195 Response getVspInformationArtifact(@PathParam("vspId") String vspId,
196 @PathParam("versionId") String versionId,
197 @NotNull(message = USER_MISSING_ERROR_MSG)
198 @HeaderParam(USER_ID_HEADER_PARAM) String user);
201 @Path("/{vspId}/versions/{versionId}/compute-flavors")
202 @ApiOperation(value = "Get list of vendor software product compute-flavors",
203 response = VspComputeDto.class,
204 responseContainer = "List")
205 Response listComputes(@ApiParam(value = "Vendor software product Id")
206 @PathParam("vspId") String vspId,
207 @PathParam("versionId") String versionId,
208 @NotNull(message = USER_MISSING_ERROR_MSG)
209 @HeaderParam(USER_ID_HEADER_PARAM) String user);