Migrated VNF to JAX-RS HTTP client
[sdc.git] / openecomp-be / api / openecomp-sdc-rest-webapp / vendor-software-products-rest / vnf-repository-rest-services / src / main / java / org / openecomp / sdcrests / vsp / rest / VnfPackageRepository.java
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 static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
20 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
21
22 import io.swagger.annotations.Api;
23 import io.swagger.annotations.ApiOperation;
24 import io.swagger.annotations.ApiParam;
25 import java.io.File;
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;
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",
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;
54
55     @GET
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;
64
65     @POST
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;
75
76 }