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