Skip to content

Commit

Permalink
doc(storage): common initialization examples
Browse files Browse the repository at this point in the history
This satisfies the most common requests for additional examples.
  • Loading branch information
coryan committed Oct 26, 2022
1 parent 9693daa commit 98b3017
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions google/cloud/storage/doc/storage-main.dox
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,27 @@ using gcs = ::google::cloud::storage;
}
@endcode

## Overriding the default endpoint

In some cases, you may need to override the default endpoint used by the client
library. The `google::cloud::storage::RestEndpointOption` can be used in this
case:

@snippet storage_client_initialization_samples.cc set-client-endpoint

## Override the authentication configuration

Some applications cannot use the default authentication mechanism (known as
[Application Default Credentials]). You can override the credentials using
`google::cloud::UnifiedCredentialsOption`. The following example shows how
to explicitly load a service account key file. This is not a recommended
practice, as the key needs to be stored in plain text in the file system.
Nevertheless, it illustrates how to change the authentication configuration:

@snippet storage_client_initialization_samples.cc service-account-keyfile

[Application Default Credentials]: https://cloud.google.com/docs/authentication#adc

## Retry, Backoff, and Idempotency Policies.

The library automatically retries requests that fail with transient errors, and
Expand Down

0 comments on commit 98b3017

Please sign in to comment.