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