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.v3.oas.annotations.OpenAPIDefinition;
21 import io.swagger.v3.oas.annotations.Operation;
22 import io.swagger.v3.oas.annotations.Parameter;
23 import io.swagger.v3.oas.annotations.info.Info;
24 import io.swagger.v3.oas.annotations.media.ArraySchema;
25 import io.swagger.v3.oas.annotations.media.Content;
26 import io.swagger.v3.oas.annotations.media.Schema;
27 import io.swagger.v3.oas.annotations.responses.ApiResponse;
28 import org.openecomp.sdcrests.common.RestConstants;
29 import org.openecomp.sdcrests.item.types.ItemDto;
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;
35 import javax.validation.Valid;
36 import javax.validation.constraints.NotNull;
38 import javax.ws.rs.core.MediaType;
39 import javax.ws.rs.core.Response;
41 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
44 @Path("/v1.0/vendor-license-models")
45 @Produces(MediaType.APPLICATION_JSON)
46 @Consumes(MediaType.APPLICATION_JSON)
47 @OpenAPIDefinition( info = @Info(title = "Vendor License Models"))
49 public interface VendorLicenseModels {
53 @Operation(description = "List vendor license models", responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation=ItemDto.class)))))
54 Response listLicenseModels(@Parameter(description = "Filter to return only Vendor License Models with at" +
55 " least one version at this status. Currently supported values: 'Certified' , 'Draft'")
56 @QueryParam("versionFilter") String versionStatus,
57 @Parameter(description = "Filter to only return Vendor License Models at this status." +
58 "Currently supported values: 'ACTIVE' , 'ARCHIVED'." +
59 "Default value = 'ACTIVE'.")
60 @QueryParam("Status") String itemStatus,
61 @NotNull(message = USER_MISSING_ERROR_MSG)
62 @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
66 @Operation(description = "Create vendor license model")
67 Response createLicenseModel(@Valid VendorLicenseModelRequestDto request,
68 @NotNull(message = USER_MISSING_ERROR_MSG)
69 @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
73 @Operation(description = "Delete vendor license model")
74 Response deleteLicenseModel(
75 @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
76 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM)
80 @Path("/{vlmId}/versions/{versionId}")
81 @Operation(description = "Update vendor license model")
82 Response updateLicenseModel(@Valid VendorLicenseModelRequestDto request,
83 @Parameter(description = "Vendor license model Id")
84 @PathParam("vlmId") String vlmId,
85 @Parameter(description = "Vendor license model version Id")
86 @PathParam("versionId") String versionId,
87 @NotNull(message = USER_MISSING_ERROR_MSG)
88 @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
91 @Path("/{vlmId}/versions/{versionId}")
92 @Operation(description = "Get vendor license model", responses = @ApiResponse(content = @Content(schema = @Schema(implementation=VendorLicenseModelEntityDto.class))))
93 Response getLicenseModel(
94 @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
95 @Parameter(description = "Vendor license model version Id") @PathParam
96 ("versionId") String versionId,
97 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM)
102 @Path("/{vlmId}/versions/{versionId}/actions")
103 @Operation(description = "Update vendor license model")
104 Response actOnLicenseModel(@Valid VendorLicenseModelActionRequestDto request,
105 @Parameter(description = "Vendor license model Id") @PathParam("vlmId")
107 @Parameter(description = "Vendor license model version Id") @PathParam
108 ("versionId") String versionId,
109 @NotNull(message = USER_MISSING_ERROR_MSG)
110 @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);