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.
16 package org.openecomp.sdcrests.vsp.rest;
18 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
19 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
21 import io.swagger.v3.oas.annotations.Operation;
22 import io.swagger.v3.oas.annotations.Parameter;
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;
30 import java.io.IOException;
31 import javax.validation.Valid;
32 import javax.validation.constraints.NotNull;
33 import javax.ws.rs.Consumes;
34 import javax.ws.rs.DELETE;
35 import javax.ws.rs.GET;
36 import javax.ws.rs.HeaderParam;
37 import javax.ws.rs.POST;
38 import javax.ws.rs.PUT;
39 import javax.ws.rs.Path;
40 import javax.ws.rs.PathParam;
41 import javax.ws.rs.Produces;
42 import javax.ws.rs.QueryParam;
43 import javax.ws.rs.core.MediaType;
44 import javax.ws.rs.core.Response;
45 import org.openecomp.sdcrests.item.types.ItemCreationDto;
46 import org.openecomp.sdcrests.vendorsoftwareproducts.types.PackageInfoDto;
47 import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
48 import org.openecomp.sdcrests.vendorsoftwareproducts.types.VersionSoftwareProductActionRequestDto;
49 import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspComputeDto;
50 import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDescriptionDto;
51 import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDetailsDto;
52 import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspRequestDto;
53 import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.IsValidJson;
54 import org.springframework.validation.annotation.Validated;
56 @Path("/v1.0/vendor-software-products")
57 @Produces(MediaType.APPLICATION_JSON)
58 @Consumes(MediaType.APPLICATION_JSON)
59 @Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Vendor Software Products")})
61 public interface VendorSoftwareProducts extends VspEntities {
65 @Operation(description = "Create a new vendor software product", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ItemCreationDto.class))))
66 Response createVsp(@Valid VspRequestDto vspRequestDto, @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
70 @Operation(description = "Get list of vendor software products and their description", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = VspDetailsDto.class)))))
71 Response listVsps(@Parameter(description = "Filter to return only Vendor Software Products with at"
72 + " least one version at this status. Currently supported values: 'Certified' , 'Draft'") @QueryParam("versionFilter") String versionStatus,
73 @Parameter(description = "Filter to only return Vendor Software Products at this status."
74 + "Currently supported values: 'ACTIVE' , 'ARCHIVED'."
75 + "Default value = 'ACTIVE'.") @QueryParam("Status") String itemStatus,
76 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
80 @Parameter(description = "Get details of the latest certified vendor software product")
81 Response getLatestVsp(@PathParam("vspId") String vspId,
82 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
85 @Path("/{vspId}/versions/{versionId}")
86 @Parameter(description = "Get details of a vendor software product")
87 Response getVsp(@PathParam("vspId") String vspId, @PathParam("versionId") String versionId,
88 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
91 @Path("/{vspId}/versions/{versionId}")
92 @Parameter(description = "Update an existing vendor software product")
93 Response updateVsp(@PathParam("vspId") String vspId, @PathParam("versionId") String versionId, @Valid VspDescriptionDto vspDescriptionDto,
94 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
98 @Parameter(description = "Deletes vendor software product by given id")
99 Response deleteVsp(@PathParam("vspId") String vspId, @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
103 @Operation(description = "Get list of translated CSAR files details", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = PackageInfoDto.class)))))
104 Response listPackages(@Parameter(description = "Vendor Software Product status filter. "
105 + "Currently supported values: 'ACTIVE', 'ARCHIVED'") @QueryParam("Status") String status,
106 @Parameter(description = "Category") @QueryParam("category") String category,
107 @Parameter(description = "Sub-category") @QueryParam("subCategory") String subCategory,
108 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
111 @Path("/{vspId}/versions/{versionId}/orchestration-template")
112 @Produces(MediaType.APPLICATION_OCTET_STREAM)
113 @Operation(description = "Get Orchestration Template (HEAT) file", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = File.class))))
114 Response getOrchestrationTemplate(@PathParam("vspId") String vspId, @PathParam("versionId") String versionId,
115 @HeaderParam(USER_ID_HEADER_PARAM) String user);
118 @Path("/validation-vsp")
119 Response getValidationVsp(@NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user) throws Exception;
122 @Path("/{vspId}/versions/{versionId}/actions")
123 @Operation(description = "Actions on a vendor software product", summary = "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 " + "version.|"
125 + "Undo_Checkout: Unlocks it and deletes the edits that were done.|" + "Checkin: Unlocks it and activates the edited version to all users.| "
126 + "Submit: Finalize its active version.|" + "Create_Package: Creates a CSAR zip file.|")
127 Response actOnVendorSoftwareProduct(VersionSoftwareProductActionRequestDto request, @PathParam("vspId") String vspId,
128 @PathParam("versionId") String versionId,
129 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user) throws IOException;
132 @Path("/packages/{vspId}")
133 @Produces(MediaType.APPLICATION_OCTET_STREAM)
134 @Operation(description = "Get translated CSAR file", summary = "Exports translated file to a zip file", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = File.class))))
135 Response getTranslatedFile(@PathParam("vspId") String vspId, @QueryParam("versionId") String versionId,
136 @HeaderParam(USER_ID_HEADER_PARAM) String user);
139 @Path("/{vspId}/versions/{versionId}/questionnaire")
140 @Operation(description = "Get vendor software product questionnaire", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = QuestionnaireResponseDto.class))))
141 Response getQuestionnaire(@PathParam("vspId") String vspId, @PathParam("versionId") String versionId,
142 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
145 @Path("/{vspId}/versions/{versionId}/questionnaire")
146 @Operation(description = "Update vendor software product questionnaire")
147 Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData, @PathParam("vspId") String vspId,
148 @PathParam("versionId") String versionId,
149 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
152 @Path("/{vspId}/versions/{versionId}/heal")
153 @Operation(description = "Checkout and heal vendor software product questionnaire", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = QuestionnaireResponseDto.class))))
154 Response heal(@PathParam("vspId") String vspId, @PathParam("versionId") String versionId,
155 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
158 @Path("/{vspId}/versions/{versionId}/vspInformationArtifact")
159 @Produces(MediaType.TEXT_PLAIN)
160 @Operation(description = "Get vendor software product information artifact for specified version", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = File.class))))
161 Response getVspInformationArtifact(@PathParam("vspId") String vspId, @PathParam("versionId") String versionId,
162 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
165 @Path("/{vspId}/versions/{versionId}/compute-flavors")
166 @Operation(description = "Get list of vendor software product compute-flavors", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = VspComputeDto.class)))))
167 Response listComputes(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
168 @PathParam("versionId") String versionId,
169 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);