6b30b74bf87d1eee9dd9004bb1bed59924c67211
[sdc.git] /
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")
64                                            String vlmId,
65                                    @Parameter(description = "Vendor license model version Id") @PathParam
66                                            ("versionId")
67                                            String versionId,
68                                    @NotNull(message = USER_MISSING_ERROR_MSG)
69                                    @HeaderParam(USER_ID_HEADER_PARAM) String user);
70
71     @PUT
72     @Path("/{entitlementPoolId}")
73     @Operation(description = "Update vendor entitlement pool")
74     Response updateEntitlementPool(@Valid EntitlementPoolRequestDto request,
75                                    @Parameter(description = "Vendor license model Id") @PathParam("vlmId")
76                                            String vlmId,
77                                    @Parameter(description = "Vendor license model version Id")
78                                    @PathParam("versionId") String versionId,
79                                    @NotNull(message = USER_MISSING_ERROR_MSG)
80                                    @PathParam("entitlementPoolId") String entitlementPoolId,
81                                    @HeaderParam(USER_ID_HEADER_PARAM) String user);
82
83     @GET
84     @Path("/{entitlementPoolId}")
85     @Operation(description = "Get vendor entitlement pool", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = EntitlementPoolEntityDto.class))))
86     Response getEntitlementPool(
87             @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
88             @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId,
89             @PathParam("entitlementPoolId") String entitlementPoolId,
90             @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
91
92     @DELETE
93     @Path("/{entitlementPoolId}")
94     @Operation(description = "Delete vendor entitlement pool")
95     Response deleteEntitlementPool(
96             @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
97             @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId,
98             @PathParam("entitlementPoolId") String entitlementPoolId,
99             @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
100
101 }