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 / VendorLicenseModels.java
1 /*
2  * Copyright © 2018 European Support Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 package org.openecomp.sdcrests.vendorlicense.rest;
19
20 import io.swagger.annotations.Api;
21 import io.swagger.annotations.ApiOperation;
22 import io.swagger.annotations.ApiParam;
23 import org.openecomp.sdcrests.common.RestConstants;
24 import org.openecomp.sdcrests.item.types.ItemDto;
25 import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelActionRequestDto;
26 import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelEntityDto;
27 import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelRequestDto;
28 import org.springframework.validation.annotation.Validated;
29
30 import javax.validation.Valid;
31 import javax.validation.constraints.NotNull;
32 import javax.ws.rs.*;
33 import javax.ws.rs.core.MediaType;
34 import javax.ws.rs.core.Response;
35
36 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
37
38
39 @Path("/v1.0/vendor-license-models")
40 @Produces(MediaType.APPLICATION_JSON)
41 @Consumes(MediaType.APPLICATION_JSON)
42 @Api(value = "Vendor License Models")
43 @Validated
44 public interface VendorLicenseModels {
45
46   @GET
47   @Path("/")
48   @ApiOperation(value = "List vendor license models",
49       response = ItemDto.class,
50       responseContainer = "List")
51   Response listLicenseModels(@ApiParam(value = "Filter to return only Vendor License Models with at" +
52                             " least one version at this status. Currently supported values: 'Certified' , 'Draft'")
53                             @QueryParam("versionFilter") String versionStatus,
54                             @ApiParam(value = "Filter to only return Vendor License Models at this status." +
55                             "Currently supported values: 'ACTIVE' , 'ARCHIVED'." +
56                             "Default value = 'ACTIVE'.")
57                             @QueryParam("Status") String itemStatus,
58                             @NotNull(message = USER_MISSING_ERROR_MSG)
59                             @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
60
61   @POST
62   @Path("/")
63   @ApiOperation(value = "Create vendor license model")
64   Response createLicenseModel(@Valid VendorLicenseModelRequestDto request,
65                               @NotNull(message = USER_MISSING_ERROR_MSG)
66                               @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
67
68   @DELETE
69   @Path("/{vlmId}")
70   @ApiOperation(value = "Delete vendor license model")
71   Response deleteLicenseModel(
72             @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
73             @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM)
74                     String user);
75
76   @PUT
77   @Path("/{vlmId}/versions/{versionId}")
78   @ApiOperation(value = "Update vendor license model")
79   Response updateLicenseModel(@Valid VendorLicenseModelRequestDto request,
80                               @ApiParam(value = "Vendor license model Id")
81                               @PathParam("vlmId") String vlmId,
82                               @ApiParam(value = "Vendor license model version Id")
83                               @PathParam("versionId") String versionId,
84                               @NotNull(message = USER_MISSING_ERROR_MSG)
85                               @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
86
87   @GET
88   @Path("/{vlmId}/versions/{versionId}")
89   @ApiOperation(value = "Get vendor license model",
90       response = VendorLicenseModelEntityDto.class)
91   Response getLicenseModel(
92       @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
93       @ApiParam(value = "Vendor license model version Id") @PathParam
94           ("versionId") String versionId,
95       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM)
96           String user);
97
98
99   @PUT
100   @Path("/{vlmId}/versions/{versionId}/actions")
101   @ApiOperation(value = "Update vendor license model")
102   Response actOnLicenseModel(@Valid VendorLicenseModelActionRequestDto request,
103                              @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
104                                  String vlmId,
105                              @ApiParam(value = "Vendor license model version Id") @PathParam
106                                  ("versionId") String versionId,
107                              @NotNull(message = USER_MISSING_ERROR_MSG)
108                              @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
109 }