Google Cloud Storage C++ Client 2.13.0
A C++ Client Library for Google Cloud Storage
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
google::cloud::storage::BucketAutoclass Struct Reference

The autoclass configuration for a Bucket. More...

#include <google/cloud/storage/bucket_autoclass.h>

Public Member Functions

 BucketAutoclass (bool e)
 
 BucketAutoclass (bool e, std::chrono::system_clock::time_point tp)
 

Public Attributes

bool enabled
 
std::chrono::system_clock::time_point toggle_time
 

Detailed Description

The autoclass configuration for a Bucket.

Example
namespace gcs = ::google::cloud::storage;
[](gcs::Client client, std::string const& bucket_name) {
auto metadata = client.GetBucketMetadata(bucket_name);
if (!metadata) throw google::cloud::Status(std::move(metadata).status());
if (!metadata->has_autoclass()) {
std::cout << "The bucket " << metadata->name() << " does not have an"
<< " autoclass configuration.\n";
return;
}
std::cout << "Autoclass is "
<< (metadata->autoclass().enabled ? "enabled" : "disabled")
<< " for bucket " << metadata->name() << ". "
<< " The bucket's full autoclass configuration is "
<< metadata->autoclass() << "\n";
}
Example
namespace gcs = ::google::cloud::storage;
[](gcs::Client client, std::string const& bucket_name, bool enabled) {
auto metadata = client.PatchBucket(
bucket_name, gcs::BucketMetadataPatchBuilder().SetAutoclass(
gcs::BucketAutoclass{enabled}));
if (!metadata) throw google::cloud::Status(std::move(metadata).status());
std::cout << "The autoclass configuration for bucket " << bucket_name
<< " was successfully updated.";
if (!metadata->has_autoclass()) {
std::cout << " The bucket no longer has an autoclass configuration.\n";
return;
}
std::cout << " The new configuration is " << metadata->autoclass() << "\n";
}
bool enabled
Definition: bucket_autoclass.h:44

Constructor & Destructor Documentation

◆ BucketAutoclass() [1/2]

google::cloud::storage::BucketAutoclass::BucketAutoclass ( bool  e)
inlineexplicit

◆ BucketAutoclass() [2/2]

google::cloud::storage::BucketAutoclass::BucketAutoclass ( bool  e,
std::chrono::system_clock::time_point  tp 
)
inlineexplicit

Member Data Documentation

◆ enabled

bool google::cloud::storage::BucketAutoclass::enabled

◆ toggle_time

std::chrono::system_clock::time_point google::cloud::storage::BucketAutoclass::toggle_time