740fdfcc3b1f417227fcf4d4a78be2bf4f3a546d
[sdc.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2019 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.vendorlicense.rest;
22
23 import io.swagger.annotations.Api;
24 import io.swagger.annotations.ApiOperation;
25 import io.swagger.annotations.ApiParam;
26 import org.openecomp.sdcrests.vendorlicense.types.LimitEntityDto;
27 import org.openecomp.sdcrests.vendorlicense.types.LimitRequestDto;
28 import org.springframework.validation.annotation.Validated;
29
30 import javax.validation.Valid;
31 import javax.validation.constraints.NotNull;
32 import javax.ws.rs.*;
33 import javax.ws.rs.core.MediaType;
34 import javax.ws.rs.core.Response;
35
36 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
37 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
38
39 @Path(
40     "/v1.0/vendor-license-models/{vlmId}/versions/{versionId}/entitlement-pools/{entitlementPoolId}/limits")
41 @Produces(MediaType.APPLICATION_JSON)
42 @Consumes(MediaType.APPLICATION_JSON)
43 @Api(value = "Vendor License Model - Entitlement Pool Limits")
44 @Validated
45 public interface EntitlementPoolLimits {
46
47   @POST
48   @Path("/")
49   @ApiOperation(value = "Create vendor entitlement pool limits")
50   Response createLimit(@Valid LimitRequestDto request,
51                        @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
52                            String vlmId,
53                        @ApiParam(value = "Vendor license model version Id") @PathParam
54                            ("versionId")
55                            String versionId,
56                        @ApiParam(value = "Vendor license model Entitlement Pool Id")
57                        @PathParam("entitlementPoolId")
58                            String entitlementPoolId,
59                        @NotNull(message = USER_MISSING_ERROR_MSG)
60                        @HeaderParam(USER_ID_HEADER_PARAM) String user);
61
62
63   @GET
64   @Path("/")
65   @ApiOperation(value = "List vendor entitlement pool limits",
66       response = LimitRequestDto.class,
67       responseContainer = "List")
68   Response listLimits(
69       @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
70       @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId,
71       @ApiParam(value = "Vendor license model Entitlement Pool Id") @PathParam("entitlementPoolId")
72           String entitlementPoolId,
73       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
74
75   @PUT
76   @Path("/{limitId}")
77   @ApiOperation(value = "Update vendor entitlement pool limit")
78   Response updateLimit(@Valid LimitRequestDto request,
79                        @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
80                            String vlmId,
81                        @ApiParam(value = "Vendor license model version Id") @PathParam
82                            ("versionId")
83                            String versionId,
84                        @ApiParam(value = "Vendor license model Entitlement Pool Id")
85                        @PathParam("entitlementPoolId")
86                            String entitlementPoolId,
87                        @NotNull(message = USER_MISSING_ERROR_MSG)
88                        @PathParam("limitId") String limitId,
89                        @HeaderParam(USER_ID_HEADER_PARAM) String user);
90
91   @GET
92   @Path("/{limitId}")
93   @ApiOperation(value = "Get vendor entitlement pool limit",
94       response = LimitEntityDto.class)
95   Response getLimit(
96       @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
97       @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId,
98       @ApiParam(value = "Vendor license model Entitlement Pool Id") @PathParam
99           ("entitlementPoolId") String entitlementPoolId,
100       @ApiParam(value = "Vendor license model Entitlement Pool Limit Id") @PathParam("limitId")
101           String limitId,
102       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
103
104   @DELETE
105   @Path("/{limitId}")
106   @ApiOperation(value = "Delete vendor entitlement pool limit")
107   Response deleteLimit(
108       @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
109       @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId,
110       @ApiParam(value = "Vendor license model Entitlement pool Id") @PathParam("entitlementPoolId")
111           String entitlementPoolId,
112       @PathParam("limitId") String limitId,
113       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
114
115 }