use of io.pravega.shared.controller.tracing.RPCTracingTags.GET_STREAM_CONFIGURATION in project pravega by pravega.
the class ControllerServiceImpl method getStreamConfiguration.
@Override
public void getStreamConfiguration(StreamInfo request, StreamObserver<StreamConfig> responseObserver) {
RequestTag requestTag = requestTracker.initializeAndTrackRequestTag(controllerService.nextRequestId(), GET_STREAM_CONFIGURATION);
String scope = request.getScope();
String stream = request.getStream();
log.info(requestTag.getRequestId(), "{} called for {}/{}.", GET_STREAM_CONFIGURATION, scope, stream);
final AuthContext ctx;
if (this.grpcAuthHelper.isAuthEnabled()) {
ctx = AuthContext.current();
} else {
ctx = null;
}
Supplier<String> stringSupplier = () -> {
String result = this.grpcAuthHelper.checkAuthorization(authorizationResource.ofStreamInScope(scope, stream), AuthHandler.Permissions.READ, ctx);
log.debug("Result of authorization for [{}] and READ permission is: [{}]", authorizationResource.ofScopes(), result);
return result;
};
Function<String, CompletableFuture<StreamConfig>> streamFn = delegationToken -> controllerService.getStream(scope, stream, requestTag.getRequestId()).handle((response, e) -> {
if (e != null) {
throw new CompletionException(e);
} else {
return decode(scope, stream, response);
}
});
authenticateExecuteAndProcessResults(stringSupplier, streamFn, responseObserver, requestTag);
}
Aggregations