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