[SDC-29] Amdocs OnBoard 1707 initial commit.
[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.Consumes;
35 import javax.ws.rs.DELETE;
36 import javax.ws.rs.GET;
37 import javax.ws.rs.HeaderParam;
38 import javax.ws.rs.POST;
39 import javax.ws.rs.PUT;
40 import javax.ws.rs.Path;
41 import javax.ws.rs.PathParam;
42 import javax.ws.rs.Produces;
43 import javax.ws.rs.core.MediaType;
44 import javax.ws.rs.core.Response;
45
46 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
47 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
48
49
50 @Path("/v1.0/vendor-license-models/{vlmId}/versions/{versionId}/license-agreements")
51 @Produces(MediaType.APPLICATION_JSON)
52 @Consumes(MediaType.APPLICATION_JSON)
53 @Api(value = "Vendor License Model - License Agreements")
54 @Validated
55
56 public interface LicenseAgreements {
57
58   @GET
59   @Path("/")
60   @ApiOperation(value = "List vendor license agreements",
61       response = LicenseAgreementEntityDto.class,
62       responseContainer = "List")
63   Response listLicenseAgreements(
64       @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
65       @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId,
66       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
67
68   @POST
69   @Path("/")
70   @ApiOperation(value = "Create vendor license agreement")
71   Response createLicenseAgreement(@Valid LicenseAgreementRequestDto request,
72                                   @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
73                                       String vlmId,
74                                   @ApiParam(value = "Vendor license model version Id")
75                                   @PathParam("versionId") String versionId,
76                                   @NotNull(message = USER_MISSING_ERROR_MSG)
77                                   @HeaderParam(USER_ID_HEADER_PARAM) String user);
78
79   @PUT
80   @Path("/{licenseAgreementId}")
81   @ApiOperation(value = "Update vendor license agreement")
82   Response updateLicenseAgreement(@Valid LicenseAgreementUpdateRequestDto request,
83                                   @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
84                                       String vlmId,
85                                   @ApiParam(value = "Vendor license model version Id")
86                                   @PathParam("versionId") String versionId,
87                                   @PathParam("licenseAgreementId") String licenseAgreementId,
88                                   @NotNull(message = USER_MISSING_ERROR_MSG)
89                                   @HeaderParam(USER_ID_HEADER_PARAM) String user);
90
91   @GET
92   @Path("/{licenseAgreementId}")
93   @ApiOperation(value = "Get vendor license agreement",
94       response = LicenseAgreementModelDto.class)
95   Response getLicenseAgreement(
96       @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
97       @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId,
98       @PathParam("licenseAgreementId") String licenseAgreementId,
99       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_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       @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId,
107       @PathParam("licenseAgreementId") String licenseAgreementId,
108       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
109
110 }