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 / LicenseAgreements.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.LicenseAgreementEntityDto;
33 import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementModelDto;
34 import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementRequestDto;
35 import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementUpdateRequestDto;
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}/license-agreements")
49 @Produces(MediaType.APPLICATION_JSON)
50 @Consumes(MediaType.APPLICATION_JSON)
51 @Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Vendor License Model - License Agreements")})
52 @Validated
53
54 public interface LicenseAgreements {
55
56   @GET
57   @Path("/")
58   @Operation(description = "List vendor license agreements", responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation =LicenseAgreementEntityDto.class)))))
59   Response listLicenseAgreements(
60       @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
61       @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId,
62       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
63
64   @POST
65   @Path("/")
66   @Operation(description = "Create vendor license agreement")
67   Response createLicenseAgreement(@Valid LicenseAgreementRequestDto request,
68                                   @Parameter(description = "Vendor license model Id") @PathParam("vlmId")
69                                       String vlmId,
70                                   @Parameter(description = "Vendor license model version Id")
71                                   @PathParam("versionId") String versionId,
72                                   @NotNull(message = USER_MISSING_ERROR_MSG)
73                                   @HeaderParam(USER_ID_HEADER_PARAM) String user);
74
75   @PUT
76   @Path("/{licenseAgreementId}")
77   @Operation(description = "Update vendor license agreement")
78   Response updateLicenseAgreement(@Valid LicenseAgreementUpdateRequestDto request,
79                                   @Parameter(description = "Vendor license model Id") @PathParam("vlmId")
80                                       String vlmId,
81                                   @Parameter(description = "Vendor license model version Id")
82                                   @PathParam("versionId") String versionId,
83                                   @PathParam("licenseAgreementId") String licenseAgreementId,
84                                   @NotNull(message = USER_MISSING_ERROR_MSG)
85                                   @HeaderParam(USER_ID_HEADER_PARAM) String user);
86
87   @GET
88   @Path("/{licenseAgreementId}")
89   @Operation(description = "Get vendor license agreement", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = LicenseAgreementModelDto.class))))
90   Response getLicenseAgreement(
91       @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
92       @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId,
93       @PathParam("licenseAgreementId") String licenseAgreementId,
94       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
95
96   @DELETE
97   @Path("/{licenseAgreementId}")
98   @Operation(description = "Delete vendor license agreement")
99   Response deleteLicenseAgreement(
100       @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
101       @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId,
102       @PathParam("licenseAgreementId") String licenseAgreementId,
103       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
104
105 }