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 / VendorLicenseModels.java
1 /*
2  * Copyright © 2018 European Support Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 package org.openecomp.sdcrests.vendorlicense.rest;
19
20 import io.swagger.v3.oas.annotations.Operation;
21 import io.swagger.v3.oas.annotations.Parameter;
22 import io.swagger.v3.oas.annotations.info.Info;
23 import io.swagger.v3.oas.annotations.media.ArraySchema;
24 import io.swagger.v3.oas.annotations.media.Content;
25 import io.swagger.v3.oas.annotations.media.Schema;
26 import io.swagger.v3.oas.annotations.responses.ApiResponse;
27 import io.swagger.v3.oas.annotations.tags.Tag;
28 import io.swagger.v3.oas.annotations.tags.Tags;
29 import org.openecomp.sdcrests.common.RestConstants;
30 import org.openecomp.sdcrests.item.types.ItemDto;
31 import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelActionRequestDto;
32 import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelEntityDto;
33 import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelRequestDto;
34 import org.springframework.validation.annotation.Validated;
35
36 import javax.validation.Valid;
37 import javax.validation.constraints.NotNull;
38 import javax.ws.rs.*;
39 import javax.ws.rs.core.MediaType;
40 import javax.ws.rs.core.Response;
41
42 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
43
44
45 @Path("/v1.0/vendor-license-models")
46 @Produces(MediaType.APPLICATION_JSON)
47 @Consumes(MediaType.APPLICATION_JSON)
48 @Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Vendor License Models")})
49 @Validated
50 public interface VendorLicenseModels {
51
52   @GET
53   @Path("/")
54   @Operation(description = "List vendor license models", responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation=ItemDto.class)))))
55   Response listLicenseModels(@Parameter(description = "Filter to return only Vendor License Models with at" +
56                             " least one version at this status. Currently supported values: 'Certified' , 'Draft'")
57                             @QueryParam("versionFilter") String versionStatus,
58                             @Parameter(description = "Filter to only return Vendor License Models at this status." +
59                             "Currently supported values: 'ACTIVE' , 'ARCHIVED'." +
60                             "Default value = 'ACTIVE'.")
61                             @QueryParam("Status") String itemStatus,
62                             @NotNull(message = USER_MISSING_ERROR_MSG)
63                             @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
64
65   @POST
66   @Path("/")
67   @Operation(description = "Create vendor license model")
68   Response createLicenseModel(@Valid VendorLicenseModelRequestDto request,
69                               @NotNull(message = USER_MISSING_ERROR_MSG)
70                               @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
71
72   @DELETE
73   @Path("/{vlmId}")
74   @Operation(description = "Delete vendor license model")
75   Response deleteLicenseModel(
76             @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
77             @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM)
78                     String user);
79
80   @PUT
81   @Path("/{vlmId}/versions/{versionId}")
82   @Operation(description = "Update vendor license model")
83   Response updateLicenseModel(@Valid VendorLicenseModelRequestDto request,
84                               @Parameter(description = "Vendor license model Id")
85                               @PathParam("vlmId") String vlmId,
86                               @Parameter(description = "Vendor license model version Id")
87                               @PathParam("versionId") String versionId,
88                               @NotNull(message = USER_MISSING_ERROR_MSG)
89                               @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
90
91   @GET
92   @Path("/{vlmId}/versions/{versionId}")
93   @Operation(description = "Get vendor license model", responses = @ApiResponse(content = @Content(schema = @Schema(implementation=VendorLicenseModelEntityDto.class))))
94   Response getLicenseModel(
95       @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
96       @Parameter(description = "Vendor license model version Id") @PathParam
97           ("versionId") String versionId,
98       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM)
99           String user);
100
101
102   @PUT
103   @Path("/{vlmId}/versions/{versionId}/actions")
104   @Operation(description = "Update vendor license model")
105   Response actOnLicenseModel(@Valid VendorLicenseModelActionRequestDto request,
106                              @Parameter(description = "Vendor license model Id") @PathParam("vlmId")
107                                  String vlmId,
108                              @Parameter(description = "Vendor license model version Id") @PathParam
109                                  ("versionId") String versionId,
110                              @NotNull(message = USER_MISSING_ERROR_MSG)
111                              @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
112 }