pub struct ServiceUsage { /* private fields */ }
Expand description
Implements a client for the Service Usage API.
§Example
let client = ServiceUsage::builder().build().await?;
// use `client` to make requests to the Service Usage API.
§Service Description
Enables services that service consumers want to use on Google Cloud Platform, lists the available or enabled services, or disables services that service consumers no longer use.
§Configuration
To configure ServiceUsage
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://serviceusage.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
ServiceUsage
holds a connection pool internally, it is advised to
create one and the reuse it. You do not need to wrap ServiceUsage
in
an Rc or Arc to reuse it, because it
already uses an Arc
internally.
Implementations§
Source§impl ServiceUsage
impl ServiceUsage
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Returns a builder for ServiceUsage.
let client = ServiceUsage::builder().build().await?;
Sourcepub fn from_stub<T>(stub: T) -> Selfwhere
T: ServiceUsage + 'static,
pub fn from_stub<T>(stub: T) -> Selfwhere
T: ServiceUsage + '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 enable_service(&self) -> EnableService
pub fn enable_service(&self) -> EnableService
Enable a service so that it can be used with a project.
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
Sourcepub fn disable_service(&self) -> DisableService
pub fn disable_service(&self) -> DisableService
Disable a service so that it can no longer be used with a project. This prevents unintended usage that may cause unexpected billing charges or security leaks.
It is not valid to call the disable method on a service that is not
currently enabled. Callers will receive a FAILED_PRECONDITION
status if
the target service is not currently enabled.
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
Sourcepub fn get_service(&self) -> GetService
pub fn get_service(&self) -> GetService
Returns the service configuration and enabled state for a given service.
Sourcepub fn list_services(&self) -> ListServices
pub fn list_services(&self) -> ListServices
List all services available to the specified project, and the current
state of those services with respect to the project. The list includes
all public services, all services for which the calling user has the
servicemanagement.services.bind
permission, and all services that have
already been enabled on the project. The list can be filtered to
only include services in a specific state, for example to only include
services enabled on the project.
WARNING: If you need to query enabled services frequently or across an organization, you should use Cloud Asset Inventory API, which provides higher throughput and richer filtering capability.
Sourcepub fn batch_enable_services(&self) -> BatchEnableServices
pub fn batch_enable_services(&self) -> BatchEnableServices
Enable multiple services on a project. The operation is atomic: if enabling
any service fails, then the entire batch fails, and no state changes occur.
To enable a single service, use the EnableService
method instead.
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
Sourcepub fn batch_get_services(&self) -> BatchGetServices
pub fn batch_get_services(&self) -> BatchGetServices
Returns the service configurations and enabled states for a given list of services.
Sourcepub fn list_operations(&self) -> ListOperations
pub fn list_operations(&self) -> ListOperations
Provides the Operations service functionality in this service.
Sourcepub fn get_operation(&self) -> GetOperation
pub fn get_operation(&self) -> GetOperation
Provides the Operations service functionality in this service.
Trait Implementations§
Source§impl Clone for ServiceUsage
impl Clone for ServiceUsage
Source§fn clone(&self) -> ServiceUsage
fn clone(&self) -> ServiceUsage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more