pub struct Operations { /* private fields */ }Expand description
Implements a client for the Long Running Operations API.
§Example
let client = Operations::builder().build().await?;
// use `client` to make requests to the Long Running Operations API.§Service Description
Manages long-running operations with an API service.
When an API method normally takes long time to complete, it can be designed
to return Operation to the client, and the
client can use this interface to receive the real response asynchronously by
polling the operation resource, or pass the operation resource to another API
(such as Pub/Sub API) to receive the response. Any API service that returns
long-running operations should implement the Operations interface so
developers can have a consistent client experience.
§Configuration
To configure Operations 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://longrunning.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
Operations holds a connection pool internally, it is advised to
create one and the reuse it. You do not need to wrap Operations in
an Rc or Arc to reuse it, because it
already uses an Arc internally.
Implementations§
Source§impl Operations
impl Operations
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Returns a builder for Operations.
let client = Operations::builder().build().await?;Sourcepub fn from_stub<T>(stub: T) -> Selfwhere
T: Operations + 'static,
pub fn from_stub<T>(stub: T) -> Selfwhere
T: Operations + '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 list_operations(&self) -> ListOperations
pub fn list_operations(&self) -> ListOperations
Lists operations that match the specified filter in the request. If the
server doesn’t support this method, it returns UNIMPLEMENTED.
Sourcepub fn get_operation(&self) -> GetOperation
pub fn get_operation(&self) -> GetOperation
Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
Sourcepub fn delete_operation(&self) -> DeleteOperation
pub fn delete_operation(&self) -> DeleteOperation
Deletes a long-running operation. This method indicates that the client is
no longer interested in the operation result. It does not cancel the
operation. If the server doesn’t support this method, it returns
google.rpc.Code.UNIMPLEMENTED.
Sourcepub fn cancel_operation(&self) -> CancelOperation
pub fn cancel_operation(&self) -> CancelOperation
Starts asynchronous cancellation on a long-running operation. The server
makes a best effort to cancel the operation, but success is not
guaranteed. If the server doesn’t support this method, it returns
google.rpc.Code.UNIMPLEMENTED. Clients can use
Operations.GetOperation or
other methods to check whether the cancellation succeeded or whether the
operation completed despite cancellation. On successful cancellation,
the operation is not deleted; instead, it becomes an operation with
an Operation.error value with a
google.rpc.Status.code of 1, corresponding to
Code.CANCELLED.
Trait Implementations§
Source§impl Clone for Operations
impl Clone for Operations
Source§fn clone(&self) -> Operations
fn clone(&self) -> Operations
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source. Read more