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