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