b6a9d27f5d6926e7f11734b9854adea23f8aa045
[sdc.git] / openecomp-be / api / openecomp-sdc-rest-webapp / vendor-license-rest / vendor-license-rest-services / src / main / java / org / openecomp / sdcrests / vendorlicense / rest / FeatureGroups.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.FeatureGroupEntityDto;
32 import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupModelDto;
33 import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupRequestDto;
34 import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupUpdateRequestDto;
35 import org.springframework.validation.annotation.Validated;
36
37 import javax.validation.Valid;
38 import javax.validation.constraints.NotNull;
39 import javax.ws.rs.*;
40 import javax.ws.rs.core.MediaType;
41 import javax.ws.rs.core.Response;
42
43 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
44 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
45
46
47 @Path("/v1.0/vendor-license-models/{vlmId}/versions/{versionId}/feature-groups")
48 @Produces(MediaType.APPLICATION_JSON)
49 @Consumes(MediaType.APPLICATION_JSON)
50 @OpenAPIDefinition(info = @Info(title = "Vendor License Model - Feature Groups"))
51 @Validated
52 public interface FeatureGroups {
53
54   @GET
55   @Path("/")
56   @Operation(description = "List vendor feature groups",responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation =FeatureGroupEntityDto.class)))))
57   Response listFeatureGroups(
58       @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
59       @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId,
60       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
61
62   @POST
63   @Path("/")
64   @Operation(description = "Create vendor feature group")
65   Response createFeatureGroup(@Valid FeatureGroupRequestDto request,
66                               @Parameter(description = "Vendor license model Id") @PathParam("vlmId")
67                                   String vlmId,
68                               @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId,
69                               @NotNull(message = USER_MISSING_ERROR_MSG)
70                               @HeaderParam(USER_ID_HEADER_PARAM) String user);
71
72   @PUT
73   @Path("/{featureGroupId}")
74   @Operation(description = "Update vendor feature group")
75   Response updateFeatureGroup(@Valid FeatureGroupUpdateRequestDto request,
76                               @Parameter(description = "Vendor license model Id") @PathParam("vlmId")
77                                   String vlmId,
78                               @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId,
79                               @PathParam("featureGroupId") String featureGroupId,
80                               @NotNull(message = USER_MISSING_ERROR_MSG)
81                               @HeaderParam(USER_ID_HEADER_PARAM) String user);
82
83   @GET
84   @Path("/{featureGroupId}")
85   @Operation(description = "Get vendor feature group", responses = @ApiResponse(content = @Content(schema = @Schema(implementation =FeatureGroupModelDto.class))))
86   Response getFeatureGroup(
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("featureGroupId") String featureGroupId,
90       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
91
92   @DELETE
93   @Path("/{featureGroupId}")
94   @Operation(description = "Delete vendor feature group")
95   Response deleteFeatureGroup(
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("featureGroupId") String featureGroupId,
99       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
100
101 }