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