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 / EntitlementPools.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.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.EntitlementPoolEntityDto;
33 import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolRequestDto;
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("/v1.0/vendor-license-models/{vlmId}/versions/{versionId}/entitlement-pools")
46 @Produces(MediaType.APPLICATION_JSON)
47 @Consumes(MediaType.APPLICATION_JSON)
48 @Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Vendor License Model - Entitlement Pools")})
49 @Validated
50 public interface EntitlementPools {
51     @GET
52     @Path("/")
53     @Operation(description = "List vendor entitlement pools", responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation = EntitlementPoolEntityDto.class)))))
54     Response listEntitlementPools(
55             @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
56             @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId,
57
58             @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
59
60     @POST
61     @Path("/")
62     @Operation(description = "Create vendor entitlement pool")
63     Response createEntitlementPool(@Valid EntitlementPoolRequestDto request,
64                                    @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
65                                    @Parameter(description = "Vendor license model version Id") @PathParam ("versionId") String versionId,
66                                    @NotNull(message = USER_MISSING_ERROR_MSG)
67                                    @HeaderParam(USER_ID_HEADER_PARAM) String user);
68
69     @PUT
70     @Path("/{entitlementPoolId}")
71     @Operation(description = "Update vendor entitlement pool")
72     Response updateEntitlementPool(@Valid EntitlementPoolRequestDto request,
73                                    @Parameter(description = "Vendor license model Id") @PathParam("vlmId")
74                                            String vlmId,
75                                    @Parameter(description = "Vendor license model version Id")
76                                    @PathParam("versionId") String versionId,
77                                    @NotNull(message = USER_MISSING_ERROR_MSG)
78                                    @PathParam("entitlementPoolId") String entitlementPoolId,
79                                    @HeaderParam(USER_ID_HEADER_PARAM) String user);
80
81     @GET
82     @Path("/{entitlementPoolId}")
83     @Operation(description = "Get vendor entitlement pool", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = EntitlementPoolEntityDto.class))))
84     Response getEntitlementPool(
85             @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
86             @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId,
87             @PathParam("entitlementPoolId") String entitlementPoolId,
88             @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
89
90     @DELETE
91     @Path("/{entitlementPoolId}")
92     @Operation(description = "Delete vendor entitlement pool")
93     Response deleteEntitlementPool(
94             @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
95             @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId,
96             @PathParam("entitlementPoolId") String entitlementPoolId,
97             @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
98
99 }