942bc594951ae849dc7992b86f65db2d2df41b9d
[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.item.rest;
17
18 import io.swagger.annotations.Api;
19 import io.swagger.annotations.ApiOperation;
20 import io.swagger.annotations.ApiParam;
21 import org.openecomp.sdcrests.item.types.ItemActionRequestDto;
22 import org.springframework.validation.annotation.Validated;
23
24 import javax.validation.constraints.NotNull;
25 import javax.ws.rs.*;
26 import javax.ws.rs.core.MediaType;
27 import javax.ws.rs.core.Response;
28
29 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
30 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
31
32 @Path("/v1.0/items")
33 @Produces(MediaType.APPLICATION_JSON)
34 @Consumes(MediaType.APPLICATION_JSON)
35 @Api(value = "Items")
36 @Validated
37 public interface Items {
38
39     @GET
40     @Path("/")
41     @ApiOperation(value = "Get list of items according to desired filters",
42             responseContainer = "List")
43     Response list(@ApiParam(value = "Filter by item status", allowableValues = "ACTIVE,ARCHIVED")
44                   @QueryParam("itemStatus") String itemStatusFilter,
45                   @ApiParam(value = "Filter by version status" , allowableValues = "Certified,Draft")
46                   @QueryParam("versionStatus") String versionStatusFilter,
47                   @ApiParam(value = "Filter by item type" , allowableValues = "vsp,vlm")
48                   @QueryParam("itemType") String itemTypeFilter,
49                   @ApiParam(value = "Filter by user permission" , allowableValues = "Owner,Contributor")
50                   @QueryParam("permission") String permissionFilter,
51                   @ApiParam(value = "Filter by onboarding method" , allowableValues = "NetworkPackage,Manual")
52                   @QueryParam("onboardingMethod") String onboardingMethodFilter,
53                   @NotNull(message = USER_MISSING_ERROR_MSG)
54                   @HeaderParam(USER_ID_HEADER_PARAM) String user);
55
56    @GET
57    @Path("/{itemId}")
58    @ApiOperation(value = "Get details of a item")
59    Response getItem(@PathParam("itemId") String itemId,
60                      @NotNull(message = USER_MISSING_ERROR_MSG)
61                      @HeaderParam(USER_ID_HEADER_PARAM) String user);
62
63   @PUT
64   @Path("/{itemId}/actions")
65   @ApiOperation(value = "Acts on item version")
66   Response actOn(ItemActionRequestDto request,
67                  @PathParam("itemId") String itemId,
68                  @NotNull(message = USER_MISSING_ERROR_MSG)
69                  @HeaderParam(USER_ID_HEADER_PARAM) String user);
70
71
72
73
74
75 }