15#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_BUCKET_METADATA_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_BUCKET_METADATA_H
18#include "google/cloud/storage/bucket_access_control.h"
19#include "google/cloud/storage/bucket_autoclass.h"
20#include "google/cloud/storage/bucket_billing.h"
21#include "google/cloud/storage/bucket_cors_entry.h"
22#include "google/cloud/storage/bucket_custom_placement_config.h"
23#include "google/cloud/storage/bucket_encryption.h"
24#include "google/cloud/storage/bucket_iam_configuration.h"
25#include "google/cloud/storage/bucket_lifecycle.h"
26#include "google/cloud/storage/bucket_logging.h"
27#include "google/cloud/storage/bucket_retention_policy.h"
28#include "google/cloud/storage/bucket_rpo.h"
29#include "google/cloud/storage/bucket_versioning.h"
30#include "google/cloud/storage/bucket_website.h"
31#include "google/cloud/storage/internal/patch_builder.h"
32#include "google/cloud/storage/lifecycle_rule.h"
33#include "google/cloud/storage/object_access_control.h"
34#include "google/cloud/storage/owner.h"
35#include "google/cloud/storage/version.h"
36#include "google/cloud/optional.h"
37#include "absl/types/optional.h"
48GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
51
52
60
61
62
63
68 acl_ = std::move(acl);
81 autoclass_ = std::move(v);
91
92
93
94
96 bool has_billing()
const {
return billing_.has_value(); }
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
131 default_event_based_hold_ = v;
137
138
139
140
141
142
143
144
145
146
147
152 cors_ = std::move(cors);
158
159
160
161
162
163
164
165
166
175 default_acl_ = std::move(acl);
181
182
183
184
185
186
187
188
189
197 encryption_ = std::move(v);
206 std::string
const&
etag()
const {
return etag_; }
210 etag_ = std::move(v);
215
216
217
218
219
220
221
222
223
224
225
229 return *iam_configuration_;
233 return iam_configuration_;
236 iam_configuration_ = std::move(v);
240 iam_configuration_.reset();
246 std::string
const&
id()
const {
return id_; }
254 std::string
const&
kind()
const {
return kind_; }
258 kind_ = std::move(v);
266 bool has_label(std::string
const& key)
const {
267 return labels_.end() != labels_.find(key);
271
272
273
274
275 std::string
const&
label(std::string
const& key)
const {
276 return labels_.at(key);
281 auto i = labels_.find(key);
282 if (i == labels_.end()) {
291 auto i = labels_.lower_bound(key);
292 if (i == labels_.end() || i->first != key) {
293 labels_.emplace_hint(i, std::move(key), std::move(value));
295 i->second = std::move(value);
301 std::map<std::string, std::string>
const&
labels()
const {
return labels_; }
304 std::map<std::string, std::string>&
mutable_labels() {
return labels_; }
308
309
310
311
312
314 bool has_lifecycle()
const {
return lifecycle_.has_value(); }
320 lifecycle_ = std::move(v);
330 std::string
const&
location()
const {
return location_; }
334 location_ = std::move(v);
339 std::string
const&
location_type()
const {
return location_type_; }
343 location_type_ = std::move(v);
349 bool has_logging()
const {
return logging_.has_value(); }
355 logging_ = std::move(v);
374 std::string
const&
name()
const {
return name_; }
377
378
379
380
381
382
384 name_ = std::move(v);
389 bool has_owner()
const {
return owner_.has_value(); }
391
392
393
394
395 Owner const&
owner()
const {
return *owner_; }
399 owner_ = std::move(v);
417 std::string
const&
self_link()
const {
return self_link_; }
421 self_link_ = std::move(v);
429 return *retention_policy_;
433 return retention_policy_;
436 retention_policy_ = std::move(v);
441
442
443
444
445
446
449 retention_period, std::chrono::system_clock::time_point{},
false}
);
453 retention_policy_.reset();
460 std::string
const&
rpo()
const {
return rpo_; }
469 std::string
const&
storage_class()
const {
return storage_class_; }
471 storage_class_ = std::move(v);
477 std::chrono::system_clock::time_point
time_created()
const {
478 return time_created_;
488 std::chrono::system_clock::time_point
updated()
const {
return updated_; }
515 versioning_ = std::move(v);
522 bool has_website()
const {
return website_.has_value(); }
528 website_ = std::move(v);
540 return custom_placement_config_.has_value();
543 return *custom_placement_config_;
547 return custom_placement_config_;
551 custom_placement_config_ = std::move(v);
556 custom_placement_config_.reset();
563 return !(lhs
== rhs);
567 friend std::ostream& operator<<(std::ostream& os,
BucketMetadata const& rhs);
575 bool default_event_based_hold_ =
false;
581 std::map<std::string, std::string> labels_;
583 std::string location_;
584 std::string location_type_;
586 std::int64_t metageneration_{0};
588 absl::optional<
Owner> owner_;
589 std::int64_t project_number_ = 0;
592 std::string self_link_;
593 std::string storage_class_;
594 std::chrono::system_clock::time_point time_created_;
595 std::chrono::system_clock::time_point updated_;
600std::ostream& operator<<(std::ostream& os,
BucketMetadata const& rhs);
603
604
605
606
607
608
609
610
611
612
613
623
624
625
626
645
646
647
648
659 std::string
const& value);
675 std::chrono::seconds retention_period) {
679 retention_period, std::chrono::system_clock::time_point{},
false}
);
696 friend struct internal::PatchBuilderDetails;
698 internal::PatchBuilder impl_;
699 bool labels_subpatch_dirty_{
false};
700 internal::PatchBuilder labels_subpatch_;
703GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Wraps the bucketAccessControl resource in Google Cloud Storage.
Definition: bucket_access_control.h:39
Wraps the objectAccessControl resource in Google Cloud Storage.
Definition: object_access_control.h:39
Contains all the Google Cloud Storage C++ client APIs.
Definition: auto_finalize.h:24
The autoclass configuration for a Bucket.
Definition: bucket_autoclass.h:39
The billing configuration for a Bucket.
Definition: bucket_billing.h:32
Configuration for Custom Dual Regions.
Definition: bucket_custom_placement_config.h:39
Describes the default customer managed encryption key for a bucket.
Definition: bucket_encryption.h:38
The IAM configuration for a Bucket.
Definition: bucket_iam_configuration.h:99
The Object Lifecycle configuration for a Bucket.
Definition: bucket_lifecycle.h:34
The Logging configuration for a Bucket.
Definition: bucket_logging.h:35
The retention policy for a bucket.
Definition: bucket_retention_policy.h:41
The versioning configuration for a Bucket.
Definition: bucket_versioning.h:32
BucketVersioning(bool flag)
Definition: bucket_versioning.h:34
The website configuration for a Bucket.
Definition: bucket_website.h:34
An entry in the CORS list.
Definition: bucket_cors_entry.h:48
A simple wrapper for the owner field in object and bucket metadata.
Definition: owner.h:29