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.vendorsoftwareproducts.types.*;
27 import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.IsValidJson;
28 import org.springframework.validation.annotation.Validated;
30 import javax.validation.Valid;
31 import javax.validation.constraints.NotNull;
33 import javax.ws.rs.core.MediaType;
34 import javax.ws.rs.core.Response;
36 import java.io.IOException;
38 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
39 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
41 @Path("/v1.0/vendor-software-products")
42 @Produces(MediaType.APPLICATION_JSON)
43 @Consumes(MediaType.APPLICATION_JSON)
44 @Api(value = "Vendor Software Products")
46 public interface VendorSoftwareProducts extends VspEntities {
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);
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);
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);
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);
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);
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);
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);
115 @Path("/validation-vsp")
116 Response getValidationVsp(
117 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user)
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 "
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)
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);
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);
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);
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);
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);