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 / VendorLicenseModels.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_MISSING_ERROR_MSG;
24
25 import io.swagger.annotations.Api;
26 import io.swagger.annotations.ApiOperation;
27 import io.swagger.annotations.ApiParam;
28 import org.openecomp.sdc.versioning.dao.types.Version;
29 import org.openecomp.sdcrests.common.RestConstants;
30 import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelActionRequestDto;
31 import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelEntityDto;
32 import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelRequestDto;
33 import org.springframework.validation.annotation.Validated;
34
35 import javax.validation.Valid;
36 import javax.validation.constraints.NotNull;
37 import javax.validation.constraints.Pattern;
38 import javax.ws.rs.Consumes;
39 import javax.ws.rs.DELETE;
40 import javax.ws.rs.GET;
41 import javax.ws.rs.HeaderParam;
42 import javax.ws.rs.POST;
43 import javax.ws.rs.PUT;
44 import javax.ws.rs.Path;
45 import javax.ws.rs.PathParam;
46 import javax.ws.rs.Produces;
47 import javax.ws.rs.QueryParam;
48 import javax.ws.rs.core.MediaType;
49 import javax.ws.rs.core.Response;
50
51 @Path("/v1.0/vendor-license-models")
52 @Produces(MediaType.APPLICATION_JSON)
53 @Consumes(MediaType.APPLICATION_JSON)
54 @Api(value = "Vendor License Models")
55 @Validated
56 public interface VendorLicenseModels {
57
58   @GET
59   @Path("/")
60   @ApiOperation(value = "List vendor license models",
61       response = VendorLicenseModelEntityDto.class,
62       responseContainer = "List")
63   Response listLicenseModels(@ApiParam(
64       value = "Currently supported value: 'Final' - only vendor License models with final versions "
65           + "will be return - with their latest final version")
66                              @QueryParam("versionFilter") String versionFilter,
67                              @NotNull(message = USER_MISSING_ERROR_MSG)
68                              @HeaderParam(RestConstants.USER_HEADER_PARAM) String user);
69
70   @POST
71   @Path("/")
72   @ApiOperation(value = "Create vendor license model")
73   Response createLicenseModel(@Valid VendorLicenseModelRequestDto request,
74                               @NotNull(message = USER_MISSING_ERROR_MSG)
75                               @HeaderParam(RestConstants.USER_HEADER_PARAM) String user);
76
77   @PUT
78   @Path("/{vlmId}")
79   @ApiOperation(value = "Update vendor license model")
80   Response updateLicenseModel(@Valid VendorLicenseModelRequestDto request,
81                               @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
82                                   String vlmId, @NotNull(message = USER_MISSING_ERROR_MSG)
83                               @HeaderParam(RestConstants.USER_HEADER_PARAM) String user);
84
85   @GET
86   @Path("/{vlmId}")
87   @ApiOperation(value = "Get vendor license model",
88       response = VendorLicenseModelEntityDto.class)
89   Response getLicenseModel(
90       @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
91       @Pattern(regexp = Version.VERSION_REGEX, message = Version.VERSION_STRING_VIOLATION_MSG)
92       @QueryParam("version") String version,
93       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_HEADER_PARAM)
94           String user);
95
96   @DELETE
97   @Path("/{vlmId}")
98   @ApiOperation(value = "Delete vendor license model")
99   Response deleteLicenseModel(
100       @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
101       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_HEADER_PARAM)
102           String user);
103
104   @PUT
105   @Path("/{vlmId}/actions")
106   @ApiOperation(value = "Update vendor license model")
107   Response actOnLicenseModel(@Valid VendorLicenseModelActionRequestDto request,
108                              @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
109                                  String vlmId, @NotNull(message = USER_MISSING_ERROR_MSG)
110                              @HeaderParam(RestConstants.USER_HEADER_PARAM) String user);
111 }