push addional code
[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 static org.openecomp.sdcrests.common.RestConstants.USER_HEADER_PARAM;
24 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
25
26 import io.swagger.annotations.Api;
27 import io.swagger.annotations.ApiOperation;
28 import io.swagger.annotations.ApiParam;
29 import org.openecomp.sdc.versioning.dao.types.Version;
30 import org.openecomp.sdcrests.vendorsoftwareproducts.types.NetworkDto;
31 import org.openecomp.sdcrests.vendorsoftwareproducts.types.NetworkRequestDto;
32 import org.springframework.validation.annotation.Validated;
33
34 import javax.validation.Valid;
35 import javax.validation.constraints.NotNull;
36 import javax.validation.constraints.Pattern;
37 import javax.ws.rs.Consumes;
38 import javax.ws.rs.DELETE;
39 import javax.ws.rs.GET;
40 import javax.ws.rs.HeaderParam;
41 import javax.ws.rs.POST;
42 import javax.ws.rs.PUT;
43 import javax.ws.rs.Path;
44 import javax.ws.rs.PathParam;
45 import javax.ws.rs.Produces;
46 import javax.ws.rs.QueryParam;
47 import javax.ws.rs.core.MediaType;
48 import javax.ws.rs.core.Response;
49
50 @Path("/v1.0/vendor-software-products/{vspId}/networks")
51 @Produces(MediaType.APPLICATION_JSON)
52 @Consumes(MediaType.APPLICATION_JSON)
53 @Api(value = "Vendor Software Product Networks")
54 @Validated
55 public interface Networks {
56   @GET
57   @Path("/")
58   @ApiOperation(value = "List vendor software product networks",
59       response = NetworkDto.class,
60       responseContainer = "List")
61   Response list(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
62                 @Pattern(regexp = Version.VERSION_REGEX,
63                     message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
64                     String version,
65                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
66                     String user);
67
68   @POST
69   @Path("/")
70   @ApiOperation(value = "Create a vendor software product network")
71   Response create(@Valid NetworkRequestDto request,
72                   @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
73                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
74                       String user);
75
76   @GET
77   @Path("/{networkId}")
78   @ApiOperation(value = "Get vendor software product network",
79       response = NetworkDto.class)
80   Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
81                @ApiParam(value = "Vendor software product network Id") @PathParam("networkId")
82                    String networkId,
83                @Pattern(regexp = Version.VERSION_REGEX,
84                    message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
85                    String version,
86                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
87                    String user);
88
89   @DELETE
90   @Path("/{networkId}")
91   @ApiOperation(value = "Delete vendor software product network")
92   Response delete(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
93                   @ApiParam(value = "Vendor software product network Id") @PathParam("networkId")
94                       String networkId,
95                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
96                       String user);
97
98   @PUT
99   @Path("/{networkId}")
100   @ApiOperation(value = "Update vendor software product network")
101   Response update(@Valid NetworkRequestDto request,
102                   @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
103                   @ApiParam(value = "Vendor software product network Id") @PathParam("networkId")
104                       String networkId,
105                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
106                       String user);
107 }