15#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_OBJECT_METADATA_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_OBJECT_METADATA_H
18#include "google/cloud/storage/internal/complex_option.h"
19#include "google/cloud/storage/object_access_control.h"
20#include "google/cloud/storage/owner.h"
21#include "google/cloud/storage/version.h"
22#include "google/cloud/optional.h"
23#include "google/cloud/status_or.h"
24#include "absl/types/optional.h"
33GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
66 return std::rel_ops::operator!=(lhs, rhs);
71 return std::rel_ops::operator>(lhs, rhs);
76 return std::rel_ops::operator<=(lhs, rhs);
81 return std::rel_ops::operator>=(lhs, rhs);
85
86
87
88
89
90
91
92
93
109 acl_ = std::move(acl);
114 std::string
const&
bucket()
const {
return bucket_; }
118 bucket_ = std::move(v);
123 std::string
const&
cache_control()
const {
return cache_control_; }
127 cache_control_ = std::move(cache_control);
136 component_count_ = v;
145 content_disposition_ = std::move(value);
154 content_encoding_ = std::move(value);
163 content_language_ = std::move(value);
168 std::string
content_type()
const {
return content_type_; }
172 content_type_ = std::move(value);
177 std::string
const&
crc32c()
const {
return crc32c_; }
181 crc32c_ = std::move(v);
189 std::chrono::system_clock::time_point
custom_time()
const {
190 return custom_time_.value_or(std::chrono::system_clock::time_point{});
202 custom_time_.reset();
209 return customer_encryption_.has_value();
213
214
215
216
217
219 return customer_encryption_.value();
224 customer_encryption_ = std::move(v);
230 customer_encryption_.reset();
235 std::string
const&
etag()
const {
return etag_; }
239 etag_ = std::move(v);
248 event_based_hold_ = v;
253
254
255
256
257
258
268 std::string
const&
id()
const {
return id_; }
277 std::string
const&
kind()
const {
return kind_; }
281 kind_ = std::move(v);
286
287
288
289
290
291 std::string
const&
kms_key_name()
const {
return kms_key_name_; }
295 kms_key_name_ = std::move(v);
300 std::string
const&
md5_hash()
const {
return md5_hash_; }
304 md5_hash_ = std::move(v);
309 std::string
const&
media_link()
const {
return media_link_; }
313 media_link_ = std::move(v);
318
319
320
321
322
323
327 return metadata_.end() != metadata_.find(key);
331
332
333
334
335
336 std::string
const&
metadata(std::string
const& key)
const {
337 return metadata_.at(key);
342 auto i = metadata_.find(key);
343 if (i == metadata_.end()) {
352 auto i = metadata_.lower_bound(key);
353 if (i == metadata_.end() || i->first != key) {
354 metadata_.emplace_hint(i, std::move(key), std::move(value));
356 i->second = std::move(value);
362 std::map<std::string, std::string>
const&
metadata()
const {
367 std::map<std::string, std::string>&
mutable_metadata() {
return metadata_; }
371
372
373
374
375
376
386 std::string
const&
name()
const {
return name_; }
390 name_ = std::move(v);
395 bool has_owner()
const {
return owner_.has_value(); }
398
399
400
401
402
403 Owner const&
owner()
const {
return *owner_; }
407 owner_ = std::move(v);
419 return retention_expiration_time_;
424 std::chrono::system_clock::time_point v) {
425 retention_expiration_time_ = v;
430 std::string
const&
self_link()
const {
return self_link_; }
434 self_link_ = std::move(v);
448 std::string
const&
storage_class()
const {
return storage_class_; }
452 storage_class_ = std::move(v);
466 std::chrono::system_clock::time_point
time_created()
const {
467 return time_created_;
477 std::chrono::system_clock::time_point
time_deleted()
const {
478 return time_deleted_;
489 return time_storage_class_updated_;
494 std::chrono::system_clock::time_point v) {
495 time_storage_class_updated_ = v;
500 std::chrono::system_clock::time_point
updated()
const {
return updated_; }
510 return !(lhs
== rhs);
514 friend std::ostream& operator<<(std::ostream& os,
ObjectMetadata const& rhs);
518 std::string cache_control_;
519 std::int32_t component_count_{0};
520 std::string content_disposition_;
521 std::string content_encoding_;
522 std::string content_language_;
523 std::string content_type_;
525 absl::optional<std::chrono::system_clock::time_point> custom_time_;
528 bool event_based_hold_{
false};
529 std::int64_t generation_{0};
532 std::string kms_key_name_;
533 std::int64_t metageneration_{0};
534 std::string md5_hash_;
535 std::string media_link_;
536 std::map<std::string, std::string> metadata_;
538 absl::optional<
Owner> owner_;
539 std::chrono::system_clock::time_point retention_expiration_time_;
540 std::string self_link_;
541 std::uint64_t size_{0};
542 std::string storage_class_;
543 bool temporary_hold_{
false};
544 std::chrono::system_clock::time_point time_created_;
545 std::chrono::system_clock::time_point time_deleted_;
546 std::chrono::system_clock::time_point time_storage_class_updated_;
547 std::chrono::system_clock::time_point updated_;
550std::ostream& operator<<(std::ostream& os,
ObjectMetadata const& rhs);
553
554
555
556
557
558
559
560
561
562
563
573
574
575
576
593 std::string
const& value);
601
602
603
604
605
607 std::chrono::system_clock::time_point tp);
611 friend struct internal::PatchBuilderDetails;
613 internal::PatchBuilder impl_;
614 bool metadata_subpatch_dirty_{
false};
615 internal::PatchBuilder metadata_subpatch_;
619
620
627 static char const*
name() {
return "object-metadata"; }
630GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
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
bool operator!=(CustomerEncryption const &lhs, CustomerEncryption const &rhs)
Definition: object_metadata.h:64
bool operator<=(CustomerEncryption const &lhs, CustomerEncryption const &rhs)
Definition: object_metadata.h:74
bool operator>(CustomerEncryption const &lhs, CustomerEncryption const &rhs)
Definition: object_metadata.h:69
bool operator<(CustomerEncryption const &lhs, CustomerEncryption const &rhs)
Definition: object_metadata.h:58
bool operator==(CustomerEncryption const &lhs, CustomerEncryption const &rhs)
Definition: object_metadata.h:52
bool operator>=(CustomerEncryption const &lhs, CustomerEncryption const &rhs)
Definition: object_metadata.h:79
Defines one of the source objects for a compose operation.
Definition: object_metadata.h:44
absl::optional< std::int64_t > if_generation_match
Definition: object_metadata.h:47
std::string object_name
Definition: object_metadata.h:45
absl::optional< std::int64_t > generation
Definition: object_metadata.h:46
A simple representation for the customerEncryption field.
Definition: object_metadata.h:36
std::string encryption_algorithm
Definition: object_metadata.h:38
std::string key_sha256
Definition: object_metadata.h:40
A simple wrapper for the owner field in object and bucket metadata.
Definition: owner.h:29