The Rust client libraries automatically configure the endpoint for each service. Some applications may need to override the default endpoint either because their network has specific requirements, or because they need to use regional versions of the service. This guide shows you how to override the default.
Prerequisites
This guide uses the Secret Manager API. To enable this API, follow the service quickstart.
For complete setup instructions for the Rust client libraries, see Getting started with Rust.
Dependencies
You must declare the dependencies in your Cargo.toml file:
cargo add google-cloud-secretmanager-v1 google-cloud-gax
The default endpoint
First, review how to use the client libraries with the default endpoint. Start by writing some use declarations to simplify the rest of the example:
Write the example in a function that receives the project ID as a parameter:
Add some use declarations simplify the example code:
Initialize the client using the defaults: