f27de5e297d6f804219177230381e22fe16466a9
[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 = "Filter to return only Vendor License Models with at" +
61                             " least one version at this status. Currently supported values: 'Certified' , 'Draft'")
62                             @QueryParam("versionFilter") String versionStatus,
63                             @ApiParam(value = "Filter to only return Vendor License Models at this status." +
64                             "Currently supported values: 'ACTIVE' , 'ARCHIVED'." +
65                             "Default value = 'ACTIVE'.")
66                             @QueryParam("Status") String itemStatus,
67                             @NotNull(message = USER_MISSING_ERROR_MSG)
68                             @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
69
70   @POST
71   @Path("/")
72   @ApiOperation(value = "Create vendor license model")
73   Response createLicenseModel(@Valid VendorLicenseModelRequestDto request,
74                               @NotNull(message = USER_MISSING_ERROR_MSG)
75                               @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
76
77   @DELETE
78   @Path("/{vlmId}")
79   @ApiOperation(value = "Delete vendor license model")
80   Response deleteLicenseModel(
81             @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
82             @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM)
83                     String user);
84
85   @PUT
86   @Path("/{vlmId}/versions/{versionId}")
87   @ApiOperation(value = "Update vendor license model")
88   Response updateLicenseModel(@Valid VendorLicenseModelRequestDto request,
89                               @ApiParam(value = "Vendor license model Id")
90                               @PathParam("vlmId") String vlmId,
91                               @ApiParam(value = "Vendor license model version Id")
92                               @PathParam("versionId") String versionId,
93                               @NotNull(message = USER_MISSING_ERROR_MSG)
94                               @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
95
96   @GET
97   @Path("/{vlmId}/versions/{versionId}")
98   @ApiOperation(value = "Get vendor license model",
99       response = VendorLicenseModelEntityDto.class)
100   Response getLicenseModel(
101       @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
102       @ApiParam(value = "Vendor license model version Id") @PathParam
103           ("versionId") String versionId,
104       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM)
105           String user);
106
107
108   @PUT
109   @Path("/{vlmId}/versions/{versionId}/actions")
110   @ApiOperation(value = "Update vendor license model")
111   Response actOnLicenseModel(@Valid VendorLicenseModelActionRequestDto request,
112                              @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
113                                  String vlmId,
114                              @ApiParam(value = "Vendor license model version Id") @PathParam
115                                  ("versionId") String versionId,
116                              @NotNull(message = USER_MISSING_ERROR_MSG)
117                              @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
118 }