50dc3c82a16cc80a2e65df61d2d24a49922812e6
[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.Operation;
24 import io.swagger.v3.oas.annotations.Parameter;
25 import io.swagger.v3.oas.annotations.info.Info;
26 import io.swagger.v3.oas.annotations.media.ArraySchema;
27 import io.swagger.v3.oas.annotations.media.Content;
28 import io.swagger.v3.oas.annotations.media.Schema;
29 import io.swagger.v3.oas.annotations.responses.ApiResponse;
30 import io.swagger.v3.oas.annotations.tags.Tag;
31 import io.swagger.v3.oas.annotations.tags.Tags;
32 import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupEntityDto;
33 import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupRequestDto;
34 import org.springframework.validation.annotation.Validated;
35
36 import javax.validation.Valid;
37 import javax.validation.constraints.NotNull;
38 import javax.ws.rs.*;
39 import javax.ws.rs.core.MediaType;
40 import javax.ws.rs.core.Response;
41
42 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
43 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
44
45
46 @Path("/v1.0/vendor-license-models/{vlmId}/versions/{versionId}/license-key-groups")
47 @Produces(MediaType.APPLICATION_JSON)
48 @Consumes(MediaType.APPLICATION_JSON)
49 @Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Vendor License Model - License Key Groups")})
50 @Validated
51 public interface LicenseKeyGroups {
52   @GET
53   @Path("/")
54   @Operation(description = "List vendor license key groups",  responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation =LicenseKeyGroupEntityDto.class)))))
55   Response listLicenseKeyGroups(
56       @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
57       @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId,
58       @HeaderParam(USER_ID_HEADER_PARAM) String user);
59
60   @POST
61   @Path("/")
62   @Operation(description = "Create vendor license key group")
63   Response createLicenseKeyGroup(@Valid LicenseKeyGroupRequestDto request,
64                                  @Parameter(description = "Vendor license model Id") @PathParam("vlmId")
65                                      String vlmId,
66                                  @Parameter(description = "Vendor license model version Id")
67                                  @PathParam("versionId") String versionId,
68                                  @NotNull(message = USER_MISSING_ERROR_MSG)
69                                  @HeaderParam(USER_ID_HEADER_PARAM) String user);
70
71   @PUT
72   @Path("/{licenseKeyGroupId}")
73   @Operation(description = "Update vendor license key group")
74   Response updateLicenseKeyGroup(@Valid LicenseKeyGroupRequestDto 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                                  @PathParam("licenseKeyGroupId") String licenseKeyGroupId,
80                                  @NotNull(message = USER_MISSING_ERROR_MSG)
81                                  @HeaderParam(USER_ID_HEADER_PARAM) String user);
82
83   @GET
84   @Path("/{licenseKeyGroupId}")
85   @Operation(description = "Get vendor license key group",responses = @ApiResponse(content = @Content(schema = @Schema(implementation = LicenseKeyGroupEntityDto.class))))
86   Response getLicenseKeyGroup(
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("licenseKeyGroupId") String licenseKeyGroupId,
90       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
91
92   @DELETE
93   @Path("/{licenseKeyGroupId}")
94   @Operation(description = "Delete vendor license key group")
95   Response deleteLicenseKeyGroup(
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("licenseKeyGroupId") String licenseKeyGroupId,
99       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
100 }