pub struct ServiceController { /* private fields */ }
Expand description
Implements a client for the Service Control API.
§Example
let client = ServiceController::builder().build().await?;
// use `client` to make requests to the Service Control API.
§Service Description
This API provides admission control and telemetry reporting for services that are integrated with Service Infrastructure.
§Configuration
To configure ServiceController
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://servicecontrol.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
ServiceController
holds a connection pool internally, it is advised to
create one and the reuse it. You do not need to wrap ServiceController
in
an Rc or Arc to reuse it, because it
already uses an Arc
internally.
Implementations§
Source§impl ServiceController
impl ServiceController
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Returns a builder for ServiceController.
let client = ServiceController::builder().build().await?;
Sourcepub fn from_stub<T>(stub: T) -> Selfwhere
T: ServiceController + 'static,
pub fn from_stub<T>(stub: T) -> Selfwhere
T: ServiceController + '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 check(&self) -> Check
pub fn check(&self) -> Check
This method provides admission control for services that are integrated with Service Infrastructure. It checks whether an operation should be allowed based on the service configuration and relevant policies. It must be called before the operation is executed. For more information, see Admission Control.
NOTE: The admission control has an expected policy propagation delay of 60s. The caller must not depend on the most recent policy changes.
NOTE: The admission control has a hard limit of 1 referenced resources per call. If an operation refers to more than 1 resources, the caller must call the Check method multiple times.
This method requires the servicemanagement.services.check
permission
on the specified service. For more information, see
Service Control API Access
Control.
Sourcepub fn report(&self) -> Report
pub fn report(&self) -> Report
This method provides telemetry reporting for services that are integrated with Service Infrastructure. It reports a list of operations that have occurred on a service. It must be called after the operations have been executed. For more information, see Telemetry Reporting.
NOTE: The telemetry reporting has a hard limit of 100 operations and 1MB per Report call.
This method requires the servicemanagement.services.report
permission
on the specified service. For more information, see
Service Control API Access
Control.
Trait Implementations§
Source§impl Clone for ServiceController
impl Clone for ServiceController
Source§fn clone(&self) -> ServiceController
fn clone(&self) -> ServiceController
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more