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 io.swagger.annotations.Api;
20 import io.swagger.annotations.ApiOperation;
21 import io.swagger.annotations.ApiParam;
22 import org.openecomp.sdcrests.vendorsoftwareproducts.types.UploadFileResponseDto;
23 import org.springframework.validation.annotation.Validated;
25 import javax.validation.constraints.NotNull;
27 import javax.ws.rs.core.MediaType;
28 import javax.ws.rs.core.Response;
31 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
32 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
34 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/vnfrepository")
35 @Produces(MediaType.APPLICATION_JSON)
36 @Consumes(MediaType.APPLICATION_JSON)
37 @Api(value = "VNF Repository packages")
39 public interface VnfPackageRepository extends VspEntities {
43 @Produces(MediaType.APPLICATION_OCTET_STREAM)
44 @ApiOperation(value = "Get VNF packages from VNF Repository", notes = "Call VNF Repostory to get VNF package details", response = File.class)
45 Response getVnfPackages(@PathParam("vspId") String vspId,
46 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
47 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user) throws Exception;
50 @Path("/vnfpackage/{csarId}/download")
51 @Produces(MediaType.APPLICATION_OCTET_STREAM)
52 @ApiOperation(value = "Download VNF package from VNF Repository", notes = "Download VNF package from VNF repository and send to client", response = File.class)
53 Response downloadVnfPackage(@PathParam("vspId") String vspId,
54 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
55 @PathParam("csarId") String csarId,
56 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user) throws Exception;
59 @Path("/vnfpackage/{csarId}/import")
60 @Produces(MediaType.APPLICATION_JSON)
61 @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)
62 Response importVnfPackage(@PathParam("vspId") String vspId,
63 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
64 @PathParam("csarId") String csarId,
65 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user) throws Exception;