re base code
[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.annotations.Api;
24 import io.swagger.annotations.ApiOperation;
25 import io.swagger.annotations.ApiParam;
26 import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupEntityDto;
27 import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupRequestDto;
28 import org.springframework.validation.annotation.Validated;
29
30 import javax.validation.Valid;
31 import javax.validation.constraints.NotNull;
32 import javax.ws.rs.*;
33 import javax.ws.rs.core.MediaType;
34 import javax.ws.rs.core.Response;
35
36 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
37 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
38
39
40 @Path("/v1.0/vendor-license-models/{vlmId}/versions/{versionId}/license-key-groups")
41 @Produces(MediaType.APPLICATION_JSON)
42 @Consumes(MediaType.APPLICATION_JSON)
43 @Api(value = "Vendor License Model - License Key Groups")
44 @Validated
45 public interface LicenseKeyGroups {
46   @GET
47   @Path("/")
48   @ApiOperation(value = "List vendor license key groups",
49       response = LicenseKeyGroupEntityDto.class,
50       responseContainer = "List")
51   Response listLicenseKeyGroups(
52       @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
53       @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId,
54       @HeaderParam(USER_ID_HEADER_PARAM) String user);
55
56   @POST
57   @Path("/")
58   @ApiOperation(value = "Create vendor license key group")
59   Response createLicenseKeyGroup(@Valid LicenseKeyGroupRequestDto request,
60                                  @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
61                                      String vlmId,
62                                  @ApiParam(value = "Vendor license model version Id")
63                                  @PathParam("versionId") String versionId,
64                                  @NotNull(message = USER_MISSING_ERROR_MSG)
65                                  @HeaderParam(USER_ID_HEADER_PARAM) String user);
66
67   @PUT
68   @Path("/{licenseKeyGroupId}")
69   @ApiOperation(value = "Update vendor license key group")
70   Response updateLicenseKeyGroup(@Valid LicenseKeyGroupRequestDto request,
71                                  @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
72                                      String vlmId,
73                                  @ApiParam(value = "Vendor license model version Id")
74                                  @PathParam("versionId") String versionId,
75                                  @PathParam("licenseKeyGroupId") String licenseKeyGroupId,
76                                  @NotNull(message = USER_MISSING_ERROR_MSG)
77                                  @HeaderParam(USER_ID_HEADER_PARAM) String user);
78
79   @GET
80   @Path("/{licenseKeyGroupId}")
81   @ApiOperation(value = "Get vendor license key group",
82       response = LicenseKeyGroupEntityDto.class)
83   Response getLicenseKeyGroup(
84       @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
85       @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId,
86       @PathParam("licenseKeyGroupId") String licenseKeyGroupId,
87       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
88
89   @DELETE
90   @Path("/{licenseKeyGroupId}")
91   @ApiOperation(value = "Delete vendor license key group")
92   Response deleteLicenseKeyGroup(
93       @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
94       @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId,
95       @PathParam("licenseKeyGroupId") String licenseKeyGroupId,
96       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
97 }