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 static org.openecomp.sdcrests.common.RestConstants.USER_HEADER_PARAM;
24 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
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.LicenseAgreementEntityDto;
31 import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementModelDto;
32 import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementRequestDto;
33 import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementUpdateRequestDto;
34 import org.springframework.validation.annotation.Validated;
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;
52 @Path("/v1.0/vendor-license-models/{vlmId}/license-agreements")
53 @Produces(MediaType.APPLICATION_JSON)
54 @Consumes(MediaType.APPLICATION_JSON)
55 @Api(value = "Vendor License Model - License Agreements")
58 public interface LicenseAgreements {
62 @ApiOperation(value = "List vendor license agreements",
63 response = LicenseAgreementEntityDto.class,
64 responseContainer = "List")
65 Response listLicenseAgreements(
66 @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
67 @Pattern(regexp = Version.VERSION_REGEX, message = Version.VERSION_STRING_VIOLATION_MSG)
68 @QueryParam("version") String version,
69 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
73 @ApiOperation(value = "Create vendor license agreement")
74 Response createLicenseAgreement(@Valid LicenseAgreementRequestDto request,
75 @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
77 @NotNull(message = USER_MISSING_ERROR_MSG)
78 @HeaderParam(USER_HEADER_PARAM) String user);
81 @Path("/{licenseAgreementId}")
82 @ApiOperation(value = "Update vendor license agreement")
83 Response updateLicenseAgreement(@Valid LicenseAgreementUpdateRequestDto request,
84 @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
86 @PathParam("licenseAgreementId") String licenseAgreementId,
87 @NotNull(message = USER_MISSING_ERROR_MSG)
88 @HeaderParam(USER_HEADER_PARAM) String user);
91 @Path("/{licenseAgreementId}")
92 @ApiOperation(value = "Get vendor license agreement",
93 response = LicenseAgreementModelDto.class)
94 Response getLicenseAgreement(
95 @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
96 @Pattern(regexp = Version.VERSION_REGEX, message = Version.VERSION_STRING_VIOLATION_MSG)
97 @QueryParam("version") String version,
98 @PathParam("licenseAgreementId") String licenseAgreementId,
99 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
102 @Path("/{licenseAgreementId}")
103 @ApiOperation(value = "Delete vendor license agreement")
104 Response deleteLicenseAgreement(
105 @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
106 @PathParam("licenseAgreementId") String licenseAgreementId,
107 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);