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.
[[["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-04-02 UTC."],[[["This page provides comprehensive documentation for the `ObjectMetadata` class in the Google Cloud Storage C++ client library, detailing its role in representing the metadata of a Google Cloud Storage object."],["The `ObjectMetadata` class includes methods for accessing and modifying various attributes of an object, such as `cacheControl`, `contentDisposition`, `contentEncoding`, `contentType`, and custom metadata entries, among others."],["The documentation describes how to use functions like `has_metadata`, `metadata`, `delete_metadata`, `upsert_metadata`, `mutable_metadata`, and more to manage the object's metadata, with clear explanations and parameter details."],["It highlights that direct modifications using the `ObjectMetadata` modifiers only affect the local representation, and changes must be applied to Google Cloud Storage using methods such as `Client::PatchObject()`."],["The latest version available for `ObjectMetadata` is 2.37.0-rc, with a list of versions starting from 2.36.0 down to 2.11.0, all available for viewing."]]],[]]