Search in sources :

Example 1 with UsersDelegate

use of org.wso2.ei.dashboard.micro.integrator.delegates.UsersDelegate in project product-mi-tooling by wso2.

the class GroupsApi method getUsers.

@GET
@Path("/{group-id}/users")
@Produces({ "application/json" })
@Operation(summary = "Get users", description = "", tags = { "Users" })
@ApiResponses(value = { @ApiResponse(responseCode = "200", description = "List of users", content = @Content(schema = @Schema(implementation = Users.class))), @ApiResponse(responseCode = "200", description = "Unexpected error", content = @Content(schema = @Schema(implementation = Error.class))) })
public Response getUsers(@PathParam("group-id") @Parameter(description = "Group ID of the node") String groupId) throws ManagementApiException {
    UsersDelegate usersDelegate = new UsersDelegate();
    Users users = usersDelegate.fetchUsers(groupId);
    Response.ResponseBuilder responseBuilder = Response.ok().entity(users);
    HttpUtils.setHeaders(responseBuilder);
    return responseBuilder.build();
}
Also used : Response(javax.ws.rs.core.Response) ApiResponse(io.swagger.v3.oas.annotations.responses.ApiResponse) UsersDelegate(org.wso2.ei.dashboard.micro.integrator.delegates.UsersDelegate) Users(org.wso2.ei.dashboard.core.rest.model.Users) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses)

Example 2 with UsersDelegate

use of org.wso2.ei.dashboard.micro.integrator.delegates.UsersDelegate in project product-mi-tooling by wso2.

the class GroupsApi method addUser.

@POST
@Path("/{group-id}/users")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@Operation(summary = "Add user", description = "", tags = { "Users" })
@ApiResponses(value = { @ApiResponse(responseCode = "200", description = "User insert status", content = @Content(schema = @Schema(implementation = SuccessStatus.class))), @ApiResponse(responseCode = "200", description = "Unexpected error", content = @Content(schema = @Schema(implementation = Error.class))) })
public Response addUser(@PathParam("group-id") @Parameter(description = "Group ID of the node") String groupId, @Valid AddUserRequest request) throws ManagementApiException {
    UsersDelegate usersDelegate = new UsersDelegate();
    Ack ack = usersDelegate.addUser(groupId, request);
    Response.ResponseBuilder responseBuilder = Response.ok().entity(ack);
    HttpUtils.setHeaders(responseBuilder);
    return responseBuilder.build();
}
Also used : Response(javax.ws.rs.core.Response) ApiResponse(io.swagger.v3.oas.annotations.responses.ApiResponse) UsersDelegate(org.wso2.ei.dashboard.micro.integrator.delegates.UsersDelegate) Ack(org.wso2.ei.dashboard.core.rest.model.Ack) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses)

Example 3 with UsersDelegate

use of org.wso2.ei.dashboard.micro.integrator.delegates.UsersDelegate in project product-mi-tooling by wso2.

the class GroupsApi method deleteUser.

@DELETE
@Path("/{group-id}/users/{user-id}")
@Produces({ "application/json" })
@Operation(summary = "Delete user", description = "", tags = { "Users" })
@ApiResponses(value = { @ApiResponse(responseCode = "200", description = "User deletion status", content = @Content(schema = @Schema(implementation = SuccessStatus.class))), @ApiResponse(responseCode = "200", description = "Unexpected error", content = @Content(schema = @Schema(implementation = Error.class))) })
public Response deleteUser(@PathParam("group-id") @Parameter(description = "Group ID") String groupId, @PathParam("user-id") @Parameter(description = "User ID") String userId) throws ManagementApiException {
    UsersDelegate usersDelegate = new UsersDelegate();
    Ack ack = usersDelegate.deleteUser(groupId, userId);
    Response.ResponseBuilder responseBuilder = Response.ok().entity(ack);
    HttpUtils.setHeaders(responseBuilder);
    return responseBuilder.build();
}
Also used : Response(javax.ws.rs.core.Response) ApiResponse(io.swagger.v3.oas.annotations.responses.ApiResponse) UsersDelegate(org.wso2.ei.dashboard.micro.integrator.delegates.UsersDelegate) Ack(org.wso2.ei.dashboard.core.rest.model.Ack) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses)

Aggregations

Operation (io.swagger.v3.oas.annotations.Operation)3 ApiResponse (io.swagger.v3.oas.annotations.responses.ApiResponse)3 ApiResponses (io.swagger.v3.oas.annotations.responses.ApiResponses)3 Response (javax.ws.rs.core.Response)3 UsersDelegate (org.wso2.ei.dashboard.micro.integrator.delegates.UsersDelegate)3 Ack (org.wso2.ei.dashboard.core.rest.model.Ack)2 Users (org.wso2.ei.dashboard.core.rest.model.Users)1