Google Cloud Storage C++ Client 2.13.0
A C++ Client Library for Google Cloud Storage
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
google::cloud::storage::ObjectMetadata Class Reference

Represents the metadata for a Google Cloud Storage Object. More...

#include <google/cloud/storage/object_metadata.h>

Public Member Functions

 ObjectMetadata ()=default
 
std::vector< ObjectAccessControl > const & acl () const
 The access control list for this object. More...
 
std::vector< ObjectAccessControl > & mutable_acl ()
 The access control list for this object. More...
 
ObjectMetadataset_acl (std::vector< ObjectAccessControl > acl)
 Change the access control list. More...
 
std::string const & bucket () const
 The name of the bucket containing this object. More...
 
ObjectMetadataset_bucket (std::string v)
 
std::string const & cache_control () const
 The cacheControl attribute. More...
 
ObjectMetadataset_cache_control (std::string cache_control)
 Set the cacheControl attribute. More...
 
std::int32_t component_count () const
 The number of components, for objects built using ComposeObject(). More...
 
ObjectMetadataset_component_count (std::int32_t v)
 
std::string content_disposition () const
 The contentDisposition attribute. More...
 
ObjectMetadataset_content_disposition (std::string value)
 Change the contentDisposition attribute. More...
 
std::string content_encoding () const
 The contentEncoding attribute. More...
 
ObjectMetadataset_content_encoding (std::string value)
 Change the contentEncoding attribute. More...
 
std::string content_language () const
 The contentLanguage attribute. More...
 
ObjectMetadataset_content_language (std::string value)
 Change the contentLanguage attribute. More...
 
std::string content_type () const
 The contentType attribute. More...
 
ObjectMetadataset_content_type (std::string value)
 Change the contentLanguage attribute. More...
 
std::string const & crc32c () const
 The CRC32C checksum for the object contents. More...
 
ObjectMetadataset_crc32c (std::string v)
 
bool has_custom_time () const
 Returns true if the object has a customTime attribute. More...
 
std::chrono::system_clock::time_point custom_time () const
 Returns the object's customTime or the system clock's epoch. More...
 
ObjectMetadataset_custom_time (std::chrono::system_clock::time_point v)
 Changes the customTime attribute. More...
 
ObjectMetadatareset_custom_time ()
 Reset (clears) the customTime attribute. More...
 
bool has_customer_encryption () const
 Returns true if the object uses CSEK (Customer-Supplied Encryption Keys). More...
 
CustomerEncryption const & customer_encryption () const
 Returns the CSEK metadata (algorithm and key SHA256). More...
 
ObjectMetadataset_customer_encryption (CustomerEncryption v)
 
ObjectMetadatareset_customer_encryption ()
 
std::string const & etag () const
 The Etag attribute. More...
 
ObjectMetadataset_etag (std::string v)
 
bool event_based_hold () const
 The eventBasedHold attribute. More...
 
ObjectMetadataset_event_based_hold (bool v)
 Changes the eventBasedHold attribute. More...
 
std::int64_t generation () const
 The object generation. More...
 
ObjectMetadataset_generation (std::int64_t v)
 
std::string const & id () const
 The id attribute (the object name) More...
 
ObjectMetadataset_id (std::string v)
 
std::string const & kind () const
 The kind attribute, that is, storage#object. More...
 
ObjectMetadataset_kind (std::string v)
 
std::string const & kms_key_name () const
 The name of the KMS (Key Management Service) key used in this object. More...
 
ObjectMetadataset_kms_key_name (std::string v)
 
std::string const & md5_hash () const
 The MD5 hash of the object contents. Can be empty. More...
 
ObjectMetadataset_md5_hash (std::string v)
 
std::string const & media_link () const
 The HTTPS link to access the object contents. More...
 
ObjectMetadataset_media_link (std::string v)
 
std::int64_t metageneration () const
 The generation of the object metadata. More...
 
ObjectMetadataset_metageneration (std::int64_t v)
 
std::string const & name () const
 The object name, including bucket and generation. More...
 
ObjectMetadataset_name (std::string v)
 
bool has_owner () const
 Returns true if the object has an owner attribute. More...
 
Owner const & owner () const
 The object's owner attribute. More...
 
ObjectMetadataset_owner (Owner v)
 
ObjectMetadatareset_owner ()
 
std::chrono::system_clock::time_point retention_expiration_time () const
 The retention expiration time, or the system clock's epoch, if not set. More...
 
ObjectMetadataset_retention_expiration_time (std::chrono::system_clock::time_point v)
 
std::string const & self_link () const
 An HTTPS link to the object metadata. More...
 
ObjectMetadataset_self_link (std::string v)
 
std::uint64_t size () const
 The size of the object's data. More...
 
ObjectMetadataset_size (std::uint64_t v)
 
std::string const & storage_class () const
 The storageClass attribute. More...
 
ObjectMetadataset_storage_class (std::string v)
 Changes the storageClass attribute. More...
 
bool temporary_hold () const
 The temporaryHold attribute. More...
 
ObjectMetadataset_temporary_hold (bool v)
 Changes the temporaryHold attribute. More...
 
std::chrono::system_clock::time_point time_created () const
 The object creation timestamp. More...
 
ObjectMetadataset_time_created (std::chrono::system_clock::time_point v)
 
std::chrono::system_clock::time_point time_deleted () const
 The object's deletion timestamp. More...
 
ObjectMetadataset_time_deleted (std::chrono::system_clock::time_point v)
 
std::chrono::system_clock::time_point time_storage_class_updated () const
 The timestamp for the last storage class change. More...
 
ObjectMetadataset_time_storage_class_updated (std::chrono::system_clock::time_point v)
 
std::chrono::system_clock::time_point updated () const
 The timestamp for the last object metadata update. More...
 
ObjectMetadataset_updated (std::chrono::system_clock::time_point v)
 
Accessors and modifiers for metadata entries.

The object metadata contains a user-defined set of key, value pairs, which are also called "metadata".

Applications can use these fields to add custom annotations to each object.

bool has_metadata (std::string const &key) const
 
std::string const & metadata (std::string const &key) const
 Returns the value of key in the Object's metadata entries. More...
 
ObjectMetadatadelete_metadata (std::string const &key)
 Delete a metadata entry. This is a no-op if the key does not exist. More...
 
ObjectMetadataupsert_metadata (std::string key, std::string value)
 Insert or update the metadata entry. More...
 
std::map< std::string, std::string > const & metadata () const
 Returns all the Object's metadata entries. More...
 
std::map< std::string, std::string > & mutable_metadata ()
 Returns all the Object's metadata entries. More...
 

Friends

bool operator== (ObjectMetadata const &lhs, ObjectMetadata const &rhs)
 
bool operator!= (ObjectMetadata const &lhs, ObjectMetadata const &rhs)
 
std::ostream & operator<< (std::ostream &os, ObjectMetadata const &rhs)
 

Detailed Description

Represents the metadata for a Google Cloud Storage Object.

Note that all modifiers just change the local representation of the Object's metadata. Applications should use Client::PatchObject(), or a similar operation, to actually modify the metadata stored by GCS.

See also
https://cloud.google.com/storage/docs/json_api/v1/objects for a more detailed description of each attribute and their effects.

Constructor & Destructor Documentation

◆ ObjectMetadata()

google::cloud::storage::ObjectMetadata::ObjectMetadata ( )
default

Member Function Documentation

◆ acl()

std::vector< ObjectAccessControl > const & google::cloud::storage::ObjectMetadata::acl ( ) const
inline

The access control list for this object.

◆ bucket()

std::string const & google::cloud::storage::ObjectMetadata::bucket ( ) const
inline

The name of the bucket containing this object.

◆ cache_control()

std::string const & google::cloud::storage::ObjectMetadata::cache_control ( ) const
inline

The cacheControl attribute.

◆ component_count()

std::int32_t google::cloud::storage::ObjectMetadata::component_count ( ) const
inline

The number of components, for objects built using ComposeObject().

◆ content_disposition()

std::string google::cloud::storage::ObjectMetadata::content_disposition ( ) const
inline

The contentDisposition attribute.

◆ content_encoding()

std::string google::cloud::storage::ObjectMetadata::content_encoding ( ) const
inline

The contentEncoding attribute.

◆ content_language()

std::string google::cloud::storage::ObjectMetadata::content_language ( ) const
inline

The contentLanguage attribute.

◆ content_type()

std::string google::cloud::storage::ObjectMetadata::content_type ( ) const
inline

The contentType attribute.

◆ crc32c()

std::string const & google::cloud::storage::ObjectMetadata::crc32c ( ) const
inline

The CRC32C checksum for the object contents.

◆ custom_time()

std::chrono::system_clock::time_point google::cloud::storage::ObjectMetadata::custom_time ( ) const
inline

Returns the object's customTime or the system clock's epoch.

◆ customer_encryption()

CustomerEncryption const & google::cloud::storage::ObjectMetadata::customer_encryption ( ) const
inline

Returns the CSEK metadata (algorithm and key SHA256).

It is undefined behavior to call this member function if has_customer_encryption() == false.

◆ delete_metadata()

ObjectMetadata & google::cloud::storage::ObjectMetadata::delete_metadata ( std::string const &  key)
inline

Delete a metadata entry. This is a no-op if the key does not exist.

◆ etag()

std::string const & google::cloud::storage::ObjectMetadata::etag ( ) const
inline

The Etag attribute.

◆ event_based_hold()

bool google::cloud::storage::ObjectMetadata::event_based_hold ( ) const
inline

The eventBasedHold attribute.

◆ generation()

std::int64_t google::cloud::storage::ObjectMetadata::generation ( ) const
inline

The object generation.

In buckets with object versioning enabled, each object may have multiple generations. Each generation data (the object contents) is immutable, but the metadata associated with each generation can be changed.

◆ has_custom_time()

bool google::cloud::storage::ObjectMetadata::has_custom_time ( ) const
inline

Returns true if the object has a customTime attribute.

◆ has_customer_encryption()

bool google::cloud::storage::ObjectMetadata::has_customer_encryption ( ) const
inline

Returns true if the object uses CSEK (Customer-Supplied Encryption Keys).

◆ has_metadata()

bool google::cloud::storage::ObjectMetadata::has_metadata ( std::string const &  key) const
inline

Returns true if the key is present in the object metadata entries.

◆ has_owner()

bool google::cloud::storage::ObjectMetadata::has_owner ( ) const
inline

Returns true if the object has an owner attribute.

◆ id()

std::string const & google::cloud::storage::ObjectMetadata::id ( ) const
inline

The id attribute (the object name)

◆ kind()

std::string const & google::cloud::storage::ObjectMetadata::kind ( ) const
inline

The kind attribute, that is, storage#object.

◆ kms_key_name()

std::string const & google::cloud::storage::ObjectMetadata::kms_key_name ( ) const
inline

The name of the KMS (Key Management Service) key used in this object.

This is empty for objects not using CMEK (Customer Managed Encryption Keys).

◆ md5_hash()

std::string const & google::cloud::storage::ObjectMetadata::md5_hash ( ) const
inline

The MD5 hash of the object contents. Can be empty.

◆ media_link()

std::string const & google::cloud::storage::ObjectMetadata::media_link ( ) const
inline

The HTTPS link to access the object contents.

◆ metadata() [1/2]

std::map< std::string, std::string > const & google::cloud::storage::ObjectMetadata::metadata ( ) const
inline

Returns all the Object's metadata entries.

◆ metadata() [2/2]

std::string const & google::cloud::storage::ObjectMetadata::metadata ( std::string const &  key) const
inline

Returns the value of key in the Object's metadata entries.

It is undefined behavior to call metadata(key) if has_metadata(key) == false.

◆ metageneration()

std::int64_t google::cloud::storage::ObjectMetadata::metageneration ( ) const
inline

The generation of the object metadata.

Note
Changes to the object metadata (e.g. changing the cacheControl attribute) increases the metageneration, but does not change the object generation.

◆ mutable_acl()

std::vector< ObjectAccessControl > & google::cloud::storage::ObjectMetadata::mutable_acl ( )
inline

The access control list for this object.

◆ mutable_metadata()

std::map< std::string, std::string > & google::cloud::storage::ObjectMetadata::mutable_metadata ( )
inline

Returns all the Object's metadata entries.

◆ name()

std::string const & google::cloud::storage::ObjectMetadata::name ( ) const
inline

The object name, including bucket and generation.

◆ owner()

Owner const & google::cloud::storage::ObjectMetadata::owner ( ) const
inline

The object's owner attribute.

It is undefined behavior to call this member function if has_owner() == false.

◆ reset_custom_time()

ObjectMetadata & google::cloud::storage::ObjectMetadata::reset_custom_time ( )
inline

Reset (clears) the customTime attribute.

has_custom_time() returns false after calling this function.

◆ reset_customer_encryption()

ObjectMetadata & google::cloud::storage::ObjectMetadata::reset_customer_encryption ( )
inline
Note
This is only intended for mocking.

◆ reset_owner()

ObjectMetadata & google::cloud::storage::ObjectMetadata::reset_owner ( )
inline
Note
This is only intended for mocking.

◆ retention_expiration_time()

std::chrono::system_clock::time_point google::cloud::storage::ObjectMetadata::retention_expiration_time ( ) const
inline

The retention expiration time, or the system clock's epoch, if not set.

◆ self_link()

std::string const & google::cloud::storage::ObjectMetadata::self_link ( ) const
inline

An HTTPS link to the object metadata.

◆ set_acl()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_acl ( std::vector< ObjectAccessControl acl)
inline

Change the access control list.

◆ set_bucket()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_bucket ( std::string  v)
inline
Note
This is only intended for mocking.

◆ set_cache_control()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_cache_control ( std::string  cache_control)
inline

Set the cacheControl attribute.

◆ set_component_count()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_component_count ( std::int32_t  v)
inline
Note
This is only intended for mocking.

◆ set_content_disposition()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_content_disposition ( std::string  value)
inline

Change the contentDisposition attribute.

◆ set_content_encoding()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_content_encoding ( std::string  value)
inline

Change the contentEncoding attribute.

◆ set_content_language()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_content_language ( std::string  value)
inline

Change the contentLanguage attribute.

◆ set_content_type()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_content_type ( std::string  value)
inline

Change the contentLanguage attribute.

◆ set_crc32c()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_crc32c ( std::string  v)
inline
Note
This is only intended for mocking.

◆ set_custom_time()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_custom_time ( std::chrono::system_clock::time_point  v)
inline

Changes the customTime attribute.

◆ set_customer_encryption()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_customer_encryption ( CustomerEncryption  v)
inline
Note
This is only intended for mocking.

◆ set_etag()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_etag ( std::string  v)
inline
Note
This is only intended for mocking.

◆ set_event_based_hold()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_event_based_hold ( bool  v)
inline

Changes the eventBasedHold attribute.

◆ set_generation()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_generation ( std::int64_t  v)
inline
Note
This is only intended for mocking.

◆ set_id()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_id ( std::string  v)
inline
Note
This is only intended for mocking.

◆ set_kind()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_kind ( std::string  v)
inline
Note
This is only intended for mocking.

◆ set_kms_key_name()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_kms_key_name ( std::string  v)
inline
Note
This is only intended for mocking.

◆ set_md5_hash()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_md5_hash ( std::string  v)
inline
Note
This is only intended for mocking.

◆ set_media_link()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_media_link ( std::string  v)
inline
Note
This is only intended for mocking.

◆ set_metageneration()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_metageneration ( std::int64_t  v)
inline
Note
This is only intended for mocking.

◆ set_name()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_name ( std::string  v)
inline
Note
This is only intended for mocking.

◆ set_owner()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_owner ( Owner  v)
inline
Note
This is only intended for mocking.

◆ set_retention_expiration_time()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_retention_expiration_time ( std::chrono::system_clock::time_point  v)
inline
Note
This is only intended for mocking.

◆ set_self_link()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_self_link ( std::string  v)
inline
Note
This is only intended for mocking.

◆ set_size()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_size ( std::uint64_t  v)
inline
Note
This is only intended for mocking.

◆ set_storage_class()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_storage_class ( std::string  v)
inline

Changes the storageClass attribute.

◆ set_temporary_hold()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_temporary_hold ( bool  v)
inline

Changes the temporaryHold attribute.

◆ set_time_created()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_time_created ( std::chrono::system_clock::time_point  v)
inline
Note
This is only intended for mocking.

◆ set_time_deleted()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_time_deleted ( std::chrono::system_clock::time_point  v)
inline
Note
This is only intended for mocking.

◆ set_time_storage_class_updated()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_time_storage_class_updated ( std::chrono::system_clock::time_point  v)
inline
Note
This is only intended for mocking.

◆ set_updated()

ObjectMetadata & google::cloud::storage::ObjectMetadata::set_updated ( std::chrono::system_clock::time_point  v)
inline
Note
This is only intended for mocking.

◆ size()

std::uint64_t google::cloud::storage::ObjectMetadata::size ( ) const
inline

The size of the object's data.

◆ storage_class()

std::string const & google::cloud::storage::ObjectMetadata::storage_class ( ) const
inline

The storageClass attribute.

◆ temporary_hold()

bool google::cloud::storage::ObjectMetadata::temporary_hold ( ) const
inline

The temporaryHold attribute.

◆ time_created()

std::chrono::system_clock::time_point google::cloud::storage::ObjectMetadata::time_created ( ) const
inline

The object creation timestamp.

◆ time_deleted()

std::chrono::system_clock::time_point google::cloud::storage::ObjectMetadata::time_deleted ( ) const
inline

The object's deletion timestamp.

◆ time_storage_class_updated()

std::chrono::system_clock::time_point google::cloud::storage::ObjectMetadata::time_storage_class_updated ( ) const
inline

The timestamp for the last storage class change.

◆ updated()

std::chrono::system_clock::time_point google::cloud::storage::ObjectMetadata::updated ( ) const
inline

The timestamp for the last object metadata update.

◆ upsert_metadata()

ObjectMetadata & google::cloud::storage::ObjectMetadata::upsert_metadata ( std::string  key,
std::string  value 
)
inline

Insert or update the metadata entry.

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( ObjectMetadata const &  lhs,
ObjectMetadata const &  rhs 
)
friend

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
ObjectMetadata const &  rhs 
)
friend

◆ operator==

bool operator== ( ObjectMetadata const &  lhs,
ObjectMetadata const &  rhs 
)
friend