a6c766c74d0fd2424df641bc54dcdab1d278590e
[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.OpenAPIDefinition;
24 import io.swagger.v3.oas.annotations.Operation;
25 import io.swagger.v3.oas.annotations.Parameter;
26 import io.swagger.v3.oas.annotations.info.Info;
27 import io.swagger.v3.oas.annotations.media.ArraySchema;
28 import io.swagger.v3.oas.annotations.media.Content;
29 import io.swagger.v3.oas.annotations.media.Schema;
30 import io.swagger.v3.oas.annotations.responses.ApiResponse;
31 import org.openecomp.sdcrests.vendorsoftwareproducts.types.NetworkDto;
32 import org.openecomp.sdcrests.vendorsoftwareproducts.types.NetworkRequestDto;
33 import org.springframework.validation.annotation.Validated;
34
35 import javax.validation.Valid;
36 import javax.validation.constraints.NotNull;
37 import javax.ws.rs.*;
38 import javax.ws.rs.core.MediaType;
39 import javax.ws.rs.core.Response;
40
41 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
42 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
43
44 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/networks")
45 @Produces(MediaType.APPLICATION_JSON)
46 @Consumes(MediaType.APPLICATION_JSON)
47 @OpenAPIDefinition(info = @Info(title = "Vendor Software Product Networks"))
48 @Validated
49 public interface Networks extends VspEntities {
50   @GET
51   @Path("/")
52   @Operation(description = "List vendor software product networks",responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = NetworkDto.class)))))
53   Response list(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
54                 @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
55                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
56                     String user);
57
58   @POST
59   @Path("/")
60   @Operation(description = "Create a vendor software product network")
61   Response create(@Valid NetworkRequestDto request,
62                   @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
63                   @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
64                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
65                       String user);
66
67   @GET
68   @Path("/{networkId}")
69   @Operation(description = "Get vendor software product network",responses = @ApiResponse(content = @Content(schema = @Schema(implementation = NetworkDto.class))))
70   Response get(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
71                @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
72                @Parameter(description = "Vendor software product network Id")
73                @PathParam("networkId") String networkId,
74                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
75                    String user);
76
77   @DELETE
78   @Path("/{networkId}")
79   @Operation(description = "Delete vendor software product network")
80   Response delete(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
81                   @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
82                   @Parameter(description = "Vendor software product network Id") @PathParam("networkId")
83                       String networkId,
84                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
85                       String user);
86
87   @PUT
88   @Path("/{networkId}")
89   @Operation(description = "Update vendor software product network")
90   Response update(@Valid NetworkRequestDto request,
91                   @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
92                   @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
93                   @Parameter(description = "Vendor software product network Id") @PathParam("networkId")
94                       String networkId,
95                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
96                       String user);
97 }