2 * Copyright 2017 Huawei Technologies Co., Ltd.
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.
17 package org.openecomp.sdcrests.vsp.rest;
19 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
20 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
23 import javax.validation.constraints.NotNull;
24 import javax.ws.rs.Consumes;
25 import javax.ws.rs.GET;
26 import javax.ws.rs.HeaderParam;
27 import javax.ws.rs.POST;
28 import javax.ws.rs.Path;
29 import javax.ws.rs.PathParam;
30 import javax.ws.rs.Produces;
31 import javax.ws.rs.core.MediaType;
32 import javax.ws.rs.core.Response;
34 import io.swagger.v3.oas.annotations.OpenAPIDefinition;
35 import io.swagger.v3.oas.annotations.Operation;
36 import io.swagger.v3.oas.annotations.Parameter;
37 import io.swagger.v3.oas.annotations.info.Info;
38 import io.swagger.v3.oas.annotations.media.Content;
39 import io.swagger.v3.oas.annotations.media.Schema;
40 import io.swagger.v3.oas.annotations.responses.ApiResponse;
41 import org.openecomp.sdcrests.vendorsoftwareproducts.types.UploadFileResponseDto;
42 import org.springframework.validation.annotation.Validated;
44 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/vnfrepository")
45 @Produces(MediaType.APPLICATION_JSON)
46 @Consumes(MediaType.APPLICATION_JSON)
47 @OpenAPIDefinition(info = @Info(title = "VNF Repository packages"))
49 public interface VnfPackageRepository extends VspEntities {
53 @Produces(MediaType.APPLICATION_OCTET_STREAM)
54 @Operation(description = "Get VNF packages from VNF Repository",
55 summary = "Call VNF Repository to get VNF package details", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = File.class))))
56 Response getVnfPackages(@PathParam("vspId") String vspId,
57 @Parameter(description= "Version Id") @PathParam("versionId") String versionId,
58 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user) throws Exception;
61 @Path("/vnfpackage/{csarId}/download")
62 @Produces(MediaType.APPLICATION_OCTET_STREAM)
63 @Operation(description = "Download VNF package from VNF Repository",
64 summary = "Download VNF package from VNF repository and send to client", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = File.class))))
65 Response downloadVnfPackage(@PathParam("vspId") String vspId,
66 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
67 @PathParam("csarId") String csarId,
68 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user) throws Exception;
71 @Path("/vnfpackage/{csarId}/import")
72 @Produces(MediaType.APPLICATION_JSON)
73 @Operation(description = "Import VNF package from VNF Repository",
74 summary = "Call VNF Repository to download VNF package, validate it and send the response",
75 responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UploadFileResponseDto.class))))
76 Response importVnfPackage(@PathParam("vspId") String vspId,
77 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
78 @PathParam("csarId") String csarId,
79 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user) throws Exception;