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.
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 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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-14 UTC."],[[["The latest version available is 2.37.0-rc, and there are multiple past versions of the ObjectMetadata class dating back to version 2.11.0 available for reference."],["This class, `ObjectMetadata`, represents the metadata associated with a Google Cloud Storage (GCS) Object, which includes attributes like `cacheControl`, `contentDisposition`, and user-defined metadata key-value pairs."],["Local modifications to an Object's metadata should be performed with `Client::PatchObject()` to reflect changes on GCS, as modifiers in this class only change the local representation."],["`ObjectMetadata` provides methods to manage various properties of a GCS object, including its Access Control List (ACL), custom metadata, content attributes, encryption details, and timestamps related to its lifecycle and storage class changes."],["The user can manipulate, create and delete metadata entries, including the ability to retrieve single entries, retrieve all entries, and test if an entry exists."]]],[]]