1 // Copyright 2018 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_WELL_KNOWN_PARAMETERS_H
16 #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_WELL_KNOWN_PARAMETERS_H
17 
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"
22 #include <cstdint>
23 #include <iomanip>
24 #include <string>
25 
26 namespace google {
27 namespace cloud {
28 namespace storage {
29 inline namespace STORAGE_CLIENT_NS {
30 namespace internal {
31 /**
32  * Defines well-known request headers using the CRTP.
33  *
34  * @tparam P the type we will use to represent the query parameter.
35  * @tparam T the C++ type of the query parameter
36  */
37 template <typename P, typename T>
38 class WellKnownParameter {
39  public:
40   WellKnownParameter() = default;
WellKnownParameter(T && value)41   explicit WellKnownParameter(T&& value) : value_(std::forward<T>(value)) {}
WellKnownParameter(T const & value)42   explicit WellKnownParameter(T const& value) : value_(value) {}
43 
parameter_name()44   char const* parameter_name() const { return P::well_known_parameter_name(); }
has_value()45   bool has_value() const { return value_.has_value(); }
value()46   T const& value() const { return value_.value(); }
47   template <typename U>
value_or(U && default_val)48   T value_or(U&& default_val) {
49     return value_.value_or(std::forward<U>(default_val));
50   }
51 
52  private:
53   absl::optional<T> value_;
54 };
55 
56 template <typename P, typename T>
57 std::ostream& operator<<(std::ostream& os,
58                          WellKnownParameter<P, T> const& rhs) {
59   if (rhs.has_value()) {
60     return os << rhs.parameter_name() << "=" << rhs.value();
61   }
62   return os << rhs.parameter_name() << "=<not set>";
63 }
64 
65 template <typename P>
66 std::ostream& operator<<(std::ostream& os,
67                          WellKnownParameter<P, bool> const& rhs) {
68   if (rhs.has_value()) {
69     google::cloud::internal::IosFlagsSaver saver(os);
70     return os << rhs.parameter_name() << "=" << std::boolalpha << rhs.value();
71   }
72   return os << rhs.parameter_name() << "=<not set>";
73 }
74 }  // namespace internal
75 
76 /**
77  * Sets the contentEncoding option for object uploads.
78  *
79  * The contentEncoding option allows applications to describe how is the data
80  * encoded (binary or ASCII) in upload requests.
81  */
82 struct ContentEncoding
83     : public internal::WellKnownParameter<ContentEncoding, std::string> {
84   using WellKnownParameter<ContentEncoding, std::string>::WellKnownParameter;
well_known_parameter_nameContentEncoding85   static char const* well_known_parameter_name() { return "contentEncoding"; }
86 };
87 
88 /**
89  * Included deleted HMAC keys in list requests.
90  */
91 struct Deleted : public internal::WellKnownParameter<Deleted, bool> {
92   using WellKnownParameter<Deleted, bool>::WellKnownParameter;
well_known_parameter_nameDeleted93   static char const* well_known_parameter_name() { return "deleted"; }
94 };
95 
96 /**
97  * Configure the Customer-Managed Encryption Key (CMEK) for an rewrite.
98  *
99  * With CMEK you can use keys generated by Google Cloud's Key Management Service
100  * to encrypt the data in your objects. Use this option to configure the CMEK of
101  * an object created as part of a rewrite operation. Key names can be found
102  * from the Google Cloud console, and are in the
103  * `projects/{PROJECT_ID}/locations/{LOCATION_ID}/keyRings/{KEY_RING_ID}/cryptoKeys/{CRYPTO_KEY_ID}`
104  * format.
105  *
106  * @see https://cloud.google.com/storage/docs/encryption/customer-managed-keys
107  *     for a general introduction to CMEK in GCS.
108  */
109 struct DestinationKmsKeyName
110     : public internal::WellKnownParameter<DestinationKmsKeyName, std::string> {
111   using WellKnownParameter<DestinationKmsKeyName,
112                            std::string>::WellKnownParameter;
well_known_parameter_nameDestinationKmsKeyName113   static char const* well_known_parameter_name() {
114     return "destinationKmsKeyName";
115   }
116 };
117 
118 /**
119  * Defines the `fields` query parameter.
120  *
121  * The `fields` parameter can be used to limit the fields returned by a request,
122  * saving bandwidth and possibly improving performance for applications that do
123  * not need a full response from the server.
124  *
125  * @see
126  * https://cloud.google.com/storage/docs/json_api/v1/how-tos/performance#partial-response
127  *     for general documentation on how to use this parameter.
128  */
129 struct Fields : public internal::WellKnownParameter<Fields, std::string> {
130   using WellKnownParameter<Fields, std::string>::WellKnownParameter;
well_known_parameter_nameFields131   static char const* well_known_parameter_name() { return "fields"; }
132 };
133 
134 /**
135  * Set the version of an object to operate on.
136  *
137  * For objects in Buckets with `versioning` enabled, the application sometimes
138  * needs to specify which version of the object should the request target. This
139  * is an optional query parameter to control the version.
140  *
141  * @see https://cloud.google.com/storage/docs/object-versioning for more
142  *     information on GCS Object versioning.
143  */
144 struct Generation
145     : public internal::WellKnownParameter<Generation, std::int64_t> {
146   using WellKnownParameter<Generation, std::int64_t>::WellKnownParameter;
well_known_parameter_nameGeneration147   static char const* well_known_parameter_name() { return "generation"; }
148 };
149 
150 /**
151  * A pre-condition: the request succeeds only if the object generation matches.
152  *
153  * @note Setting this to 0 makes the pre-condition succeed only if there are no
154  *     live versions of the object.
155  */
156 struct IfGenerationMatch
157     : public internal::WellKnownParameter<IfGenerationMatch, std::int64_t> {
158   using WellKnownParameter<IfGenerationMatch, std::int64_t>::WellKnownParameter;
well_known_parameter_nameIfGenerationMatch159   static char const* well_known_parameter_name() { return "ifGenerationMatch"; }
160 };
161 
162 /**
163  * A pre-condition: the request succeeds unless the object generation matches.
164  *
165  * @note When set to 0 the pre-condition succeeds only if there are live
166  *    versions of the object.
167  */
168 struct IfGenerationNotMatch
169     : public internal::WellKnownParameter<IfGenerationNotMatch, std::int64_t> {
170   using WellKnownParameter<IfGenerationNotMatch,
171                            std::int64_t>::WellKnownParameter;
well_known_parameter_nameIfGenerationNotMatch172   static char const* well_known_parameter_name() {
173     return "ifGenerationNotMatch";
174   }
175 };
176 
177 /**
178  * A pre-condition: the request succeeds if the metadata generation matches.
179  */
180 struct IfMetagenerationMatch
181     : public internal::WellKnownParameter<IfMetagenerationMatch, std::int64_t> {
182   using WellKnownParameter<IfMetagenerationMatch,
183                            std::int64_t>::WellKnownParameter;
well_known_parameter_nameIfMetagenerationMatch184   static char const* well_known_parameter_name() {
185     return "ifMetagenerationMatch";
186   }
187 };
188 
189 /**
190  * A pre-condition: the request succeeds unless the metadata generation matches.
191  */
192 struct IfMetagenerationNotMatch
193     : public internal::WellKnownParameter<IfMetagenerationNotMatch,
194                                           std::int64_t> {
195   using WellKnownParameter<IfMetagenerationNotMatch,
196                            std::int64_t>::WellKnownParameter;
well_known_parameter_nameIfMetagenerationNotMatch197   static char const* well_known_parameter_name() {
198     return "ifMetagenerationNotMatch";
199   }
200 };
201 
202 /**
203  * A pre-condition: the request succeeds if the source object generation
204  * matches.
205  *
206  * This is only used in CopyObject and RewriteObject operations.
207  */
208 struct IfSourceGenerationMatch
209     : public internal::WellKnownParameter<IfSourceGenerationMatch,
210                                           std::int64_t> {
211   using WellKnownParameter<IfSourceGenerationMatch,
212                            std::int64_t>::WellKnownParameter;
well_known_parameter_nameIfSourceGenerationMatch213   static char const* well_known_parameter_name() {
214     return "ifSourceGenerationMatch";
215   }
216 };
217 
218 /**
219  * A pre-condition: the request succeeds unless the source object generation
220  * matches.
221  */
222 struct IfSourceGenerationNotMatch
223     : public internal::WellKnownParameter<IfSourceGenerationNotMatch,
224                                           std::int64_t> {
225   using WellKnownParameter<IfSourceGenerationNotMatch,
226                            std::int64_t>::WellKnownParameter;
well_known_parameter_nameIfSourceGenerationNotMatch227   static char const* well_known_parameter_name() {
228     return "ifSourceGenerationNotMatch";
229   }
230 };
231 
232 /**
233  * A pre-condition: the request succeeds if the source object metadata
234  * generation matches.
235  */
236 struct IfSourceMetagenerationMatch
237     : public internal::WellKnownParameter<IfSourceMetagenerationMatch,
238                                           std::int64_t> {
239   using WellKnownParameter<IfSourceMetagenerationMatch,
240                            std::int64_t>::WellKnownParameter;
well_known_parameter_nameIfSourceMetagenerationMatch241   static char const* well_known_parameter_name() {
242     return "ifSourceMetagenerationMatch";
243   }
244 };
245 
246 /**
247  * A pre-condition: the request succeeds unless the source object metadata
248  * generation matches.
249  */
250 struct IfSourceMetagenerationNotMatch
251     : public internal::WellKnownParameter<IfSourceMetagenerationNotMatch,
252                                           std::int64_t> {
253   using WellKnownParameter<IfSourceMetagenerationNotMatch,
254                            std::int64_t>::WellKnownParameter;
well_known_parameter_nameIfSourceMetagenerationNotMatch255   static char const* well_known_parameter_name() {
256     return "ifSourceMetagenerationNotMatch";
257   }
258 };
259 
260 /**
261  * Configure the Customer-Managed Encryption Key (CMEK) for an upload.
262  *
263  * With CMEK you can use keys generated by Google Cloud's Key Management Service
264  * to encrypt the data in your objects. Use this option to configure the CMEK of
265  * an object created as part of a insert or copy. Key names can be found from
266  * the Google Cloud console, and are in the
267  * `projects/{PROJECT_ID}/locations/{LOCATION_ID}/keyRings/{KEY_RING_ID}/cryptoKeys/{CRYPTO_KEY_ID}`
268  * format.
269  *
270  * @see https://cloud.google.com/storage/docs/encryption/customer-managed-keys
271  *     for a general introduction to CMEK in GCS.
272  */
273 struct KmsKeyName
274     : public internal::WellKnownParameter<KmsKeyName, std::string> {
275   using WellKnownParameter<KmsKeyName, std::string>::WellKnownParameter;
well_known_parameter_nameKmsKeyName276   static char const* well_known_parameter_name() { return "kmsKeyName"; }
277 };
278 
279 /**
280  * Limit the number of results per page when listing Buckets and Objects.
281  *
282  * Applications may reduce the memory requirements of the Bucket and Object
283  * iterators by using smaller page sizes. The downside is that more requests
284  * may be needed to iterate over the full range of Buckets and/or Objects.
285  */
286 struct MaxResults
287     : public internal::WellKnownParameter<MaxResults, std::int64_t> {
288   using WellKnownParameter<MaxResults, std::int64_t>::WellKnownParameter;
well_known_parameter_nameMaxResults289   static char const* well_known_parameter_name() { return "maxResults"; }
290 };
291 
292 /**
293  * Limit the number of bytes rewritten in a `Objects: rewrite` step.
294  *
295  * Applications should not need for the most part. It is used during testing, to
296  * ensure the code handles partial rewrites properly. Note that the value must
297  * be a multiple of 1 MiB (1048576).
298  */
299 struct MaxBytesRewrittenPerCall
300     : public internal::WellKnownParameter<MaxBytesRewrittenPerCall,
301                                           std::int64_t> {
302   using WellKnownParameter<MaxBytesRewrittenPerCall,
303                            std::int64_t>::WellKnownParameter;
well_known_parameter_nameMaxBytesRewrittenPerCall304   static char const* well_known_parameter_name() {
305     return "maxBytesRewrittenPerCall";
306   }
307 };
308 
309 /**
310  * Set the ACL to predefined values when creating Buckets or Objects.
311  *
312  * A predefined ACL is an alias for a set of specific ACL entries that you can
313  * use to quickly apply many ACL entries at once to a bucket or object.
314  *
315  * @see
316  * https://cloud.google.com/storage/docs/access-control/lists#predefined-acl for
317  * a more detailed description of Predefined ACLs in GCS.
318  */
319 struct PredefinedAcl
320     : public internal::WellKnownParameter<PredefinedAcl, std::string> {
321   using WellKnownParameter<PredefinedAcl, std::string>::WellKnownParameter;
well_known_parameter_namePredefinedAcl322   static char const* well_known_parameter_name() { return "predefinedAcl"; }
323 
AuthenticatedReadPredefinedAcl324   static PredefinedAcl AuthenticatedRead() {
325     return PredefinedAcl("authenticatedRead");
326   }
BucketOwnerFullControlPredefinedAcl327   static PredefinedAcl BucketOwnerFullControl() {
328     return PredefinedAcl("bucketOwnerFullControl");
329   }
BucketOwnerReadPredefinedAcl330   static PredefinedAcl BucketOwnerRead() {
331     return PredefinedAcl("bucketOwnerRead");
332   }
PrivatePredefinedAcl333   static PredefinedAcl Private() { return PredefinedAcl("private"); }
ProjectPrivatePredefinedAcl334   static PredefinedAcl ProjectPrivate() {
335     return PredefinedAcl("projectPrivate");
336   }
PublicReadPredefinedAcl337   static PredefinedAcl PublicRead() { return PredefinedAcl("publicRead"); }
PublicReadWritePredefinedAcl338   static PredefinedAcl PublicReadWrite() {
339     return PredefinedAcl("publicReadWrite");
340   }
341 
342   std::string HeaderName() const;
343 };
344 
345 /**
346  * Set the ACL to a predefined value when copying Objects.
347  *
348  * A predefined ACL is an alias for a set of specific ACL entries that you can
349  * use to quickly apply many ACL entries at once to a bucket or object.
350  *
351  * @see
352  * https://cloud.google.com/storage/docs/access-control/lists#predefined-acl for
353  * a more detailed description of Predefined ACLs in GCS.
354  */
355 struct DestinationPredefinedAcl
356     : public internal::WellKnownParameter<DestinationPredefinedAcl,
357                                           std::string> {
358   using WellKnownParameter<DestinationPredefinedAcl,
359                            std::string>::WellKnownParameter;
well_known_parameter_nameDestinationPredefinedAcl360   static char const* well_known_parameter_name() {
361     return "destinationPredefinedAcl";
362   }
363 
AuthenticatedReadDestinationPredefinedAcl364   static DestinationPredefinedAcl AuthenticatedRead() {
365     return DestinationPredefinedAcl("authenticatedRead");
366   }
BucketOwnerFullControlDestinationPredefinedAcl367   static DestinationPredefinedAcl BucketOwnerFullControl() {
368     return DestinationPredefinedAcl("bucketOwnerFullControl");
369   }
BucketOwnerReadDestinationPredefinedAcl370   static DestinationPredefinedAcl BucketOwnerRead() {
371     return DestinationPredefinedAcl("bucketOwnerRead");
372   }
PrivateDestinationPredefinedAcl373   static DestinationPredefinedAcl Private() {
374     return DestinationPredefinedAcl("private");
375   }
ProjectPrivateDestinationPredefinedAcl376   static DestinationPredefinedAcl ProjectPrivate() {
377     return DestinationPredefinedAcl("projectPrivate");
378   }
PublicReadDestinationPredefinedAcl379   static DestinationPredefinedAcl PublicRead() {
380     return DestinationPredefinedAcl("publicRead");
381   }
382 };
383 
384 /**
385  * Set the default object ACL to a predefined value in a Bucket.
386  *
387  * Every bucket has a default object ACL, and this ACL is applied to all objects
388  * uploaded to that bucket without a predefined ACL or an ACL specified in the
389  * request.  When creating Buckets it is sometimes convenient to define the
390  * default object ACL to one of the predefined values.
391  *
392  * @see
393  * https://cloud.google.com/storage/docs/access-control/lists#defaultobjects for
394  * a mode detailed description of default object ACLs.
395  *
396  * @see
397  * https://cloud.google.com/storage/docs/access-control/lists#predefined-acl for
398  * a more detailed description of Predefined ACLs in GCS.
399  */
400 struct PredefinedDefaultObjectAcl
401     : public internal::WellKnownParameter<PredefinedDefaultObjectAcl,
402                                           std::string> {
403   using WellKnownParameter<PredefinedDefaultObjectAcl,
404                            std::string>::WellKnownParameter;
well_known_parameter_namePredefinedDefaultObjectAcl405   static char const* well_known_parameter_name() {
406     return "predefinedDefaultObjectAcl";
407   }
408 
AuthenticatedReadPredefinedDefaultObjectAcl409   static PredefinedDefaultObjectAcl AuthenticatedRead() {
410     return PredefinedDefaultObjectAcl("authenticatedRead");
411   }
BucketOwnerFullControlPredefinedDefaultObjectAcl412   static PredefinedDefaultObjectAcl BucketOwnerFullControl() {
413     return PredefinedDefaultObjectAcl("bucketOwnerFullControl");
414   }
BucketOwnerReadPredefinedDefaultObjectAcl415   static PredefinedDefaultObjectAcl BucketOwnerRead() {
416     return PredefinedDefaultObjectAcl("bucketOwnerRead");
417   }
PrivatePredefinedDefaultObjectAcl418   static PredefinedDefaultObjectAcl Private() {
419     return PredefinedDefaultObjectAcl("private");
420   }
ProjectPrivatePredefinedDefaultObjectAcl421   static PredefinedDefaultObjectAcl ProjectPrivate() {
422     return PredefinedDefaultObjectAcl("projectPrivate");
423   }
PublicReadPredefinedDefaultObjectAcl424   static PredefinedDefaultObjectAcl PublicRead() {
425     return PredefinedDefaultObjectAcl("publicRead");
426   }
427 };
428 
429 /**
430  * Restrict list operations to entries starting with this value.
431  *
432  * This optional parameter applies to both the request to list objects and to
433  * the request that lists buckets.  Setting a value for this option returns
434  * only the entries that start with the given prefix.
435  */
436 struct Prefix : public internal::WellKnownParameter<Prefix, std::string> {
437   using WellKnownParameter<Prefix, std::string>::WellKnownParameter;
well_known_parameter_namePrefix438   static char const* well_known_parameter_name() { return "prefix"; }
439 };
440 
441 /**
442  * Returns results in a directory-like mode.
443  *
444  * Used in `Client::ListObjects` to return only those objects that do **not**
445  * contain the delimiter, unless said delimiter appears in the `Prefix`
446  * parameter (if any).
447  *
448  * @see https://cloud.google.com/storage/docs/json_api/v1/objects/list for more
449  *   information.
450  */
451 struct Delimiter : public internal::WellKnownParameter<Delimiter, std::string> {
452   using WellKnownParameter<Delimiter, std::string>::WellKnownParameter;
well_known_parameter_nameDelimiter453   static char const* well_known_parameter_name() { return "delimiter"; }
454 };
455 
456 /**
457  * Filter results to objects whose names are lexicographically equal to or after
458  * StartOffset.
459  *
460  * @see https://cloud.google.com/storage/docs/json_api/v1/objects/list for more
461  *   information.
462  */
463 struct StartOffset
464     : public internal::WellKnownParameter<StartOffset, std::string> {
465   using WellKnownParameter<StartOffset, std::string>::WellKnownParameter;
well_known_parameter_nameStartOffset466   static char const* well_known_parameter_name() { return "startOffset"; }
467 };
468 
469 /**
470  * Filter results to objects whose names are lexicographically before EndOffset.
471  *
472  * @see https://cloud.google.com/storage/docs/json_api/v1/objects/list for more
473  *   information.
474  */
475 struct EndOffset : public internal::WellKnownParameter<EndOffset, std::string> {
476   using WellKnownParameter<EndOffset, std::string>::WellKnownParameter;
well_known_parameter_nameEndOffset477   static char const* well_known_parameter_name() { return "endOffset"; }
478 };
479 
480 /**
481  * Controls what metadata fields are included in the response.
482  *
483  * For those operations that return the metadata of an Object or Bucket, this
484  * option controls if all the fields are returned (using `full`) or if the ACL
485  * fields (which can be long) are to be excluded (using `noACL`).
486  *
487  * Use the `Fields` option for more fine-grained control over the returned
488  * fields.
489  */
490 struct Projection
491     : public internal::WellKnownParameter<Projection, std::string> {
492   using WellKnownParameter<Projection, std::string>::WellKnownParameter;
well_known_parameter_nameProjection493   static char const* well_known_parameter_name() { return "projection"; }
494 
NoAclProjection495   static Projection NoAcl() { return Projection("noAcl"); }
FullProjection496   static Projection Full() { return Projection("full"); }
497 };
498 
499 /**
500  * Sets the user for this operation for quota enforcement purposes.
501  *
502  * Google Cloud Platform allows you to set an arbitrary string, up to 40
503  * characters long, that identifies a "user" for quota enforcement purposes.
504  *
505  * @see https://cloud.google.com/apis/docs/capping-api-usage for an introduction
506  *     to quotas in Google Cloud Platform.
507  */
508 struct QuotaUser : public internal::WellKnownParameter<QuotaUser, std::string> {
509   using WellKnownParameter<QuotaUser, std::string>::WellKnownParameter;
well_known_parameter_nameQuotaUser510   static char const* well_known_parameter_name() { return "quotaUser"; }
511 };
512 
513 /**
514  * Only list HMAC keys belonging to a specific Service Account.
515  */
516 struct ServiceAccountFilter
517     : public internal::WellKnownParameter<ServiceAccountFilter, std::string> {
518   using WellKnownParameter<ServiceAccountFilter,
519                            std::string>::WellKnownParameter;
well_known_parameter_nameServiceAccountFilter520   static char const* well_known_parameter_name() {
521     return "serviceAccountEmail";
522   }
523 };
524 
525 /**
526  * Set the generation for the source object in copy operations.
527  *
528  * For objects in Buckets with `versioning` enabled, the application sometimes
529  * needs to specify which version of the object should the request target. This
530  * is an optional query parameter to control the version of the source object
531  * in copy operations.
532  *
533  * @see https://cloud.google.com/storage/docs/object-versioning for more
534  *     information on GCS Object versioning.
535  */
536 struct SourceGeneration
537     : public internal::WellKnownParameter<SourceGeneration, std::int64_t> {
538   using WellKnownParameter<SourceGeneration, std::int64_t>::WellKnownParameter;
well_known_parameter_nameSourceGeneration539   static char const* well_known_parameter_name() { return "sourceGeneration"; }
540 };
541 
542 /**
543  * Set the project used for billing in "requester pays" Buckets.
544  *
545  * GCS Buckets can be configured to charge the requester of an operation for all
546  * charges, as opposed to the project that owns the Bucket. Use this parameter
547  * when accessing such Buckets to control which project is charged. Note that
548  * the caller must have the right permissions in the billed project or the
549  * operation would fail.
550  *
551  * @see https://cloud.google.com/storage/docs/requester-pays for a detailed
552  *     description of the requester pays features, which charges are incurred by
553  *     the requester, and the exact permissions that you must have to make
554  *     such a request.
555  */
556 struct UserProject
557     : public internal::WellKnownParameter<UserProject, std::string> {
558   using WellKnownParameter<UserProject, std::string>::WellKnownParameter;
well_known_parameter_nameUserProject559   static char const* well_known_parameter_name() { return "userProject"; }
560 };
561 
562 /**
563  * Control if all versions of an object should be included when listing objects.
564  *
565  * By default requests listing objects only included the latest (live) version
566  * of each object, set this option to `true` to get all the previous versions.
567  *
568  * @see https://cloud.google.com/storage/docs/object-versioning for more
569  *     information on GCS Object versioning.
570  */
571 struct Versions : public internal::WellKnownParameter<Versions, bool> {
572   using WellKnownParameter<Versions, bool>::WellKnownParameter;
well_known_parameter_nameVersions573   static char const* well_known_parameter_name() { return "versions"; }
574 };
575 
576 /**
577  * Controls the IAM policy version returned by IAM queries.
578  *
579  * By default requests version 1 of the IAM policy, set this to 3 (or higher) to
580  * get IAM policies with conditions.
581  *
582  * @see https://cloud.google.com/iam/docs/policies#versions for more
583  *     information on GCS iam policies and its versioning.
584  */
585 struct RequestedPolicyVersion
586     : public internal::WellKnownParameter<RequestedPolicyVersion,
587                                           std::int64_t> {
588   using WellKnownParameter<RequestedPolicyVersion,
589                            std::int64_t>::WellKnownParameter;
well_known_parameter_nameRequestedPolicyVersion590   static char const* well_known_parameter_name() {
591     return "optionsRequestedPolicyVersion";
592   }
593 };
594 
595 }  // namespace STORAGE_CLIENT_NS
596 }  // namespace storage
597 }  // namespace cloud
598 }  // namespace google
599 
600 #endif  // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_WELL_KNOWN_PARAMETERS_H
601