15#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_WELL_KNOWN_PARAMETERS_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_WELL_KNOWN_PARAMETERS_H
18#include "google/cloud/storage/version.h"
19#include "google/cloud/internal/ios_flags_saver.h"
20#include "google/cloud/optional.h"
21#include "absl/types/optional.h"
29GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
32
33
34
35
36
37template <
typename P,
typename T>
38class WellKnownParameter {
40 WellKnownParameter() =
default;
41 explicit WellKnownParameter(T&& value) : value_(std::forward<T>(value)) {}
42 explicit WellKnownParameter(T
const& value) : value_(value) {}
44 char const* parameter_name()
const {
return P::well_known_parameter_name(); }
45 bool has_value()
const {
return value_.has_value(); }
46 T
const& value()
const {
return value_.value(); }
48 T value_or(U&& default_val) {
49 return value_.value_or(std::forward<U>(default_val));
53 absl::optional<T> value_;
56template <
typename P,
typename T>
57std::ostream& operator<<(std::ostream& os,
58 WellKnownParameter<P, T>
const& rhs) {
59 if (rhs.has_value()) {
60 return os << rhs.parameter_name() <<
"=" << rhs.value();
62 return os << rhs.parameter_name() <<
"=<not set>";
66std::ostream& operator<<(std::ostream& os,
67 WellKnownParameter<P,
bool>
const& rhs) {
68 if (rhs.has_value()) {
70 return os << rhs.parameter_name() <<
"=" << std::boolalpha << rhs.value();
72 return os << rhs.parameter_name() <<
"=<not set>";
77
78
79
80
81
84 using WellKnownParameter<
ContentEncoding, std::string>::WellKnownParameter;
89
90
91struct Deleted :
public internal::WellKnownParameter<
Deleted,
bool> {
92 using WellKnownParameter<
Deleted,
bool>::WellKnownParameter;
97
98
99
100
101
102
103
104
105
106
107
108
112 std::string>::WellKnownParameter;
114 return "destinationKmsKeyName";
119
120
121
122
123
124
125
126
127
128
129struct Fields :
public internal::WellKnownParameter<
Fields, std::string> {
130 using WellKnownParameter<
Fields, std::string>::WellKnownParameter;
135
136
137
138
139
140
141
142
143
145 :
public internal::WellKnownParameter<
Generation, std::int64_t> {
146 using WellKnownParameter<
Generation, std::int64_t>::WellKnownParameter;
151
152
153
154
155
163
164
165
166
167
171 std::int64_t>::WellKnownParameter;
173 return "ifGenerationNotMatch";
178
179
183 std::int64_t>::WellKnownParameter;
185 return "ifMetagenerationMatch";
190
191
196 std::int64_t>::WellKnownParameter;
198 return "ifMetagenerationNotMatch";
203
204
205
206
207
212 std::int64_t>::WellKnownParameter;
214 return "ifSourceGenerationMatch";
219
220
221
226 std::int64_t>::WellKnownParameter;
228 return "ifSourceGenerationNotMatch";
233
234
235
240 std::int64_t>::WellKnownParameter;
242 return "ifSourceMetagenerationMatch";
247
248
249
254 std::int64_t>::WellKnownParameter;
256 return "ifSourceMetagenerationNotMatch";
261
262
263
264
265
266
267
268
269
270
271
272
274 :
public internal::WellKnownParameter<
KmsKeyName, std::string> {
275 using WellKnownParameter<
KmsKeyName, std::string>::WellKnownParameter;
280
281
282
283
284
285
287 :
public internal::WellKnownParameter<
MaxResults, std::int64_t> {
288 using WellKnownParameter<
MaxResults, std::int64_t>::WellKnownParameter;
293
294
295
296
297
298
303 std::int64_t>::WellKnownParameter;
305 return "maxBytesRewrittenPerCall";
310
311
312
313
314
315
316
317
318
320 :
public internal::WellKnownParameter<
PredefinedAcl, std::string> {
321 using WellKnownParameter<
PredefinedAcl, std::string>::WellKnownParameter;
346
347
348
349
350
351
352
353
354
359 std::string>::WellKnownParameter;
361 return "destinationPredefinedAcl";
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
404 std::string>::WellKnownParameter;
406 return "predefinedDefaultObjectAcl";
430
431
432
433
434
435
436struct Prefix :
public internal::WellKnownParameter<
Prefix, std::string> {
437 using WellKnownParameter<
Prefix, std::string>::WellKnownParameter;
442
443
444
445
446
447
448
449
450
452 using WellKnownParameter<
Delimiter, std::string>::WellKnownParameter;
457
458
459
460
461
462
463
468 return "includeTrailingDelimiter";
473
474
475
476
477
478
480 :
public internal::WellKnownParameter<
StartOffset, std::string> {
481 using WellKnownParameter<
StartOffset, std::string>::WellKnownParameter;
486
487
488
489
490
492 using WellKnownParameter<
EndOffset, std::string>::WellKnownParameter;
497
498
499
500
501
502
503
504
505
507 :
public internal::WellKnownParameter<
Projection, std::string> {
508 using WellKnownParameter<
Projection, std::string>::WellKnownParameter;
516
517
518
519
520
521
522
523
525 using WellKnownParameter<
QuotaUser, std::string>::WellKnownParameter;
530
531
535 std::string>::WellKnownParameter;
537 return "serviceAccountEmail";
542
543
544
545
546
547
548
549
550
551
554 using WellKnownParameter<
SourceGeneration, std::int64_t>::WellKnownParameter;
559
560
561
562
563
564
565
566
567
568
569
570
571
573 :
public internal::WellKnownParameter<
UserProject, std::string> {
574 using WellKnownParameter<
UserProject, std::string>::WellKnownParameter;
579
580
581
582
583
584
585
586
588 using WellKnownParameter<
Versions,
bool>::WellKnownParameter;
593
594
595
596
597
598
599
600
605 std::int64_t>::WellKnownParameter;
607 return "optionsRequestedPolicyVersion";
611GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Contains all the Google Cloud Storage C++ client APIs.
Definition: auto_finalize.h:24
Sets the contentEncoding option for object uploads.
Definition: well_known_parameters.h:83
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:85
Included deleted HMAC keys in list requests.
Definition: well_known_parameters.h:91
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:93
Returns results in a directory-like mode.
Definition: well_known_parameters.h:451
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:453
Configure the Customer-Managed Encryption Key (CMEK) for an rewrite.
Definition: well_known_parameters.h:110
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:113
Set the ACL to a predefined value when copying Objects.
Definition: well_known_parameters.h:357
static DestinationPredefinedAcl AuthenticatedRead()
Definition: well_known_parameters.h:364
static DestinationPredefinedAcl PublicRead()
Definition: well_known_parameters.h:379
static DestinationPredefinedAcl BucketOwnerRead()
Definition: well_known_parameters.h:370
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:360
static DestinationPredefinedAcl BucketOwnerFullControl()
Definition: well_known_parameters.h:367
static DestinationPredefinedAcl ProjectPrivate()
Definition: well_known_parameters.h:376
static DestinationPredefinedAcl Private()
Definition: well_known_parameters.h:373
Filter results to objects whose names are lexicographically before EndOffset.
Definition: well_known_parameters.h:491
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:493
Defines the fields query parameter.
Definition: well_known_parameters.h:129
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:131
Set the version of an object to operate on.
Definition: well_known_parameters.h:145
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:147
A pre-condition: the request succeeds only if the object generation matches.
Definition: well_known_parameters.h:157
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:159
A pre-condition: the request succeeds unless the object generation matches.
Definition: well_known_parameters.h:169
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:172
A pre-condition: the request succeeds if the source object generation matches.
Definition: well_known_parameters.h:210
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:213
A pre-condition: the request succeeds unless the source object generation matches.
Definition: well_known_parameters.h:224
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:227
If true, objects that end in exactly one instance of delimiter have their metadata included in items[...
Definition: well_known_parameters.h:465
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:467
Configure the Customer-Managed Encryption Key (CMEK) for an upload.
Definition: well_known_parameters.h:274
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:276
Limit the number of bytes rewritten in a Objects: rewrite step.
Definition: well_known_parameters.h:301
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:304
Limit the number of results per page when listing Buckets and Objects.
Definition: well_known_parameters.h:287
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:289
Set the ACL to predefined values when creating Buckets or Objects.
Definition: well_known_parameters.h:320
static PredefinedAcl BucketOwnerFullControl()
Definition: well_known_parameters.h:327
static PredefinedAcl ProjectPrivate()
Definition: well_known_parameters.h:334
static PredefinedAcl PublicReadWrite()
Definition: well_known_parameters.h:338
static PredefinedAcl BucketOwnerRead()
Definition: well_known_parameters.h:330
static PredefinedAcl AuthenticatedRead()
Definition: well_known_parameters.h:324
std::string HeaderName() const
static PredefinedAcl PublicRead()
Definition: well_known_parameters.h:337
static PredefinedAcl Private()
Definition: well_known_parameters.h:333
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:322
Set the default object ACL to a predefined value in a Bucket.
Definition: well_known_parameters.h:402
static PredefinedDefaultObjectAcl AuthenticatedRead()
Definition: well_known_parameters.h:409
static PredefinedDefaultObjectAcl ProjectPrivate()
Definition: well_known_parameters.h:421
static PredefinedDefaultObjectAcl PublicRead()
Definition: well_known_parameters.h:424
static PredefinedDefaultObjectAcl Private()
Definition: well_known_parameters.h:418
static PredefinedDefaultObjectAcl BucketOwnerRead()
Definition: well_known_parameters.h:415
static PredefinedDefaultObjectAcl BucketOwnerFullControl()
Definition: well_known_parameters.h:412
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:405
Restrict list operations to entries starting with this value.
Definition: well_known_parameters.h:436
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:438
Controls what metadata fields are included in the response.
Definition: well_known_parameters.h:507
static Projection Full()
Definition: well_known_parameters.h:512
static Projection NoAcl()
Definition: well_known_parameters.h:511
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:509
Sets the user for this operation for quota enforcement purposes.
Definition: well_known_parameters.h:524
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:526
Controls the IAM policy version returned by IAM queries.
Definition: well_known_parameters.h:603
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:606
Only list HMAC keys belonging to a specific Service Account.
Definition: well_known_parameters.h:533
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:536
Set the generation for the source object in copy operations.
Definition: well_known_parameters.h:553
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:555
Filter results to objects whose names are lexicographically equal to or after StartOffset.
Definition: well_known_parameters.h:480
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:482
Set the project used for billing in "requester pays" Buckets.
Definition: well_known_parameters.h:573
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:575
Control if all versions of an object should be included when listing objects.
Definition: well_known_parameters.h:587
static char const * well_known_parameter_name()
Definition: well_known_parameters.h:589