2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.sdcrests.vendorlicense.rest;
23 import io.swagger.v3.oas.annotations.OpenAPIDefinition;
24 import io.swagger.v3.oas.annotations.Operation;
25 import io.swagger.v3.oas.annotations.Parameter;
26 import io.swagger.v3.oas.annotations.info.Info;
27 import io.swagger.v3.oas.annotations.media.ArraySchema;
28 import io.swagger.v3.oas.annotations.media.Content;
29 import io.swagger.v3.oas.annotations.media.Schema;
30 import io.swagger.v3.oas.annotations.responses.ApiResponse;
31 import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementEntityDto;
32 import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementModelDto;
33 import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementRequestDto;
34 import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementUpdateRequestDto;
35 import org.springframework.validation.annotation.Validated;
37 import javax.validation.Valid;
38 import javax.validation.constraints.NotNull;
40 import javax.ws.rs.core.MediaType;
41 import javax.ws.rs.core.Response;
43 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
44 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
47 @Path("/v1.0/vendor-license-models/{vlmId}/versions/{versionId}/license-agreements")
48 @Produces(MediaType.APPLICATION_JSON)
49 @Consumes(MediaType.APPLICATION_JSON)
50 @OpenAPIDefinition(info = @Info(title = "Vendor License Model - License Agreements"))
53 public interface LicenseAgreements {
57 @Operation(description = "List vendor license agreements", responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation =LicenseAgreementEntityDto.class)))))
58 Response listLicenseAgreements(
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);
65 @Operation(description = "Create vendor license agreement")
66 Response createLicenseAgreement(@Valid LicenseAgreementRequestDto request,
67 @Parameter(description = "Vendor license model Id") @PathParam("vlmId")
69 @Parameter(description = "Vendor license model version Id")
70 @PathParam("versionId") String versionId,
71 @NotNull(message = USER_MISSING_ERROR_MSG)
72 @HeaderParam(USER_ID_HEADER_PARAM) String user);
75 @Path("/{licenseAgreementId}")
76 @Operation(description = "Update vendor license agreement")
77 Response updateLicenseAgreement(@Valid LicenseAgreementUpdateRequestDto request,
78 @Parameter(description = "Vendor license model Id") @PathParam("vlmId")
80 @Parameter(description = "Vendor license model version Id")
81 @PathParam("versionId") String versionId,
82 @PathParam("licenseAgreementId") String licenseAgreementId,
83 @NotNull(message = USER_MISSING_ERROR_MSG)
84 @HeaderParam(USER_ID_HEADER_PARAM) String user);
87 @Path("/{licenseAgreementId}")
88 @Operation(description = "Get vendor license agreement", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = LicenseAgreementModelDto.class))))
89 Response getLicenseAgreement(
90 @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
91 @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId,
92 @PathParam("licenseAgreementId") String licenseAgreementId,
93 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
96 @Path("/{licenseAgreementId}")
97 @Operation(description = "Delete vendor license agreement")
98 Response deleteLicenseAgreement(
99 @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
100 @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId,
101 @PathParam("licenseAgreementId") String licenseAgreementId,
102 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);