2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.sdcrests.itempermissions.rest;
24 import io.swagger.v3.oas.annotations.Operation;
25 import io.swagger.v3.oas.annotations.info.Info;
26 import io.swagger.v3.oas.annotations.media.ArraySchema;
27 import io.swagger.v3.oas.annotations.media.Content;
28 import io.swagger.v3.oas.annotations.media.Schema;
29 import io.swagger.v3.oas.annotations.responses.ApiResponse;
30 import io.swagger.v3.oas.annotations.tags.Tag;
31 import io.swagger.v3.oas.annotations.tags.Tags;
32 import org.openecomp.sdcrests.itempermissions.types.ItemPermissionsDto;
33 import org.openecomp.sdcrests.itempermissions.types.ItemPermissionsRequestDto;
34 import org.springframework.validation.annotation.Validated;
36 import javax.validation.Valid;
37 import javax.validation.constraints.NotNull;
39 import javax.ws.rs.core.MediaType;
40 import javax.ws.rs.core.Response;
42 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
43 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
46 * Created by ayalaben on 6/18/2017.
48 @Path("/v1.0/items/{itemId}/permissions")
49 @Produces(MediaType.APPLICATION_JSON)
50 @Consumes(MediaType.APPLICATION_JSON)
51 @Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Item Permissions")})
53 public interface ItemPermissions {
57 @Operation(description = "List users permissions assigned on item",responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ItemPermissionsDto.class)))))
58 Response list(@PathParam("itemId") String itemId,
59 @HeaderParam(USER_ID_HEADER_PARAM) String user);
62 @Path("/{permission}")
63 @Operation(description = "Update useres permission on item")
64 Response updatePermissions(@Valid ItemPermissionsRequestDto request,
65 @PathParam("itemId") String itemId,
66 @PathParam("permission") String permission,
67 @NotNull(message = USER_MISSING_ERROR_MSG)
68 @HeaderParam(USER_ID_HEADER_PARAM) String user);