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