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