public class Sink extends SinkInfo
Sink destination can either be a Google Cloud Storage bucket (see SinkInfo.Destination.BucketDestination
, a Google Cloud BigQuery dataset (see SinkInfo.Destination.DatasetDestination
) or a Google CloudPub/Sub topic (see SinkInfo.Destination.TopicDestination
).
Sink
adds a layer of service-related functionality over SinkInfo
. Objects of
this class are immutable. To get a Sink
object with the most recent information use
reload()
or reloadAsync()
.
Modifier and Type | Class and Description |
---|---|
static class |
Sink.Builder
A builder for
Sink objects. |
SinkInfo.Destination, SinkInfo.VersionFormat
Modifier and Type | Method and Description |
---|---|
boolean |
delete()
Deletes this sink.
|
com.google.api.core.ApiFuture<Boolean> |
deleteAsync()
Sends a request for deleting this sink.
|
boolean |
equals(Object obj) |
Logging |
getLogging()
Returns the sinks's
Logging object used to issue requests. |
int |
hashCode() |
Sink |
reload()
Fetches current sink's latest information.
|
com.google.api.core.ApiFuture<Sink> |
reloadAsync()
Sends a request to fetch current sink's latest information.
|
Sink.Builder |
toBuilder()
Returns a builder for this
SinkInfo object. |
Sink |
update()
Updates current sink.
|
com.google.api.core.ApiFuture<Sink> |
updateAsync()
Sends a request to update current sink.
|
getDestination, getFilter, getName, getVersionFormat, newBuilder, of, toString
public Sink.Builder toBuilder()
SinkInfo
SinkInfo
object.public Logging getLogging()
Logging
object used to issue requests.public boolean delete()
Example of deleting the sink.
boolean deleted = sink.delete();
if (deleted) {
// the sink was deleted
} else {
// the sink was not found
}
true
if the sink was deleted, false
if it was not foundLoggingException
- upon failurepublic com.google.api.core.ApiFuture<Boolean> deleteAsync()
ApiFuture
object to
consume the result. Future.get()
returns true
if the sink was deleted,
false
if it was not found.
Example of asynchronously deleting the sink.
ApiFuture<Boolean> future = sink.deleteAsync();
// ...
boolean deleted = future.get();
if (deleted) {
// the sink was deleted
} else {
// the sink was not found
}
LoggingException
- upon failurepublic Sink reload()
null
if the sink does not exist.
Example of getting the sink's latest information.
Sink latestSink = sink.reload();
if (latestSink == null) {
// the sink was not found
}
Sink
object with latest information or null
if not foundLoggingException
- upon failurepublic com.google.api.core.ApiFuture<Sink> reloadAsync()
ApiFuture
object to consume the result. Future.get()
returns a Sink
object
with latest information or null
if not found.
Example of asynchronously getting the sink's latest information.
ApiFuture<Sink> future = sink.reloadAsync();
// ...
Sink latestSink = future.get();
if (latestSink == null) {
// the sink was not found
}
LoggingException
- upon failurepublic Sink update()
Example of updating the sink's information.
Sink updatedSink = sink.toBuilder()
.setFilter("severity<=ERROR")
.build()
.update();
Sink
object with updated informationLoggingException
- upon failurepublic com.google.api.core.ApiFuture<Sink> updateAsync()
ApiFuture
object to consume the result. Future.get()
returns a
Sink
object with updated information.
Example of asynchronously updating the sink's information.
ApiFuture<Sink> future = sink.toBuilder()
.setFilter("severity<=ERROR")
.build()
.updateAsync();
// ...
Sink updatedSink = future.get();
LoggingException
- upon failureCopyright © 2023 Google LLC. All rights reserved.