83395c8c9ddafacb7123f501a8263ca285484f96
[sdc.git] / openecomp-be / api / openecomp-sdc-rest-webapp / vendor-license-rest / vendor-license-rest-services / src / main / java / org / openecomp / sdcrests / vendorlicense / rest / EntitlementPoolLimits.java
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.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.vendorlicense.types.LimitEntityDto;
32 import org.openecomp.sdcrests.vendorlicense.types.LimitRequestDto;
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(
45     "/v1.0/vendor-license-models/{vlmId}/versions/{versionId}/entitlement-pools/{entitlementPoolId}/limits")
46 @Produces(MediaType.APPLICATION_JSON)
47 @Consumes(MediaType.APPLICATION_JSON)
48 @OpenAPIDefinition(info = @Info(title = "Vendor License Model - Entitlement Pool Limits"))
49 @Validated
50 public interface EntitlementPoolLimits {
51
52   @POST
53   @Path("/")
54   @Operation(description = "Create vendor entitlement pool limits")
55   Response createLimit(@Valid LimitRequestDto request,
56                        @Parameter(description = "Vendor license model Id") @PathParam("vlmId")
57                            String vlmId,
58                        @Parameter(description = "Vendor license model version Id") @PathParam
59                            ("versionId")
60                            String versionId,
61                        @Parameter(description = "Vendor license model Entitlement Pool Id")
62                        @PathParam("entitlementPoolId")
63                            String entitlementPoolId,
64                        @NotNull(message = USER_MISSING_ERROR_MSG)
65                        @HeaderParam(USER_ID_HEADER_PARAM) String user);
66
67
68   @GET
69   @Path("/")
70   @Operation(description = "List vendor entitlement pool limits", responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation = LimitRequestDto.class)))))
71   Response listLimits(
72       @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
73       @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId,
74       @Parameter(description = "Vendor license model Entitlement Pool Id") @PathParam("entitlementPoolId")
75           String entitlementPoolId,
76       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
77
78   @PUT
79   @Path("/{limitId}")
80   @Operation(description = "Update vendor entitlement pool limit")
81   Response updateLimit(@Valid LimitRequestDto request,
82                        @Parameter(description = "Vendor license model Id") @PathParam("vlmId")
83                            String vlmId,
84                        @Parameter(description = "Vendor license model version Id") @PathParam
85                            ("versionId")
86                            String versionId,
87                        @Parameter(description = "Vendor license model Entitlement Pool Id")
88                        @PathParam("entitlementPoolId")
89                            String entitlementPoolId,
90                        @NotNull(message = USER_MISSING_ERROR_MSG)
91                        @PathParam("limitId") String limitId,
92                        @HeaderParam(USER_ID_HEADER_PARAM) String user);
93
94   @GET
95   @Path("/{limitId}")
96   @Operation(description = "Get vendor entitlement pool limit", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = LimitEntityDto.class))))
97   Response getLimit(
98       @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
99       @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId,
100       @Parameter(description = "Vendor license model Entitlement Pool Id") @PathParam
101           ("entitlementPoolId") String entitlementPoolId,
102       @Parameter(description = "Vendor license model Entitlement Pool Limit Id") @PathParam("limitId")
103           String limitId,
104       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
105
106   @DELETE
107   @Path("/{limitId}")
108   @Operation(description = "Delete vendor entitlement pool limit")
109   Response deleteLimit(
110       @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
111       @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId,
112       @Parameter(description = "Vendor license model Entitlement pool Id") @PathParam("entitlementPoolId")
113           String entitlementPoolId,
114       @PathParam("limitId") String limitId,
115       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
116
117 }