Class ObjectMetadata (2.21.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
NameDescription
key std::string const &
Returns
TypeDescription
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
NameDescription
key std::string const &
Returns
TypeDescription
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
NameDescription
key std::string const &
Returns
TypeDescription
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
NameDescription
key std::string
value std::string
Returns
TypeDescription
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
TypeDescription
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
TypeDescription
std::map< std::string, std::string > &

acl() const

The access control list for this object.

Returns
TypeDescription
std::vector< ObjectAccessControl > const &

mutable_acl()

The access control list for this object.

Returns
TypeDescription
std::vector< ObjectAccessControl > &

set_acl(std::vector< ObjectAccessControl >)

Change the access control list.

Parameter
NameDescription
acl std::vector< ObjectAccessControl >
Returns
TypeDescription
ObjectMetadata &

bucket() const

The name of the bucket containing this object.

Returns
TypeDescription
std::string const &

set_bucket(std::string)

Parameter
NameDescription
v std::string
Returns
TypeDescription
ObjectMetadata &

cache_control() const

The cacheControl attribute.

Returns
TypeDescription
std::string const &

set_cache_control(std::string)

Set the cacheControl attribute.

Parameter
NameDescription
cache_control std::string
Returns
TypeDescription
ObjectMetadata &

component_count() const

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

Returns
TypeDescription
std::int32_t

set_component_count(std::int32_t)

Parameter
NameDescription
v std::int32_t
Returns
TypeDescription
ObjectMetadata &

content_disposition() const

The contentDisposition attribute.

Returns
TypeDescription
std::string

set_content_disposition(std::string)

Change the contentDisposition attribute.

Parameter
NameDescription
value std::string
Returns
TypeDescription
ObjectMetadata &

content_encoding() const

The contentEncoding attribute.

Returns
TypeDescription
std::string

set_content_encoding(std::string)

Change the contentEncoding attribute.

Parameter
NameDescription
value std::string
Returns
TypeDescription
ObjectMetadata &

content_language() const

The contentLanguage attribute.

Returns
TypeDescription
std::string

set_content_language(std::string)

Change the contentLanguage attribute.

Parameter
NameDescription
value std::string
Returns
TypeDescription
ObjectMetadata &

content_type() const

The contentType attribute.

Returns
TypeDescription
std::string

set_content_type(std::string)

Change the contentLanguage attribute.

Parameter
NameDescription
value std::string
Returns
TypeDescription
ObjectMetadata &

crc32c() const

The CRC32C checksum for the object contents.

Returns
TypeDescription
std::string const &

set_crc32c(std::string)

Parameter
NameDescription
v std::string
Returns
TypeDescription
ObjectMetadata &

has_custom_time() const

Returns true if the object has a customTime attribute.

Returns
TypeDescription
bool

custom_time() const

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

Returns
TypeDescription
std::chrono::system_clock::time_point

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

Changes the customTime attribute.

Parameter
NameDescription
v std::chrono::system_clock::time_point
Returns
TypeDescription
ObjectMetadata &

reset_custom_time()

Reset (clears) the customTime attribute.

has_custom_time() returns false after calling this function.

Returns
TypeDescription
ObjectMetadata &

has_customer_encryption() const

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

Returns
TypeDescription
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
TypeDescription
CustomerEncryption const &

set_customer_encryption(CustomerEncryption)

Parameter
NameDescription
v CustomerEncryption
Returns
TypeDescription
ObjectMetadata &

reset_customer_encryption()

Returns
TypeDescription
ObjectMetadata &

etag() const

The Etag attribute.

Returns
TypeDescription
std::string const &

set_etag(std::string)

Parameter
NameDescription
v std::string
Returns
TypeDescription
ObjectMetadata &

event_based_hold() const

The eventBasedHold attribute.

Returns
TypeDescription
bool

set_event_based_hold(bool)

Changes the eventBasedHold attribute.

Parameter
NameDescription
v bool
Returns
TypeDescription
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
TypeDescription
std::int64_t

set_generation(std::int64_t)

Parameter
NameDescription
v std::int64_t
Returns
TypeDescription
ObjectMetadata &

id() const

The id attribute (the object name)

Returns
TypeDescription
std::string const &

set_id(std::string)

Parameter
NameDescription
v std::string
Returns
TypeDescription
ObjectMetadata &

kind() const

The kind attribute, that is, storage#object.

Returns
TypeDescription
std::string const &

set_kind(std::string)

Parameter
NameDescription
v std::string
Returns
TypeDescription
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
TypeDescription
std::string const &

set_kms_key_name(std::string)

Parameter
NameDescription
v std::string
Returns
TypeDescription
ObjectMetadata &

md5_hash() const

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

Returns
TypeDescription
std::string const &

set_md5_hash(std::string)

Parameter
NameDescription
v std::string
Returns
TypeDescription
ObjectMetadata &

media_link() const

The HTTPS link to access the object contents.

Returns
TypeDescription
std::string const &

set_media_link(std::string)

Parameter
NameDescription
v std::string
Returns
TypeDescription
ObjectMetadata &

metageneration() const

The generation of the object metadata.

Returns
TypeDescription
std::int64_t

set_metageneration(std::int64_t)

Parameter
NameDescription
v std::int64_t
Returns
TypeDescription
ObjectMetadata &

name() const

The object name, including bucket and generation.

Returns
TypeDescription
std::string const &

set_name(std::string)

Parameter
NameDescription
v std::string
Returns
TypeDescription
ObjectMetadata &

has_owner() const

Returns true if the object has an owner attribute.

Returns
TypeDescription
bool

owner() const

The object's owner attribute.

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

Returns
TypeDescription
Owner const &

set_owner(Owner)

Parameter
NameDescription
v Owner
Returns
TypeDescription
ObjectMetadata &

reset_owner()

Returns
TypeDescription
ObjectMetadata &

retention_expiration_time() const

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

Returns
TypeDescription
std::chrono::system_clock::time_point

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

Parameter
NameDescription
v std::chrono::system_clock::time_point
Returns
TypeDescription
ObjectMetadata &

self_link() const

An HTTPS link to the object metadata.

Returns
TypeDescription
std::string const &

set_self_link(std::string)

Parameter
NameDescription
v std::string
Returns
TypeDescription
ObjectMetadata &

size() const

The size of the object's data.

Returns
TypeDescription
std::uint64_t

set_size(std::uint64_t)

Parameter
NameDescription
v std::uint64_t
Returns
TypeDescription
ObjectMetadata &

storage_class() const

The storageClass attribute.

Returns
TypeDescription
std::string const &

set_storage_class(std::string)

Changes the storageClass attribute.

Parameter
NameDescription
v std::string
Returns
TypeDescription
ObjectMetadata &

temporary_hold() const

The temporaryHold attribute.

Returns
TypeDescription
bool

set_temporary_hold(bool)

Changes the temporaryHold attribute.

Parameter
NameDescription
v bool
Returns
TypeDescription
ObjectMetadata &

time_created() const

The object creation timestamp.

Returns
TypeDescription
std::chrono::system_clock::time_point

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

Parameter
NameDescription
v std::chrono::system_clock::time_point
Returns
TypeDescription
ObjectMetadata &

time_deleted() const

The object's deletion timestamp.

Returns
TypeDescription
std::chrono::system_clock::time_point

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

Parameter
NameDescription
v std::chrono::system_clock::time_point
Returns
TypeDescription
ObjectMetadata &

time_storage_class_updated() const

The timestamp for the last storage class change.

Returns
TypeDescription
std::chrono::system_clock::time_point

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

Parameter
NameDescription
v std::chrono::system_clock::time_point
Returns
TypeDescription
ObjectMetadata &

updated() const

The timestamp for the last object metadata update.

Returns
TypeDescription
std::chrono::system_clock::time_point

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

Parameter
NameDescription
v std::chrono::system_clock::time_point
Returns
TypeDescription
ObjectMetadata &