cc599aba69d37308067c2aceb4a6fb8d5621cc00
[sdc.git] / openecomp-be / api / openecomp-sdc-rest-webapp / vendor-license-rest / vendor-license-rest-services / src / main / java / org / openecomp / sdcrests / vendorlicense / rest / LicenseKeyGroups.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.LicenseKeyGroupEntityDto;
32 import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupRequestDto;
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
45 @Path("/v1.0/vendor-license-models/{vlmId}/versions/{versionId}/license-key-groups")
46 @Produces(MediaType.APPLICATION_JSON)
47 @Consumes(MediaType.APPLICATION_JSON)
48 @OpenAPIDefinition(info = @Info(title = "Vendor License Model - License Key Groups"))
49 @Validated
50 public interface LicenseKeyGroups {
51   @GET
52   @Path("/")
53   @Operation(description = "List vendor license key groups",  responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation =LicenseKeyGroupEntityDto.class)))))
54   Response listLicenseKeyGroups(
55       @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
56       @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId,
57       @HeaderParam(USER_ID_HEADER_PARAM) String user);
58
59   @POST
60   @Path("/")
61   @Operation(description = "Create vendor license key group")
62   Response createLicenseKeyGroup(@Valid LicenseKeyGroupRequestDto request,
63                                  @Parameter(description = "Vendor license model Id") @PathParam("vlmId")
64                                      String vlmId,
65                                  @Parameter(description = "Vendor license model version Id")
66                                  @PathParam("versionId") String versionId,
67                                  @NotNull(message = USER_MISSING_ERROR_MSG)
68                                  @HeaderParam(USER_ID_HEADER_PARAM) String user);
69
70   @PUT
71   @Path("/{licenseKeyGroupId}")
72   @Operation(description = "Update vendor license key group")
73   Response updateLicenseKeyGroup(@Valid LicenseKeyGroupRequestDto request,
74                                  @Parameter(description = "Vendor license model Id") @PathParam("vlmId")
75                                      String vlmId,
76                                  @Parameter(description = "Vendor license model version Id")
77                                  @PathParam("versionId") String versionId,
78                                  @PathParam("licenseKeyGroupId") String licenseKeyGroupId,
79                                  @NotNull(message = USER_MISSING_ERROR_MSG)
80                                  @HeaderParam(USER_ID_HEADER_PARAM) String user);
81
82   @GET
83   @Path("/{licenseKeyGroupId}")
84   @Operation(description = "Get vendor license key group",responses = @ApiResponse(content = @Content(schema = @Schema(implementation = LicenseKeyGroupEntityDto.class))))
85   Response getLicenseKeyGroup(
86       @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
87       @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId,
88       @PathParam("licenseKeyGroupId") String licenseKeyGroupId,
89       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
90
91   @DELETE
92   @Path("/{licenseKeyGroupId}")
93   @Operation(description = "Delete vendor license key group")
94   Response deleteLicenseKeyGroup(
95       @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
96       @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId,
97       @PathParam("licenseKeyGroupId") String licenseKeyGroupId,
98       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
99 }