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.v3.oas.annotations.Operation;
21 import io.swagger.v3.oas.annotations.Parameter;
22 import io.swagger.v3.oas.annotations.info.Info;
23 import io.swagger.v3.oas.annotations.media.ArraySchema;
24 import io.swagger.v3.oas.annotations.media.Content;
25 import io.swagger.v3.oas.annotations.media.Schema;
26 import io.swagger.v3.oas.annotations.responses.ApiResponse;
27 import io.swagger.v3.oas.annotations.tags.Tag;
28 import io.swagger.v3.oas.annotations.tags.Tags;
29 import org.openecomp.sdcrests.item.types.ItemCreationDto;
30 import org.openecomp.sdcrests.vendorsoftwareproducts.types.*;
31 import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.IsValidJson;
32 import org.springframework.validation.annotation.Validated;
34 import javax.validation.Valid;
35 import javax.validation.constraints.NotNull;
37 import javax.ws.rs.core.MediaType;
38 import javax.ws.rs.core.Response;
40 import java.io.IOException;
41 import java.util.List;
43 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
44 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
46 @Path("/v1.0/vendor-software-products")
47 @Produces(MediaType.APPLICATION_JSON)
48 @Consumes(MediaType.APPLICATION_JSON)
49 @Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Vendor Software Products")})
51 public interface VendorSoftwareProducts extends VspEntities {
55 @Operation(description = "Create a new vendor software product",responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ItemCreationDto.class))))
56 Response createVsp(@Valid VspRequestDto vspRequestDto,
57 @NotNull(message = USER_MISSING_ERROR_MSG)
58 @HeaderParam(USER_ID_HEADER_PARAM) String user);
62 @Operation(description = "Get list of vendor software products and their description",responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = VspDetailsDto.class)))))
63 Response listVsps(@Parameter(description = "Filter to return only Vendor Software Products with at" +
64 " least one version at this status. Currently supported values: 'Certified' , 'Draft'")
65 @QueryParam("versionFilter") String versionStatus,
66 @Parameter(description = "Filter to only return Vendor Software Products at this status." +
67 "Currently supported values: 'ACTIVE' , 'ARCHIVED'." +
68 "Default value = 'ACTIVE'.")
69 @QueryParam("Status") String itemStatus,
70 @NotNull(message = USER_MISSING_ERROR_MSG)
71 @HeaderParam(USER_ID_HEADER_PARAM) String user);
74 @Path("/{vspId}/versions/{versionId}")
75 @Parameter(description = "Get details of a vendor software product")
76 Response getVsp(@PathParam("vspId") String vspId,
77 @PathParam("versionId") String versionId,
78 @NotNull(message = USER_MISSING_ERROR_MSG)
79 @HeaderParam(USER_ID_HEADER_PARAM) String user);
82 @Path("/{vspId}/versions/{versionId}")
83 @Parameter(description = "Update an existing vendor software product")
84 Response updateVsp(@PathParam("vspId") String vspId,
85 @PathParam("versionId") String versionId,
86 @Valid VspDescriptionDto vspDescriptionDto,
87 @NotNull(message = USER_MISSING_ERROR_MSG)
88 @HeaderParam(USER_ID_HEADER_PARAM) String user);
92 @Parameter(description = "Deletes vendor software product by given id")
93 Response deleteVsp(@PathParam("vspId") String vspId,
94 @NotNull(message = USER_MISSING_ERROR_MSG)
95 @HeaderParam(USER_ID_HEADER_PARAM) String user);
99 @Operation(description = "Get list of translated CSAR files details", responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation=PackageInfoDto.class)))))
100 Response listPackages(@Parameter(description = "Vendor Software Product status filter. " +
101 "Currently supported values: 'ACTIVE', 'ARCHIVED'")
102 @QueryParam("Status") String status,
103 @Parameter(description = "Category") @QueryParam("category") String category,
104 @Parameter(description = "Sub-category") @QueryParam("subCategory") String subCategory,
105 @NotNull(message = USER_MISSING_ERROR_MSG)
106 @HeaderParam(USER_ID_HEADER_PARAM) String user);
109 @Path("/{vspId}/versions/{versionId}/orchestration-template")
110 @Produces(MediaType.APPLICATION_OCTET_STREAM)
111 @Operation(description = "Get Orchestration Template (HEAT) file", responses = @ApiResponse(content = @Content(schema = @Schema(implementation=File.class))))
112 Response getOrchestrationTemplate(
113 @PathParam("vspId") String vspId,
114 @PathParam("versionId") String versionId,
115 @HeaderParam(USER_ID_HEADER_PARAM) String user);
119 @Path("/validation-vsp")
120 Response getValidationVsp(
121 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user)
125 @Path("/{vspId}/versions/{versionId}/actions")
126 @Operation(description = "Actions on a vendor software product",
127 summary = "Performs one of the following actions on a vendor software product: |"
128 + "Checkout: Locks it for edits by other users. Only the locking user sees the edited "
130 + "Undo_Checkout: Unlocks it and deletes the edits that were done.|"
131 + "Checkin: Unlocks it and activates the edited version to all users.| "
132 + "Submit: Finalize its active version.|"
133 + "Create_Package: Creates a CSAR zip file.|")
134 Response actOnVendorSoftwareProduct(VersionSoftwareProductActionRequestDto request,
135 @PathParam("vspId") String vspId,
136 @PathParam("versionId") String versionId,
137 @NotNull(message = USER_MISSING_ERROR_MSG)
138 @HeaderParam(USER_ID_HEADER_PARAM) String user)
142 @Path("/packages/{vspId}")
143 @Produces(MediaType.APPLICATION_OCTET_STREAM)
144 @Operation(description = "Get translated CSAR file",
145 summary = "Exports translated file to a zip file", responses = @ApiResponse(content = @Content(schema = @Schema(implementation=File.class))))
146 Response getTranslatedFile(@PathParam("vspId") String vspId,
147 @QueryParam("versionId") String versionId,
148 @HeaderParam(USER_ID_HEADER_PARAM) String user);
151 @Path("/{vspId}/versions/{versionId}/questionnaire")
152 @Operation(description = "Get vendor software product questionnaire", responses = @ApiResponse(content = @Content(schema = @Schema(implementation=QuestionnaireResponseDto.class))))
153 Response getQuestionnaire(@PathParam("vspId") String vspId,
154 @PathParam("versionId") String versionId,
155 @NotNull(message = USER_MISSING_ERROR_MSG)
156 @HeaderParam(USER_ID_HEADER_PARAM) String user);
159 @Path("/{vspId}/versions/{versionId}/questionnaire")
160 @Operation(description = "Update vendor software product questionnaire")
161 Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
162 @PathParam("vspId") String vspId,
163 @PathParam("versionId") String versionId,
164 @NotNull(message = USER_MISSING_ERROR_MSG)
165 @HeaderParam(USER_ID_HEADER_PARAM) String user);
169 @Path("/{vspId}/versions/{versionId}/heal")
170 @Operation(description = "Checkout and heal vendor software product questionnaire",responses = @ApiResponse(content = @Content(schema = @Schema(implementation=QuestionnaireResponseDto.class))))
171 Response heal(@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}/vspInformationArtifact")
179 @Produces(MediaType.TEXT_PLAIN)
180 @Operation(description = "Get vendor software product information artifact for specified version",responses = @ApiResponse(content = @Content(schema = @Schema(implementation=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);
187 @Path("/{vspId}/versions/{versionId}/compute-flavors")
188 @Operation(description = "Get list of vendor software product compute-flavors", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation=VspComputeDto.class)))))
189 Response listComputes(@Parameter(description = "Vendor software product Id")
190 @PathParam("vspId") String vspId,
191 @PathParam("versionId") String versionId,
192 @NotNull(message = USER_MISSING_ERROR_MSG)
193 @HeaderParam(USER_ID_HEADER_PARAM) String user);