re base 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 io.swagger.annotations.Api;
24 import io.swagger.annotations.ApiOperation;
25 import io.swagger.annotations.ApiParam;
26 import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementEntityDto;
27 import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementModelDto;
28 import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementRequestDto;
29 import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementUpdateRequestDto;
30 import org.springframework.validation.annotation.Validated;
31
32 import javax.validation.Valid;
33 import javax.validation.constraints.NotNull;
34 import javax.ws.rs.*;
35 import javax.ws.rs.core.MediaType;
36 import javax.ws.rs.core.Response;
37
38 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
39 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
40
41
42 @Path("/v1.0/vendor-license-models/{vlmId}/versions/{versionId}/license-agreements")
43 @Produces(MediaType.APPLICATION_JSON)
44 @Consumes(MediaType.APPLICATION_JSON)
45 @Api(value = "Vendor License Model - License Agreements")
46 @Validated
47
48 public interface LicenseAgreements {
49
50   @GET
51   @Path("/")
52   @ApiOperation(value = "List vendor license agreements",
53       response = LicenseAgreementEntityDto.class,
54       responseContainer = "List")
55   Response listLicenseAgreements(
56       @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
57       @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId,
58       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
59
60   @POST
61   @Path("/")
62   @ApiOperation(value = "Create vendor license agreement")
63   Response createLicenseAgreement(@Valid LicenseAgreementRequestDto request,
64                                   @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
65                                       String vlmId,
66                                   @ApiParam(value = "Vendor license model version Id")
67                                   @PathParam("versionId") String versionId,
68                                   @NotNull(message = USER_MISSING_ERROR_MSG)
69                                   @HeaderParam(USER_ID_HEADER_PARAM) String user);
70
71   @PUT
72   @Path("/{licenseAgreementId}")
73   @ApiOperation(value = "Update vendor license agreement")
74   Response updateLicenseAgreement(@Valid LicenseAgreementUpdateRequestDto request,
75                                   @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
76                                       String vlmId,
77                                   @ApiParam(value = "Vendor license model version Id")
78                                   @PathParam("versionId") String versionId,
79                                   @PathParam("licenseAgreementId") String licenseAgreementId,
80                                   @NotNull(message = USER_MISSING_ERROR_MSG)
81                                   @HeaderParam(USER_ID_HEADER_PARAM) String user);
82
83   @GET
84   @Path("/{licenseAgreementId}")
85   @ApiOperation(value = "Get vendor license agreement",
86       response = LicenseAgreementModelDto.class)
87   Response getLicenseAgreement(
88       @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
89       @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId,
90       @PathParam("licenseAgreementId") String licenseAgreementId,
91       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
92
93   @DELETE
94   @Path("/{licenseAgreementId}")
95   @ApiOperation(value = "Delete vendor license agreement")
96   Response deleteLicenseAgreement(
97       @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
98       @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId,
99       @PathParam("licenseAgreementId") String licenseAgreementId,
100       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
101
102 }