Add collaboration feature
[sdc.git] / openecomp-be / api / openecomp-sdc-rest-webapp / vendor-license-rest / vendor-license-rest-services / src / main / java / org / openecomp / sdcrests / vendorlicense / rest / VendorLicenseModels.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdcrests.vendorlicense.rest;
22
23 import io.swagger.annotations.Api;
24 import io.swagger.annotations.ApiOperation;
25 import io.swagger.annotations.ApiParam;
26 import org.openecomp.sdcrests.common.RestConstants;
27 import org.openecomp.sdcrests.item.types.ItemDto;
28 import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelActionRequestDto;
29 import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelEntityDto;
30 import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelRequestDto;
31 import org.springframework.validation.annotation.Validated;
32
33 import javax.validation.Valid;
34 import javax.validation.constraints.NotNull;
35 import javax.ws.rs.Consumes;
36 import javax.ws.rs.DELETE;
37 import javax.ws.rs.GET;
38 import javax.ws.rs.HeaderParam;
39 import javax.ws.rs.POST;
40 import javax.ws.rs.PUT;
41 import javax.ws.rs.Path;
42 import javax.ws.rs.PathParam;
43 import javax.ws.rs.Produces;
44 import javax.ws.rs.QueryParam;
45 import javax.ws.rs.core.MediaType;
46 import javax.ws.rs.core.Response;
47
48 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
49
50
51 @Path("/v1.0/vendor-license-models")
52 @Produces(MediaType.APPLICATION_JSON)
53 @Consumes(MediaType.APPLICATION_JSON)
54 @Api(value = "Vendor License Models")
55 @Validated
56 public interface VendorLicenseModels {
57
58   @GET
59   @Path("/")
60   @ApiOperation(value = "List vendor license models",
61       response = ItemDto.class,
62       responseContainer = "List")
63   Response listLicenseModels(@ApiParam(value =
64       "Currently supported value: 'Certified' - only vendor License models with final versions "
65           + "will be return - with their latest final version")
66                              @QueryParam("versionFilter") String versionStatus,
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   @PUT
78   @Path("/{vlmId}/versions/{versionId}")
79   @ApiOperation(value = "Update vendor license model")
80   Response updateLicenseModel(@Valid VendorLicenseModelRequestDto request,
81                               @ApiParam(value = "Vendor license model Id")
82                               @PathParam("vlmId") String vlmId,
83                               @ApiParam(value = "Vendor license model version Id")
84                               @PathParam("versionId") String versionId,
85                               @NotNull(message = USER_MISSING_ERROR_MSG)
86                               @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
87
88   @GET
89   @Path("/{vlmId}/versions/{versionId}")
90   @ApiOperation(value = "Get vendor license model",
91       response = VendorLicenseModelEntityDto.class)
92   Response getLicenseModel(
93       @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
94       @ApiParam(value = "Vendor license model version Id") @PathParam
95           ("versionId") String versionId,
96       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM)
97           String user);
98
99   @DELETE
100   @Path("/{vlmId}/versions/{versionId}")
101   @ApiOperation(value = "Delete vendor license model")
102   Response deleteLicenseModel(
103       @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
104       @ApiParam(value = "Vendor license model version Id") @PathParam
105           ("versionId") String versionId,
106       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM)
107           String user);
108
109   @PUT
110   @Path("/{vlmId}/versions/{versionId}/actions")
111   @ApiOperation(value = "Update vendor license model")
112   Response actOnLicenseModel(@Valid VendorLicenseModelActionRequestDto request,
113                              @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
114                                  String vlmId,
115                              @ApiParam(value = "Vendor license model version Id") @PathParam
116                                  ("versionId") String versionId,
117                              @NotNull(message = USER_MISSING_ERROR_MSG)
118                              @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
119 }