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