2 * Copyright © 2018 European Support Limited
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 package org.openecomp.sdcrests.vendorlicense.rest;
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;
30 import javax.validation.Valid;
31 import javax.validation.constraints.NotNull;
33 import javax.ws.rs.core.MediaType;
34 import javax.ws.rs.core.Response;
36 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
39 @Path("/v1.0/vendor-license-models")
40 @Produces(MediaType.APPLICATION_JSON)
41 @Consumes(MediaType.APPLICATION_JSON)
42 @Api(value = "Vendor License Models")
44 public interface VendorLicenseModels {
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);
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);
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)
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);
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)
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")
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);