1a16e1f0fbfc2c6d12e87f7874df47e2898bd5b3
[sdc.git] /
1 /*
2  * Copyright 2017 Huawei Technologies Co., Ltd.
3  *
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
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.openecomp.sdcrests.vsp.rest;
18
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;
24
25 import javax.validation.constraints.NotNull;
26 import javax.ws.rs.Consumes;
27 import javax.ws.rs.GET;
28 import javax.ws.rs.HeaderParam;
29 import javax.ws.rs.POST;
30 import javax.ws.rs.Path;
31 import javax.ws.rs.PathParam;
32 import javax.ws.rs.Produces;
33 import javax.ws.rs.core.MediaType;
34 import javax.ws.rs.core.Response;
35 import java.io.File;
36 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
37 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
38
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")
43 @Validated
44 public interface VnfPackageRepository extends VspEntities {
45
46     @GET
47     @Path("/vnfpackages")
48     @Produces(MediaType.APPLICATION_OCTET_STREAM)
49     @ApiOperation(value = "Get VNF packages from VNF Repository", notes = "Call VNF Repostory to get VNF package details", response = File.class)
50     Response getVnfPackages(@PathParam("vspId") String vspId,
51             @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
52             @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user) throws Exception;
53
54     @GET
55     @Path("/vnfpackage/{csarId}/download")
56     @Produces(MediaType.APPLICATION_OCTET_STREAM)
57     @ApiOperation(value = "Download VNF package from VNF Repository", notes = "Download VNF package from VNF repository and send to client", response = File.class)
58     Response downloadVnfPackage(@PathParam("vspId") String vspId,
59             @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
60             @PathParam("csarId") String csarId,
61             @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user) throws Exception;
62
63     @POST
64     @Path("/vnfpackage/{csarId}/import")
65     @Produces(MediaType.APPLICATION_JSON)
66     @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)
67     Response importVnfPackage(@PathParam("vspId") String vspId,
68             @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
69             @PathParam("csarId") String csarId,
70             @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user) throws Exception;
71
72 }