use of com.google.cloud.logging.SinkInfo in project google-cloud-java by GoogleCloudPlatform.
the class LoggingSnippets method createSinkAsync.
/**
* Example of asynchronously creating a sink to export logs to a BigQuery dataset (in the
* {@link LoggingOptions#getProjectId()} project).
*/
// [TARGET createAsync(SinkInfo)]
// [VARIABLE "my_sink_name"]
// [VARIABLE "my_dataset"]
public Sink createSinkAsync(String sinkName, String datasetName) throws ExecutionException, InterruptedException {
// [START createSinkAsync]
SinkInfo sinkInfo = SinkInfo.of(sinkName, DatasetDestination.of(datasetName));
Future<Sink> future = logging.createAsync(sinkInfo);
// ...
Sink sink = future.get();
// [END createSinkAsync]
return sink;
}
Aggregations