9617c6183640e6fd49e5b698ee4a7e3ae72d959d
[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 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 java.io.File;
23 import javax.validation.constraints.NotNull;
24 import javax.ws.rs.Consumes;
25 import javax.ws.rs.GET;
26 import javax.ws.rs.HeaderParam;
27 import javax.ws.rs.POST;
28 import javax.ws.rs.Path;
29 import javax.ws.rs.PathParam;
30 import javax.ws.rs.Produces;
31 import javax.ws.rs.core.MediaType;
32 import javax.ws.rs.core.Response;
33
34 import io.swagger.v3.oas.annotations.Operation;
35 import io.swagger.v3.oas.annotations.Parameter;
36 import io.swagger.v3.oas.annotations.info.Info;
37 import io.swagger.v3.oas.annotations.media.Content;
38 import io.swagger.v3.oas.annotations.media.Schema;
39 import io.swagger.v3.oas.annotations.responses.ApiResponse;
40 import io.swagger.v3.oas.annotations.tags.Tag;
41 import io.swagger.v3.oas.annotations.tags.Tags;
42 import org.openecomp.sdcrests.vendorsoftwareproducts.types.UploadFileResponseDto;
43 import org.springframework.validation.annotation.Validated;
44
45 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/vnfrepository")
46 @Produces(MediaType.APPLICATION_JSON)
47 @Consumes(MediaType.APPLICATION_JSON)
48 @Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "VNF Repository packages")})
49 @Validated
50 public interface VnfPackageRepository extends VspEntities {
51
52     @GET
53     @Path("/vnfpackages")
54     @Produces(MediaType.APPLICATION_OCTET_STREAM)
55     @Operation(description = "Get VNF packages from VNF Repository",
56             summary = "Call VNF Repository to get VNF package details", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = File.class))))
57     Response getVnfPackages(@PathParam("vspId") String vspId,
58             @Parameter(description= "Version Id") @PathParam("versionId") String versionId,
59             @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user) throws Exception;
60
61     @GET
62     @Path("/vnfpackage/{csarId}/download")
63     @Produces(MediaType.APPLICATION_OCTET_STREAM)
64     @Operation(description = "Download VNF package from VNF Repository",
65             summary = "Download VNF package from VNF repository and send to client", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = File.class))))
66     Response downloadVnfPackage(@PathParam("vspId") String vspId,
67             @Parameter(description = "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;
70
71     @POST
72     @Path("/vnfpackage/{csarId}/import")
73     @Produces(MediaType.APPLICATION_JSON)
74     @Operation(description = "Import VNF package from VNF Repository",
75             summary = "Call VNF Repository to download VNF package, validate it and send the response",
76             responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UploadFileResponseDto.class))))
77     Response importVnfPackage(@PathParam("vspId") String vspId,
78             @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
79             @PathParam("csarId") String csarId,
80             @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user) throws Exception;
81
82 }