Struct BucketAutoclass (2.29.0)

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";
  }

Constructors

BucketAutoclass(bool)

Parameter
Name Description
e bool

BucketAutoclass(bool, std::string)

Parameters
Name Description
e bool
tsc std::string

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

Parameters
Name Description
e bool
tp std::chrono::system_clock::time_point

BucketAutoclass(bool, std::chrono::system_clock::time_point, std::string, std::chrono::system_clock::time_point)

Parameters
Name Description
e bool
tp std::chrono::system_clock::time_point
tsc std::string
tscu std::chrono::system_clock::time_point