Class BucketMetadata (2.26.0)

Represents a Google Cloud Storage Bucket Metadata object.

Constructors

BucketMetadata()

Functions

acl() const

Get and set Bucket Access Control Lists.

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

mutable_acl()

Get and set Bucket Access Control Lists.

Returns
Type Description
std::vector< BucketAccessControl > &

set_acl(std::vector< BucketAccessControl >)

Get and set Bucket Access Control Lists.

Parameter
Name Description
acl std::vector< BucketAccessControl >
Returns
Type Description
BucketMetadata &

has_autoclass() const

Accessors and modifiers for Autoclass configuration.

Returns
Type Description
bool

autoclass() const

Accessors and modifiers for Autoclass configuration.

Returns
Type Description
BucketAutoclass const &

autoclass_as_optional() const

Accessors and modifiers for Autoclass configuration.

Returns
Type Description
absl::optional< BucketAutoclass > const &

set_autoclass(BucketAutoclass)

Accessors and modifiers for Autoclass configuration.

Parameter
Name Description
v BucketAutoclass
Returns
Type Description
BucketMetadata &

reset_autoclass()

Accessors and modifiers for Autoclass configuration.

Returns
Type Description
BucketMetadata &

has_billing() const

Get and set billing configuration for the Bucket.

Returns
Type Description
bool

billing() const

Get and set billing configuration for the Bucket.

Returns
Type Description
BucketBilling const &

billing_as_optional() const

Get and set billing configuration for the Bucket.

Returns
Type Description
absl::optional< BucketBilling > const &

set_billing(BucketBilling const &)

Get and set billing configuration for the Bucket.

Parameter
Name Description
v BucketBilling const &
Returns
Type Description
BucketMetadata &

reset_billing()

Get and set billing configuration for the Bucket.

Returns
Type Description
BucketMetadata &

default_event_based_hold() const

Get and set the default event based hold for the Bucket.

Objects may have an event-based hold associated with them.

If a Bucket has the default_event_based_hold() parameter set, and you create a new object in the bucket without specifying its event-event based hold then the object gets the value set in the bucket.

See Also

https://cloud.google.com/storage/docs/bucket-lock for generation information on retention policies. The section on Object holds is particularly relevant.

See Also

https://cloud.google.com/storage/docs/holding-objects for examples of using default event-based hold policy.

Returns
Type Description
bool

set_default_event_based_hold(bool)

Get and set the default event based hold for the Bucket.

Objects may have an event-based hold associated with them.

If a Bucket has the default_event_based_hold() parameter set, and you create a new object in the bucket without specifying its event-event based hold then the object gets the value set in the bucket.

See Also

https://cloud.google.com/storage/docs/bucket-lock for generation information on retention policies. The section on Object holds is particularly relevant.

See Also

https://cloud.google.com/storage/docs/holding-objects for examples of using default event-based hold policy.

Parameter
Name Description
v bool
Returns
Type Description
BucketMetadata &

cors() const

Get and set CORS configuration for the Bucket.

See Also

https://en.wikipedia.org/wiki/Cross-origin_resource_sharing for general information on CORS.

See Also

https://cloud.google.com/storage/docs/cross-origin for general information about CORS in the context of Google Cloud Storage.

See Also

https://cloud.google.com/storage/docs/configuring-cors for information on how to set and troubleshoot CORS settings.

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

mutable_cors()

Get and set CORS configuration for the Bucket.

See Also

https://en.wikipedia.org/wiki/Cross-origin_resource_sharing for general information on CORS.

See Also

https://cloud.google.com/storage/docs/cross-origin for general information about CORS in the context of Google Cloud Storage.

See Also

https://cloud.google.com/storage/docs/configuring-cors for information on how to set and troubleshoot CORS settings.

Returns
Type Description
std::vector< CorsEntry > &

set_cors(std::vector< CorsEntry >)

Get and set CORS configuration for the Bucket.

See Also

https://en.wikipedia.org/wiki/Cross-origin_resource_sharing for general information on CORS.

See Also

https://cloud.google.com/storage/docs/cross-origin for general information about CORS in the context of Google Cloud Storage.

See Also

https://cloud.google.com/storage/docs/configuring-cors for information on how to set and troubleshoot CORS settings.

Parameter
Name Description
cors std::vector< CorsEntry >
Returns
Type Description
BucketMetadata &

default_acl() const

Get and set the Default Object Access Control Lists.

See Also

https://cloud.google.com/storage/docs/access-control/lists#default for general information of default ACLs.

See Also

https://cloud.google.com/storage/docs/encryption/customer-managed-keys for information on Customer-Managed Encryption Keys.

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

mutable_default_acl()

Get and set the Default Object Access Control Lists.

See Also

https://cloud.google.com/storage/docs/access-control/lists#default for general information of default ACLs.

See Also

https://cloud.google.com/storage/docs/encryption/customer-managed-keys for information on Customer-Managed Encryption Keys.

Returns
Type Description
std::vector< ObjectAccessControl > &

set_default_acl(std::vector< ObjectAccessControl >)

Get and set the Default Object Access Control Lists.

See Also

https://cloud.google.com/storage/docs/access-control/lists#default for general information of default ACLs.

See Also

https://cloud.google.com/storage/docs/encryption/customer-managed-keys for information on Customer-Managed Encryption Keys.

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

has_encryption() const

Get and set the Default Object Access Control Lists.

See Also

https://cloud.google.com/storage/docs/access-control/lists#default for general information of default ACLs.

See Also

https://cloud.google.com/storage/docs/encryption/customer-managed-keys for information on Customer-Managed Encryption Keys.

Returns
Type Description
bool

encryption() const

Get and set the Default Object Access Control Lists.

See Also

https://cloud.google.com/storage/docs/access-control/lists#default for general information of default ACLs.

See Also

https://cloud.google.com/storage/docs/encryption/customer-managed-keys for information on Customer-Managed Encryption Keys.

Returns
Type Description
BucketEncryption const &

encryption_as_optional() const

Get and set the Default Object Access Control Lists.

See Also

https://cloud.google.com/storage/docs/access-control/lists#default for general information of default ACLs.

See Also

https://cloud.google.com/storage/docs/encryption/customer-managed-keys for information on Customer-Managed Encryption Keys.

Returns
Type Description
absl::optional< BucketEncryption > const &

set_encryption(BucketEncryption)

Get and set the Default Object Access Control Lists.

See Also

https://cloud.google.com/storage/docs/access-control/lists#default for general information of default ACLs.

See Also

https://cloud.google.com/storage/docs/encryption/customer-managed-keys for information on Customer-Managed Encryption Keys.

Parameter
Name Description
v BucketEncryption
Returns
Type Description
BucketMetadata &

reset_encryption()

Get and set the Default Object Access Control Lists.

See Also

https://cloud.google.com/storage/docs/access-control/lists#default for general information of default ACLs.

See Also

https://cloud.google.com/storage/docs/encryption/customer-managed-keys for information on Customer-Managed Encryption Keys.

Returns
Type Description
BucketMetadata &

has_hierarchical_namespace() const

Get and set the hierarchical namespaces configuration.

Returns
Type Description
bool

hierarchical_namespace() const

Get and set the hierarchical namespaces configuration.

Returns
Type Description
BucketHierarchicalNamespace const &

hierarchical_namespace_as_optional() const

Get and set the hierarchical namespaces configuration.

Returns
Type Description
absl::optional< BucketHierarchicalNamespace > const &

set_hierarchical_namespace(BucketHierarchicalNamespace)

Get and set the hierarchical namespaces configuration.

Parameter
Name Description
v BucketHierarchicalNamespace
Returns
Type Description
BucketMetadata &

reset_hierarchical_namespace()

Get and set the hierarchical namespaces configuration.

Returns
Type Description
BucketMetadata &

has_iam_configuration() const

Get and set the IAM configuration.

See Also

Before enabling Uniform Bucket Level Access please review the feature documentation, as well as "Should you use uniform bucket-level access ?".

Returns
Type Description
bool

iam_configuration() const

Get and set the IAM configuration.

See Also

Before enabling Uniform Bucket Level Access please review the feature documentation, as well as "Should you use uniform bucket-level access ?".

Returns
Type Description
BucketIamConfiguration const &

iam_configuration_as_optional() const

Get and set the IAM configuration.

See Also

Before enabling Uniform Bucket Level Access please review the feature documentation, as well as "Should you use uniform bucket-level access ?".

Returns
Type Description
absl::optional< BucketIamConfiguration > const &

set_iam_configuration(BucketIamConfiguration)

Get and set the IAM configuration.

See Also

Before enabling Uniform Bucket Level Access please review the feature documentation, as well as "Should you use uniform bucket-level access ?".

Parameter
Name Description
v BucketIamConfiguration
Returns
Type Description
BucketMetadata &

reset_iam_configuration()

Get and set the IAM configuration.

See Also

Before enabling Uniform Bucket Level Access please review the feature documentation, as well as "Should you use uniform bucket-level access ?".

Returns
Type Description
BucketMetadata &

has_label(std::string const &) const

Returns true if the key is present in the Bucket's metadata labels.

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

label(std::string const &) const

Returns the value of key in the Bucket's metadata labels.

It is undefined behavior to call label(key) if has_label(key) == false.

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

delete_label(std::string const &)

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

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

upsert_label(std::string, std::string)

Insert or update the label entry.

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

labels() const

Returns all the Bucket's labels.

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

mutable_labels()

Returns all the Bucket's labels.

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

has_lifecycle() const

Accessors and modifiers for object lifecycle rules.

See Also

https://cloud.google.com/storage/docs/managing-lifecycles for general information on object lifecycle rules.

Returns
Type Description
bool

lifecycle() const

Accessors and modifiers for object lifecycle rules.

See Also

https://cloud.google.com/storage/docs/managing-lifecycles for general information on object lifecycle rules.

Returns
Type Description
BucketLifecycle const &

lifecycle_as_optional() const

Accessors and modifiers for object lifecycle rules.

See Also

https://cloud.google.com/storage/docs/managing-lifecycles for general information on object lifecycle rules.

Returns
Type Description
absl::optional< BucketLifecycle > const &

set_lifecycle(BucketLifecycle)

Accessors and modifiers for object lifecycle rules.

See Also

https://cloud.google.com/storage/docs/managing-lifecycles for general information on object lifecycle rules.

Parameter
Name Description
v BucketLifecycle
Returns
Type Description
BucketMetadata &

reset_lifecycle()

Accessors and modifiers for object lifecycle rules.

See Also

https://cloud.google.com/storage/docs/managing-lifecycles for general information on object lifecycle rules.

Returns
Type Description
BucketMetadata &

has_logging() const

Accessors and modifiers for logging configuration.

Returns
Type Description
bool

logging() const

Accessors and modifiers for logging configuration.

Returns
Type Description
BucketLogging const &

logging_as_optional() const

Accessors and modifiers for logging configuration.

Returns
Type Description
absl::optional< BucketLogging > const &

set_logging(BucketLogging)

Accessors and modifiers for logging configuration.

Parameter
Name Description
v BucketLogging
Returns
Type Description
BucketMetadata &

reset_logging()

Accessors and modifiers for logging configuration.

Returns
Type Description
BucketMetadata &

has_retention_policy() const

Sets the retention period.

The retention period is the only writable attribute in a retention policy. This function makes it easier to set the retention policy when the BucketMetadata object is used to update or patch the bucket.

Returns
Type Description
bool

retention_policy() const

Sets the retention period.

The retention period is the only writable attribute in a retention policy. This function makes it easier to set the retention policy when the BucketMetadata object is used to update or patch the bucket.

Returns
Type Description
BucketRetentionPolicy const &

retention_policy_as_optional() const

Sets the retention period.

The retention period is the only writable attribute in a retention policy. This function makes it easier to set the retention policy when the BucketMetadata object is used to update or patch the bucket.

Returns
Type Description
absl::optional< BucketRetentionPolicy > const &

set_retention_policy(BucketRetentionPolicy)

Sets the retention period.

The retention period is the only writable attribute in a retention policy. This function makes it easier to set the retention policy when the BucketMetadata object is used to update or patch the bucket.

Parameter
Name Description
v BucketRetentionPolicy
Returns
Type Description
BucketMetadata &

set_retention_policy(std::chrono::seconds)

Sets the retention period.

The retention period is the only writable attribute in a retention policy. This function makes it easier to set the retention policy when the BucketMetadata object is used to update or patch the bucket.

Parameter
Name Description
retention_period std::chrono::seconds
Returns
Type Description
BucketMetadata &

reset_retention_policy()

Sets the retention period.

The retention period is the only writable attribute in a retention policy. This function makes it easier to set the retention policy when the BucketMetadata object is used to update or patch the bucket.

Returns
Type Description
BucketMetadata &

rpo() const

Accessors and modifiers for the Recovery Point Objective.

Returns
Type Description
std::string const &

set_rpo(std::string)

Accessors and modifiers for the Recovery Point Objective.

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

has_soft_delete_policy() const

Sets the soft delete policy.

The retention period is the only writable attribute in a retention policy. This function makes it easier to set the retention policy when the BucketMetadata object is used to update or patch the bucket.

Returns
Type Description
bool

soft_delete_policy() const

Sets the soft delete policy.

The retention period is the only writable attribute in a retention policy. This function makes it easier to set the retention policy when the BucketMetadata object is used to update or patch the bucket.

Returns
Type Description
BucketSoftDeletePolicy const &

soft_delete_policy_as_optional() const

Sets the soft delete policy.

The retention period is the only writable attribute in a retention policy. This function makes it easier to set the retention policy when the BucketMetadata object is used to update or patch the bucket.

Returns
Type Description
absl::optional< BucketSoftDeletePolicy > const &

set_soft_delete_policy(BucketSoftDeletePolicy)

Sets the soft delete policy.

The retention period is the only writable attribute in a retention policy. This function makes it easier to set the retention policy when the BucketMetadata object is used to update or patch the bucket.

Parameter
Name Description
v BucketSoftDeletePolicy
Returns
Type Description
BucketMetadata &

set_soft_delete_policy(std::chrono::seconds)

Sets the soft delete policy.

The retention period is the only writable attribute in a retention policy. This function makes it easier to set the retention policy when the BucketMetadata object is used to update or patch the bucket.

Parameter
Name Description
retention_duration std::chrono::seconds
Returns
Type Description
BucketMetadata &

reset_soft_delete_policy()

Sets the soft delete policy.

The retention period is the only writable attribute in a retention policy. This function makes it easier to set the retention policy when the BucketMetadata object is used to update or patch the bucket.

Returns
Type Description
BucketMetadata &

storage_class() const

Access and modify the default storage class attribute.

Returns
Type Description
std::string const &

set_storage_class(std::string)

Access and modify the default storage class attribute.

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

versioning() const

Accessors and modifiers for versioning configuration.

Returns
Type Description
absl::optional< BucketVersioning > const &

has_versioning() const

Accessors and modifiers for versioning configuration.

Returns
Type Description
bool

enable_versioning()

Accessors and modifiers for versioning configuration.

Returns
Type Description
BucketMetadata &

disable_versioning()

Accessors and modifiers for versioning configuration.

Returns
Type Description
BucketMetadata &

reset_versioning()

Accessors and modifiers for versioning configuration.

Returns
Type Description
BucketMetadata &

set_versioning(absl::optional< BucketVersioning >)

Accessors and modifiers for versioning configuration.

Parameter
Name Description
v absl::optional< BucketVersioning >
Returns
Type Description
BucketMetadata &

has_website() const

Accessors and modifiers for website configuration.

Returns
Type Description
bool

website() const

Accessors and modifiers for website configuration.

Returns
Type Description
BucketWebsite const &

website_as_optional() const

Accessors and modifiers for website configuration.

Returns
Type Description
absl::optional< BucketWebsite > const &

set_website(BucketWebsite)

Accessors and modifiers for website configuration.

Parameter
Name Description
v BucketWebsite
Returns
Type Description
BucketMetadata &

reset_website()

Accessors and modifiers for website configuration.

Returns
Type Description
BucketMetadata &

has_custom_placement_config() const

Placement configuration can only be set when the bucket is created.

Returns
Type Description
bool

custom_placement_config() const

Placement configuration can only be set when the bucket is created.

Returns
Type Description
BucketCustomPlacementConfig const &

custom_placement_config_as_optional() const

Placement configuration can only be set when the bucket is created.

Returns
Type Description
absl::optional< BucketCustomPlacementConfig > const &

set_custom_placement_config(BucketCustomPlacementConfig)

Placement configuration can only be set when the bucket is created.

Parameter
Name Description
v BucketCustomPlacementConfig
Returns
Type Description
BucketMetadata &

reset_custom_placement_config()

Placement configuration can only be set when the bucket is created.

Returns
Type Description
BucketMetadata &

etag() const

Returns
Type Description
std::string const &

set_etag(std::string)

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

id() const

Return the bucket id.

Returns
Type Description
std::string const &

set_id(std::string)

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

kind() const

Returns
Type Description
std::string const &

set_kind(std::string)

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

location() const

Return the bucket location.

Returns
Type Description
std::string const &

set_location(std::string)

Set the bucket location. Only applicable when creating buckets.

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

location_type() const

Returns the location type (e.g. regional vs. dual region).

Returns
Type Description
std::string const &

set_location_type(std::string)

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

metageneration() const

The bucket metageneration.

Returns
Type Description
std::int64_t

set_metageneration(std::int64_t)

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

name() const

The bucket name.

Returns
Type Description
std::string const &

set_name(std::string)

Changes the name.

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

has_object_retention() const

Returns true if the bucket object_retention attribute is present.

Returns
Type Description
bool

object_retention() const

Returns the owner.

It is undefined behavior to call owner() if has_owner() is false.

Returns
Type Description
BucketObjectRetention const &

set_object_retention(BucketObjectRetention)

Parameter
Name Description
v BucketObjectRetention
Returns
Type Description
BucketMetadata &

reset_object_retention()

Returns
Type Description
BucketMetadata &

has_owner() const

Returns true if the bucket owner attribute is present.

Returns
Type Description
bool

owner() const

Returns the owner.

It is undefined behavior to call owner() if has_owner() is false.

Returns
Type Description
Owner const &

set_owner(Owner)

Parameter
Name Description
v Owner
Returns
Type Description
BucketMetadata &

reset_owner()

Returns
Type Description
BucketMetadata &

project_number() const

Returns
Type Description
std::int64_t const &

set_project_number(std::int64_t)

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

self_link() const

Returns a HTTP link to retrieve the bucket metadata.

Returns
Type Description
std::string const &

set_self_link(std::string)

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

time_created() const

Returns the bucket 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
BucketMetadata &

updated() const

Returns the timestamp for the last bucket 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
BucketMetadata &