push addional code
[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 static org.openecomp.sdcrests.common.RestConstants.USER_HEADER_PARAM;
24 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
25
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;
35
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;
51
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")
56 @Validated
57
58 public interface LicenseAgreements {
59
60   @GET
61   @Path("/")
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);
70
71   @POST
72   @Path("/")
73   @ApiOperation(value = "Create vendor license agreement")
74   Response createLicenseAgreement(@Valid LicenseAgreementRequestDto request,
75                                   @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
76                                       String vlmId,
77                                   @NotNull(message = USER_MISSING_ERROR_MSG)
78                                   @HeaderParam(USER_HEADER_PARAM) String user);
79
80   @PUT
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")
85                                       String vlmId,
86                                   @PathParam("licenseAgreementId") String licenseAgreementId,
87                                   @NotNull(message = USER_MISSING_ERROR_MSG)
88                                   @HeaderParam(USER_HEADER_PARAM) String user);
89
90   @GET
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);
100
101   @DELETE
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);
108
109 }