0636b6e599d2d1c5ae68cac048122a4c02b01bde
[sdc.git] /
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 package org.openecomp.sdcrests.vendorlicense.rest;
17
18 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
19
20 import io.swagger.v3.oas.annotations.Operation;
21 import io.swagger.v3.oas.annotations.Parameter;
22 import io.swagger.v3.oas.annotations.media.ArraySchema;
23 import io.swagger.v3.oas.annotations.media.Content;
24 import io.swagger.v3.oas.annotations.media.Schema;
25 import io.swagger.v3.oas.annotations.responses.ApiResponse;
26 import io.swagger.v3.oas.annotations.tags.Tag;
27 import io.swagger.v3.oas.annotations.tags.Tags;
28 import javax.validation.Valid;
29 import javax.validation.constraints.NotNull;
30 import javax.ws.rs.Consumes;
31 import javax.ws.rs.DELETE;
32 import javax.ws.rs.GET;
33 import javax.ws.rs.HeaderParam;
34 import javax.ws.rs.POST;
35 import javax.ws.rs.PUT;
36 import javax.ws.rs.Path;
37 import javax.ws.rs.PathParam;
38 import javax.ws.rs.Produces;
39 import javax.ws.rs.QueryParam;
40 import javax.ws.rs.core.MediaType;
41 import javax.ws.rs.core.Response;
42 import org.openecomp.sdcrests.common.RestConstants;
43 import org.openecomp.sdcrests.item.types.ItemDto;
44 import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelActionRequestDto;
45 import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelEntityDto;
46 import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelRequestDto;
47 import org.springframework.validation.annotation.Validated;
48
49 @Path("/v1.0/vendor-license-models")
50 @Produces(MediaType.APPLICATION_JSON)
51 @Consumes(MediaType.APPLICATION_JSON)
52 @Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Vendor License Models")})
53 @Validated
54 public interface VendorLicenseModels {
55
56     @GET
57     @Path("/")
58     @Operation(description = "List vendor license models", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ItemDto.class)))))
59     Response listLicenseModels(@Parameter(description = "Filter to return only Vendor License Models with at"
60         + " least one version at this status. Currently supported values: 'Certified' , 'Draft'") @QueryParam("versionFilter") String versionStatus,
61                                @Parameter(description = "Filter to only return Vendor License Models at this status."
62                                    + "Currently supported values: 'ACTIVE' , 'ARCHIVED'."
63                                    + "Default value = 'ACTIVE'.") @QueryParam("Status") String itemStatus,
64                                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
65
66     @POST
67     @Path("/")
68     @Operation(description = "Create vendor license model")
69     Response createLicenseModel(@Valid VendorLicenseModelRequestDto request,
70                                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
71
72     @DELETE
73     @Path("/{vlmId}")
74     @Operation(description = "Delete vendor license model")
75     Response deleteLicenseModel(@Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
76                                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
77
78     @PUT
79     @Path("/{vlmId}/versions/{versionId}")
80     @Operation(description = "Update vendor license model")
81     Response updateLicenseModel(@Valid VendorLicenseModelRequestDto request,
82                                 @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
83                                 @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId,
84                                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
85
86     @GET
87     @Path("/{vlmId}/versions/{versionId}")
88     @Operation(description = "Get vendor license model", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VendorLicenseModelEntityDto.class))))
89     Response getLicenseModel(@Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
90                              @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId,
91                              @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
92
93     @PUT
94     @Path("/{vlmId}/versions/{versionId}/actions")
95     @Operation(description = "Update vendor license model")
96     Response actOnLicenseModel(@Valid VendorLicenseModelActionRequestDto request,
97                                @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId,
98                                @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId,
99                                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
100 }