-
Notifications
You must be signed in to change notification settings - Fork 444
Expand file tree
/
Copy pathstorage-main.dox
More file actions
142 lines (109 loc) · 6.54 KB
/
storage-main.dox
File metadata and controls
142 lines (109 loc) · 6.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/*!
@mainpage Google Cloud Storage C++ Client Library
The Google Cloud Storage (GCS) C++ Client library offers types and functions
access GCS from C++ applications. It offers full access to the GCS API,
including operations to list, read, write, and delete
[GCS objects][object-definition-link] and [buckets][bucket-definition-link].
The library also provides functions to modify the IAM permissions on buckets,
read and modify the metadata associated with objects and buckets, configure
encryption keys, configure notifications via Cloud Pub/Sub, and change the
access control list of object or buckets.
@tableofcontents{HTML:2}
## Quickstart
The following "Hello World" program should give you a taste of this library.
This program is also used to illustrate how to incorporate the library into your
project.
@snippet quickstart.cc all
## More Information
- [ReadObject()] - the function to read object data.
- [WriteObject()] - the function to write objects.
- [InsertObject()] - the function to write small objects.
- @ref storage-error to learn how the library reports run-time errors.
- @ref storage-env for environment variables affecting the library. Some of
these environment variables enable logging to the console. This can be an
effective approach to diagnose runtime problems.
- @ref storage-endpoint-example
- @ref storage-auth-example
- @ref storage-retry-examples
- @ref storage-universe-domain-example
- @ref storage-mocking shows how to write tests mocking the [Client] class
- The [Setting up your development environment] guide describes how to set up
a C++ development environment in various platforms, including the Google Cloud
C++ client libraries.
[Client]: @ref google::cloud::storage::Client
[ReadObject()]: @ref google::cloud::storage::Client::ReadObject()
[WriteObject()]: @ref google::cloud::storage::Client::WriteObject()
[InsertObject()]: @ref google::cloud::storage::Client::InsertObject()
[ListObjects()]: @ref google::cloud::storage::Client::ListObjects()
[DeleteObject()]: @ref google::cloud::storage::Client::DeleteObject()
[gcs-quickstart]: https://cloud.google.com/storage/docs/introduction#quickstarts 'GCS Quickstarts'
[resource-link]: https://console.cloud.google.com/cloud-resource-manager 'Console Resource Manager'
[billing-link]: https://cloud.google.com/billing/docs/how-to/modify-project 'How to: Modify Project'
[concepts-link]: https://cloud.google.com/storage/docs/concepts 'GCS Concepts'
[authentication-quickstart]: https://cloud.google.com/docs/authentication/client-libraries 'Authenticate for using client libraries'
[gcloud-quickstart]: https://cloud.google.com/sdk/docs/quickstarts
[bucket-definition-link]: https://cloud.google.com/storage/docs/key-terms#buckets
[object-definition-link]: https://cloud.google.com/storage/docs/key-terms#objects
[github-link]: https://github.com/googleapis/google-cloud-cpp 'GitHub Repository'
[project-readme]: https://github.com/googleapis/google-cloud-cpp#readme
[project-build]: https://github.com/googleapis/google-cloud-cpp#building-and-installing
[howto-setup-dev-workstation]: https://github.com/googleapis/google-cloud-cpp/blob/main/doc/contributor/howto-guide-setup-development-workstation.md
[quickstart guide]: https://github.com/googleapis/google-cloud-cpp/tree/main/google/cloud/storage/quickstart#readme
[packaging guide]: https://github.com/googleapis/google-cloud-cpp/blob/main/doc/packaging%2Emd
[Setting up your development environment]: https://cloud.google.com/cpp/docs/setup
*/
/**
@page storage-endpoint-example Override 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
*/
/**
@page storage-auth-example Override the authentication configuration
Some applications cannot use the default authentication mechanism (known as
[Application Default Credentials]). You can override this default using
`google::cloud::UnifiedCredentialsOption`. The following example shows how
to explicitly load a service account key file.
@snippet storage_client_initialization_samples.cc service-account-keyfile
Keep in mind that we chose this as an example because it is relatively easy to
understand. Consult the [Best practices for managing service account keys]
guide for more details.
@see @ref guac - for more information on the factory functions to create
`google::cloud::Credentials` objects.
[Best practices for managing service account keys]: https://cloud.google.com/iam/docs/best-practices-for-managing-service-account-keys
[Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
*/
/**
@page storage-retry-examples Override the default retry policies
The library automatically retries requests that fail with transient errors, and
follows the [recommended
practice](https://cloud.google.com/storage/docs/exponential-backoff) to backoff
between retries. Application developers can override the default
[retry](@ref google::cloud::storage::RetryPolicy) and
[backoff](@ref google::cloud::storage::BackoffPolicy) policies:
@snippet storage_object_samples.cc insert object modified retry
The default policies are to continue retrying for up to 15 minutes, and to
use truncated (at 5 minutes) exponential backoff, doubling the maximum backoff
period between retries.
By default the library retries all operations, even those that are not
idempotent. Application developers can override the
[idempotency policy](@ref google::cloud::storage::IdempotencyPolicy) to follow a
more conservative approach:
@snippet storage_object_samples.cc insert object strict idempotency
@see [LimitedTimeRetryPolicy](@ref google::cloud::storage::LimitedTimeRetryPolicy)
and [LimitedErrorCountRetryPolicy](@ref google::cloud::storage::LimitedErrorCountRetryPolicy)
for alternative retry policies.
@see [ExponentialBackoffPolicy](@ref google::cloud::storage::ExponentialBackoffPolicy)
to configure different parameters for the exponential backoff policy.
@see [AlwaysRetryIdempotencyPolicy](@ref google::cloud::storage::AlwaysRetryIdempotencyPolicy)
and [StrictIdempotencyPolicy](@ref google::cloud::storage::StrictIdempotencyPolicy)
for alternative idempotency policies.
*/
/**
@page storage-universe-domain-example Override the Default Universe Domain
In some cases, you may need to override the default universe domain used by the
client library. Use `AddUniverseDomainOption` when initializing the client
library to change this default.
@snippet storage_client_initialization_samples.cc set-client-universe-domain
*/