Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc(storage): common initialization examples #10107

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps s/Override/Overriding/ to match above, or vice versa?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


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