Search in sources :

Example 11 with Sink

use of com.google.cloud.logging.Sink in project google-cloud-java by GoogleCloudPlatform.

the class LoggingSnippets method getSinkAsync.

/**
   * Example of asynchronously getting a sink.
   */
// [TARGET getSinkAsync(String)]
// [VARIABLE "my_sink_name"]
public Sink getSinkAsync(String sinkName) throws ExecutionException, InterruptedException {
    // [START getSinkAsync]
    Future<Sink> future = logging.getSinkAsync(sinkName);
    // ...
    Sink sink = future.get();
    if (sink == null) {
    // sink was not found
    }
    // [END getSinkAsync]
    return sink;
}
Also used : Sink(com.google.cloud.logging.Sink)

Aggregations

Sink (com.google.cloud.logging.Sink)11 SinkInfo (com.google.cloud.logging.SinkInfo)5 Test (org.junit.Test)2 AsyncPage (com.google.api.gax.paging.AsyncPage)1 Logging (com.google.cloud.logging.Logging)1