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.
16 package org.openecomp.sdcrests.vsp.rest;
18 import io.swagger.annotations.Api;
19 import io.swagger.annotations.ApiOperation;
20 import io.swagger.annotations.ApiParam;
21 import org.openecomp.sdcrests.vendorsoftwareproducts.types.UploadFileResponseDto;
22 import org.springframework.validation.annotation.Validated;
24 import javax.validation.constraints.NotNull;
25 import javax.ws.rs.Consumes;
26 import javax.ws.rs.GET;
27 import javax.ws.rs.HeaderParam;
28 import javax.ws.rs.POST;
29 import javax.ws.rs.Path;
30 import javax.ws.rs.PathParam;
31 import javax.ws.rs.Produces;
32 import javax.ws.rs.core.MediaType;
33 import javax.ws.rs.core.Response;
35 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
36 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
38 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/vnfrepository")
39 @Produces(MediaType.APPLICATION_JSON)
40 @Consumes(MediaType.APPLICATION_JSON)
41 @Api(value = "VNF Repository packages")
43 public interface VnfPackageRepository extends VspEntities {
47 @Produces(MediaType.APPLICATION_OCTET_STREAM)
48 @ApiOperation(value = "Get VNF packages from VNF Repository", notes = "Call VNF Repostory to get VNF package details", response = File.class)
49 Response getVnfPackages(@PathParam("vspId") String vspId,
50 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
51 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user) throws Exception;
54 @Path("/vnfpackage/{csarId}/download")
55 @Produces(MediaType.APPLICATION_OCTET_STREAM)
56 @ApiOperation(value = "Download VNF package from VNF Repository", notes = "Download VNF package from VNF repository and send to client", response = File.class)
57 Response downloadVnfPackage(@PathParam("vspId") String vspId,
58 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
59 @PathParam("csarId") String csarId,
60 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user) throws Exception;
63 @Path("/vnfpackage/{csarId}/import")
64 @Produces(MediaType.APPLICATION_JSON)
65 @ApiOperation(value = "Import VNF package from VNF Repository", notes = "Call VNF Repostory to download VNF package, validate it and send the response", response = UploadFileResponseDto.class)
66 Response importVnfPackage(@PathParam("vspId") String vspId,
67 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
68 @PathParam("csarId") String csarId,
69 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user) throws Exception;