Class ObjectMetadata (2.28.0)

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.

Constructors

ObjectMetadata()

Functions

has_metadata(std::string const &) const

Accessors and modifiers for metadata entries.

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

Parameter
Name Description
key std::string const &
Returns
Type Description
bool

metadata(std::string const &) const

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

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

Parameter
Name Description
key std::string const &
Returns
Type Description
std::string const &

delete_metadata(std::string const &)

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

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.

Parameter
Name Description
key std::string const &
Returns
Type Description
ObjectMetadata &

upsert_metadata(std::string, std::string)

Insert or update the metadata entry.

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.

Parameters
Name Description
key std::string
value std::string
Returns
Type Description
ObjectMetadata &

metadata() const

Returns all the Object's 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.

Returns
Type Description
std::map< std::string, std::string > const &

mutable_metadata()

Returns all the Object's 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.

Returns
Type Description
std::map< std::string, std::string > &

acl() const

The access control list for this object.

Returns
Type Description
std::vector< ObjectAccessControl > const &

mutable_acl()

The access control list for this object.

Returns
Type Description
std::vector< ObjectAccessControl > &

set_acl(std::vector< ObjectAccessControl >)

Change the access control list.

Parameter
Name Description
acl std::vector< ObjectAccessControl >
Returns
Type Description
ObjectMetadata &

bucket() const

The name of the bucket containing this object.

Returns
Type Description
std::string const &

set_bucket(std::string)

Parameter
Name Description
v std::string
Returns
Type Description
ObjectMetadata &

cache_control() const

The cacheControl attribute.

Returns
Type Description
std::string const &

set_cache_control(std::string)

Set the cacheControl attribute.

Parameter
Name Description
cache_control std::string
Returns
Type Description
ObjectMetadata &

component_count() const

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

Returns
Type Description
std::int32_t

set_component_count(std::int32_t)

Parameter
Name Description
v std::int32_t
Returns
Type Description
ObjectMetadata &

content_disposition() const

The contentDisposition attribute.

Returns
Type Description
std::string

set_content_disposition(std::string)

Change the contentDisposition attribute.

Parameter
Name Description
value std::string
Returns
Type Description
ObjectMetadata &

content_encoding() const

The contentEncoding attribute.

Returns
Type Description
std::string

set_content_encoding(std::string)

Change the contentEncoding attribute.

Parameter
Name Description
value std::string
Returns
Type Description
ObjectMetadata &

content_language() const

The contentLanguage attribute.

Returns
Type Description
std::string

set_content_language(std::string)

Change the contentLanguage attribute.

Parameter
Name Description
value std::string
Returns
Type Description
ObjectMetadata &

content_type() const

The contentType attribute.

Returns
Type Description
std::string

set_content_type(std::string)

Change the contentLanguage attribute.

Parameter
Name Description
value std::string
Returns
Type Description
ObjectMetadata &

crc32c() const

The CRC32C checksum for the object contents.

Returns
Type Description
std::string const &

set_crc32c(std::string)

Parameter
Name Description
v std::string
Returns
Type Description
ObjectMetadata &

has_custom_time() const

Returns true if the object has a customTime attribute.

Returns
Type Description
bool

custom_time() const

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

Returns
Type Description
std::chrono::system_clock::time_point

set_custom_time(std::chrono::system_clock::time_point)

Changes the customTime attribute.

Parameter
Name Description
v std::chrono::system_clock::time_point
Returns
Type Description
ObjectMetadata &

reset_custom_time()

Reset (clears) the customTime attribute.

has_custom_time() returns false after calling this function.

Returns
Type Description
ObjectMetadata &

has_customer_encryption() const

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

Returns
Type Description
bool

customer_encryption() const

Returns the CSEK metadata (algorithm and key SHA256).

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

Returns
Type Description
CustomerEncryption const &

set_customer_encryption(CustomerEncryption)

Parameter
Name Description
v CustomerEncryption
Returns
Type Description
ObjectMetadata &

reset_customer_encryption()

Returns
Type Description
ObjectMetadata &

etag() const

The Etag attribute.

Returns
Type Description
std::string const &

set_etag(std::string)

Parameter
Name Description
v std::string
Returns
Type Description
ObjectMetadata &

event_based_hold() const

The eventBasedHold attribute.

Returns
Type Description
bool

set_event_based_hold(bool)

Changes the eventBasedHold attribute.

Parameter
Name Description
v bool
Returns
Type Description
ObjectMetadata &

generation() const

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.

Returns
Type Description
std::int64_t

set_generation(std::int64_t)

Parameter
Name Description
v std::int64_t
Returns
Type Description
ObjectMetadata &

id() const

The id attribute (the object name)

Returns
Type Description
std::string const &

set_id(std::string)

Parameter
Name Description
v std::string
Returns
Type Description
ObjectMetadata &

kind() const

The kind attribute, that is, storage#object.

Returns
Type Description
std::string const &

set_kind(std::string)

Parameter
Name Description
v std::string
Returns
Type Description
ObjectMetadata &

kms_key_name() const

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).

Returns
Type Description
std::string const &

set_kms_key_name(std::string)

Parameter
Name Description
v std::string
Returns
Type Description
ObjectMetadata &

md5_hash() const

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

Returns
Type Description
std::string const &

set_md5_hash(std::string)

Parameter
Name Description
v std::string
Returns
Type Description
ObjectMetadata &

media_link() const

The HTTPS link to access the object contents.

Returns
Type Description
std::string const &

set_media_link(std::string)

Parameter
Name Description
v std::string
Returns
Type Description
ObjectMetadata &

metageneration() const

The generation of the object metadata.

Returns
Type Description
std::int64_t

set_metageneration(std::int64_t)

Parameter
Name Description
v std::int64_t
Returns
Type Description
ObjectMetadata &

name() const

The object name, including bucket and generation.

Returns
Type Description
std::string const &

set_name(std::string)

Parameter
Name Description
v std::string
Returns
Type Description
ObjectMetadata &

has_owner() const

Returns true if the object has an owner attribute.

Returns
Type Description
bool

owner() const

The object's owner attribute.

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

Returns
Type Description
Owner const &

set_owner(Owner)

Parameter
Name Description
v Owner
Returns
Type Description
ObjectMetadata &

reset_owner()

Returns
Type Description
ObjectMetadata &

retention_expiration_time() const

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

Returns
Type Description
std::chrono::system_clock::time_point

set_retention_expiration_time(std::chrono::system_clock::time_point)

Parameter
Name Description
v std::chrono::system_clock::time_point
Returns
Type Description
ObjectMetadata &

has_retention() const

Returns true if the object has a retention configuration.

Returns
Type Description
bool

retention() const

The object's retention configuration.

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

Returns
Type Description
ObjectRetention const &

set_retention(ObjectRetention)

Change or set the object retention value.

Parameter
Name Description
v ObjectRetention
Returns
Type Description
ObjectMetadata &

reset_retention()

Reset the object retention.

Returns
Type Description
ObjectMetadata &

self_link() const

An HTTPS link to the object metadata.

Returns
Type Description
std::string const &

set_self_link(std::string)

Parameter
Name Description
v std::string
Returns
Type Description
ObjectMetadata &

size() const

The size of the object's data.

Returns
Type Description
std::uint64_t

set_size(std::uint64_t)

Parameter
Name Description
v std::uint64_t
Returns
Type Description
ObjectMetadata &

storage_class() const

The storageClass attribute.

Returns
Type Description
std::string const &

set_storage_class(std::string)

Changes the storageClass attribute.

Parameter
Name Description
v std::string
Returns
Type Description
ObjectMetadata &

temporary_hold() const

The temporaryHold attribute.

Returns
Type Description
bool

set_temporary_hold(bool)

Changes the temporaryHold attribute.

Parameter
Name Description
v bool
Returns
Type Description
ObjectMetadata &

time_created() const

The object creation timestamp.

Returns
Type Description
std::chrono::system_clock::time_point

set_time_created(std::chrono::system_clock::time_point)

Parameter
Name Description
v std::chrono::system_clock::time_point
Returns
Type Description
ObjectMetadata &

time_deleted() const

The object's deletion timestamp.

Returns
Type Description
std::chrono::system_clock::time_point

set_time_deleted(std::chrono::system_clock::time_point)

Parameter
Name Description
v std::chrono::system_clock::time_point
Returns
Type Description
ObjectMetadata &

time_storage_class_updated() const

The timestamp for the last storage class change.

Returns
Type Description
std::chrono::system_clock::time_point

set_time_storage_class_updated(std::chrono::system_clock::time_point)

Parameter
Name Description
v std::chrono::system_clock::time_point
Returns
Type Description
ObjectMetadata &

updated() const

The timestamp for the last object metadata update.

Returns
Type Description
std::chrono::system_clock::time_point

set_updated(std::chrono::system_clock::time_point)

Parameter
Name Description
v std::chrono::system_clock::time_point
Returns
Type Description
ObjectMetadata &

has_soft_delete_time() const

Returns true if the object has a soft delete timestamp.

Returns
Type Description
bool

soft_delete_time() const

This is the time when the object became soft-deleted.

Soft-deleted objects are only accessible if a soft_delete_policy is enabled in their bucket. Also see hard_delete_time().

Returns
Type Description
std::chrono::system_clock::time_point

set_soft_delete_time(std::chrono::system_clock::time_point)

Parameter
Name Description
v std::chrono::system_clock::time_point
Returns
Type Description
ObjectMetadata &

reset_soft_delete_time()

Returns
Type Description
ObjectMetadata &

has_hard_delete_time() const

Returns true if the object has a hard delete timestamp.

Returns
Type Description
bool

hard_delete_time() const

The time when the object will be permanently deleted.

Soft-deleted objects are permanently deleted after some time, based on the soft_delete_policy in their bucket. This is only set on soft-deleted objects, and indicates the earliest time at which the object will be permanently deleted.

Returns
Type Description
std::chrono::system_clock::time_point

set_hard_delete_time(std::chrono::system_clock::time_point)

Parameter
Name Description
v std::chrono::system_clock::time_point
Returns
Type Description
ObjectMetadata &

reset_hard_delete_time()

Returns
Type Description
ObjectMetadata &