Configure a client

The Google Cloud Client Libraries for Rust let you configure client behavior, such as endpoint overrides, authentication methods, and retry policies. You configure a client using a ClientBuilder obtained by calling the service client's builder() method (for example, SecretManagerService::builder()).

Customize the API endpoint

By default, client libraries connect to the global API endpoint for the service. If you need to connect to a regional endpoint or a private access endpoint, you can override the default endpoint configuration. For instructions and examples, see Override the default endpoint.

Configure authentication

While the client attempts to find Application Default Credentials (ADC) automatically, you can explicitly provide credentials using the with_credentials method on the client builder. For instructions and examples, see Override the default authentication method.

Enable logging

You can enable debug logging to inspect requests and responses for troubleshooting. The Rust client libraries use the Tokio tracing crate to collect structured, async-aware diagnostics. For setup instructions, see Enable logging.

Configure a proxy

To configure a proxy, use the standard environment variables supported by reqwest. You don't need to configure proxy settings in your Rust code. Instead, set the following environment variables in your shell or container environment:

export http_proxy="http://proxy.example.com:3128"
export https_proxy="http://proxy.example.com:3128"

Configure retries

The client libraries can automatically retry operations that fail due to transient errors. You can configure default retry policies or override retry limits for specific requests. For instructions and examples, see Configuring retry policies.