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