pub struct SubscriptionAdmin { /* private fields */ }Expand description
Implements a client for the Cloud Pub/Sub API.
§Example
let client = SubscriptionAdmin::builder().build().await?;
// use `client` to make requests to the Cloud Pub/Sub API.§Service Description
The service that an application uses to manipulate subscriptions.
§Configuration
To configure SubscriptionAdmin use the with_* methods in the type returned
by builder(). The default configuration should
work for most applications. Common configuration changes include
- with_endpoint(): by default this client uses the global default endpoint
(
https://pubsub.googleapis.com). Applications using regional endpoints or running in restricted networks (e.g. a network configured override this default. - with_credentials(): by default this client uses Application Default Credentials. Applications using custom authentication may need to override this default.
§Pooling and Cloning
SubscriptionAdmin holds a connection pool internally, it is advised to
create one and the reuse it. You do not need to wrap SubscriptionAdmin in
an Rc or Arc to reuse it, because it
already uses an Arc internally.
Implementations§
Source§impl SubscriptionAdmin
impl SubscriptionAdmin
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Returns a builder for SubscriptionAdmin.
let client = SubscriptionAdmin::builder().build().await?;Sourcepub fn from_stub<T>(stub: T) -> Selfwhere
T: SubscriptionAdmin + 'static,
pub fn from_stub<T>(stub: T) -> Selfwhere
T: SubscriptionAdmin + 'static,
Creates a new client from the provided stub.
The most common case for calling this function is in tests mocking the client’s behavior.
Sourcepub fn create_subscription(&self) -> CreateSubscription
pub fn create_subscription(&self) -> CreateSubscription
Creates a subscription to a given topic. See the [resource name rules]
(https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
If the subscription already exists, returns ALREADY_EXISTS.
If the corresponding topic doesn’t exist, returns NOT_FOUND.
If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic, conforming to the [resource name format] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The generated name is populated in the returned Subscription object. Note that for REST API requests, you must specify a name in the request.
Sourcepub fn get_subscription(&self) -> GetSubscription
pub fn get_subscription(&self) -> GetSubscription
Gets the configuration details of a subscription.
Sourcepub fn update_subscription(&self) -> UpdateSubscription
pub fn update_subscription(&self) -> UpdateSubscription
Updates an existing subscription by updating the fields specified in the update mask. Note that certain properties of a subscription, such as its topic, are not modifiable.
Sourcepub fn list_subscriptions(&self) -> ListSubscriptions
pub fn list_subscriptions(&self) -> ListSubscriptions
Lists matching subscriptions.
Sourcepub fn delete_subscription(&self) -> DeleteSubscription
pub fn delete_subscription(&self) -> DeleteSubscription
Deletes an existing subscription. All messages retained in the subscription
are immediately dropped. Calls to Pull after deletion will return
NOT_FOUND. After a subscription is deleted, a new one may be created with
the same name, but the new one has no association with the old
subscription or its topic unless the same topic is specified.
Sourcepub fn modify_push_config(&self) -> ModifyPushConfig
pub fn modify_push_config(&self) -> ModifyPushConfig
Modifies the PushConfig for a specified subscription.
This may be used to change a push subscription to a pull one (signified by
an empty PushConfig) or vice versa, or change the endpoint URL and other
attributes of a push subscription. Messages will accumulate for delivery
continuously through the call regardless of changes to the PushConfig.
Sourcepub fn get_snapshot(&self) -> GetSnapshot
pub fn get_snapshot(&self) -> GetSnapshot
Gets the configuration details of a snapshot. Snapshots are used in Seek operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.
Sourcepub fn list_snapshots(&self) -> ListSnapshots
pub fn list_snapshots(&self) -> ListSnapshots
Lists the existing snapshots. Snapshots are used in Seek operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.
Sourcepub fn create_snapshot(&self) -> CreateSnapshot
pub fn create_snapshot(&self) -> CreateSnapshot
Creates a snapshot from the requested subscription. Snapshots are used in
Seek operations,
which allow you to manage message acknowledgments in bulk. That is, you can
set the acknowledgment state of messages in an existing subscription to the
state captured by a snapshot.
If the snapshot already exists, returns ALREADY_EXISTS.
If the requested subscription doesn’t exist, returns NOT_FOUND.
If the backlog in the subscription is too old – and the resulting snapshot
would expire in less than 1 hour – then FAILED_PRECONDITION is returned.
See also the Snapshot.expire_time field. If the name is not provided in
the request, the server will assign a random
name for this snapshot on the same project as the subscription, conforming
to the [resource name format]
(https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The
generated name is populated in the returned Snapshot object. Note that for
REST API requests, you must specify a name in the request.
Sourcepub fn update_snapshot(&self) -> UpdateSnapshot
pub fn update_snapshot(&self) -> UpdateSnapshot
Updates an existing snapshot by updating the fields specified in the update mask. Snapshots are used in Seek operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.
Sourcepub fn delete_snapshot(&self) -> DeleteSnapshot
pub fn delete_snapshot(&self) -> DeleteSnapshot
Removes an existing snapshot. Snapshots are used in [Seek] (https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. When the snapshot is deleted, all messages retained in the snapshot are immediately dropped. After a snapshot is deleted, a new one may be created with the same name, but the new one has no association with the old snapshot or its subscription, unless the same subscription is specified.
Sourcepub fn seek(&self) -> Seek
pub fn seek(&self) -> Seek
Seeks an existing subscription to a point in time or to a given snapshot, whichever is provided in the request. Snapshots are used in [Seek] (https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. Note that both the subscription and the snapshot must be on the same topic.
Trait Implementations§
Source§impl Clone for SubscriptionAdmin
impl Clone for SubscriptionAdmin
Source§fn clone(&self) -> SubscriptionAdmin
fn clone(&self) -> SubscriptionAdmin
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SubscriptionAdmin
impl !RefUnwindSafe for SubscriptionAdmin
impl Send for SubscriptionAdmin
impl Sync for SubscriptionAdmin
impl Unpin for SubscriptionAdmin
impl !UnwindSafe for SubscriptionAdmin
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request