Publish swagger files for SDC APIs
[sdc.git] / openecomp-be / api / openecomp-sdc-rest-webapp / vendor-software-products-rest / vendor-software-products-rest-services / src / main / java / org / openecomp / sdcrests / vsp / rest / Networks.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdcrests.vsp.rest;
22
23 import io.swagger.v3.oas.annotations.Operation;
24 import io.swagger.v3.oas.annotations.Parameter;
25 import io.swagger.v3.oas.annotations.info.Info;
26 import io.swagger.v3.oas.annotations.media.ArraySchema;
27 import io.swagger.v3.oas.annotations.media.Content;
28 import io.swagger.v3.oas.annotations.media.Schema;
29 import io.swagger.v3.oas.annotations.responses.ApiResponse;
30 import io.swagger.v3.oas.annotations.tags.Tag;
31 import io.swagger.v3.oas.annotations.tags.Tags;
32 import org.openecomp.sdcrests.vendorsoftwareproducts.types.NetworkDto;
33 import org.openecomp.sdcrests.vendorsoftwareproducts.types.NetworkRequestDto;
34 import org.springframework.validation.annotation.Validated;
35
36 import javax.validation.Valid;
37 import javax.validation.constraints.NotNull;
38 import javax.ws.rs.*;
39 import javax.ws.rs.core.MediaType;
40 import javax.ws.rs.core.Response;
41
42 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
43 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
44
45 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/networks")
46 @Produces(MediaType.APPLICATION_JSON)
47 @Consumes(MediaType.APPLICATION_JSON)
48 @Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Vendor Software Product Networks")})
49 @Validated
50 public interface Networks extends VspEntities {
51   @GET
52   @Path("/")
53   @Operation(description = "List vendor software product networks",responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = NetworkDto.class)))))
54   Response list(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
55                 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
56                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
57                     String user);
58
59   @POST
60   @Path("/")
61   @Operation(description = "Create a vendor software product network")
62   Response create(@Valid NetworkRequestDto request,
63                   @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
64                   @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
65                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
66                       String user);
67
68   @GET
69   @Path("/{networkId}")
70   @Operation(description = "Get vendor software product network",responses = @ApiResponse(content = @Content(schema = @Schema(implementation = NetworkDto.class))))
71   Response get(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
72                @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
73                @Parameter(description = "Vendor software product network Id")
74                @PathParam("networkId") String networkId,
75                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
76                    String user);
77
78   @DELETE
79   @Path("/{networkId}")
80   @Operation(description = "Delete vendor software product network")
81   Response delete(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
82                   @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
83                   @Parameter(description = "Vendor software product network Id") @PathParam("networkId")
84                       String networkId,
85                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
86                       String user);
87
88   @PUT
89   @Path("/{networkId}")
90   @Operation(description = "Update vendor software product network")
91   Response update(@Valid NetworkRequestDto request,
92                   @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
93                   @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
94                   @Parameter(description = "Vendor software product network Id") @PathParam("networkId")
95                       String networkId,
96                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
97                       String user);
98 }