use of io.pravega.controller.server.rest.generated.model.ScopeProperty in project pravega by pravega.
the class StreamMetadataResourceImpl method listScopes.
/**
* Implementation of listScopes REST API.
*
* @param securityContext The security for API access.
* @param asyncResponse AsyncResponse provides means for asynchronous server side response processing.
*/
@Override
public void listScopes(final SecurityContext securityContext, final AsyncResponse asyncResponse) {
long traceId = LoggerHelpers.traceEnter(log, "listScopes");
controllerService.listScopes().thenApply(scopesList -> {
ScopesList scopes = new ScopesList();
scopesList.forEach(scope -> scopes.addScopesItem(new ScopeProperty().scopeName(scope)));
return Response.status(Status.OK).entity(scopes).build();
}).exceptionally(exception -> {
log.warn("listScopes failed with exception: " + exception);
return Response.status(Status.INTERNAL_SERVER_ERROR).build();
}).thenApply(asyncResponse::resume).thenAccept(x -> LoggerHelpers.traceLeave(log, "listScopes", traceId));
}
Aggregations