Class ObjectMetadataPatchBuilder (2.16.0)

Prepares a patch for the Bucket resource.

The Bucket resource has many modifiable fields. The application may send a patch request to change (or delete) a small fraction of these fields by using this object.

See Also

https://cloud.google.com/storage/docs/json_api/v1/how-tos/performance#patch for general information on PATCH requests for the Google Cloud Storage JSON API.

Constructors

ObjectMetadataPatchBuilder()

Functions

BuildPatch() const

Returns
Type Description
std::string

SetAcl(std::vector< ObjectAccessControl > const &)

Parameter
Name Description
v std::vector< ObjectAccessControl > const &
Returns
Type Description
ObjectMetadataPatchBuilder &

ResetAcl()

Clears the ACL.

Returns
Type Description
ObjectMetadataPatchBuilder &

SetCacheControl(std::string const &)

Parameter
Name Description
v std::string const &
Returns
Type Description
ObjectMetadataPatchBuilder &

ResetCacheControl()

Returns
Type Description
ObjectMetadataPatchBuilder &

SetContentDisposition(std::string const &)

Parameter
Name Description
v std::string const &
Returns
Type Description
ObjectMetadataPatchBuilder &

ResetContentDisposition()

Returns
Type Description
ObjectMetadataPatchBuilder &

SetContentEncoding(std::string const &)

Parameter
Name Description
v std::string const &
Returns
Type Description
ObjectMetadataPatchBuilder &

ResetContentEncoding()

Returns
Type Description
ObjectMetadataPatchBuilder &

SetContentLanguage(std::string const &)

Parameter
Name Description
v std::string const &
Returns
Type Description
ObjectMetadataPatchBuilder &

ResetContentLanguage()

Returns
Type Description
ObjectMetadataPatchBuilder &

SetContentType(std::string const &)

Parameter
Name Description
v std::string const &
Returns
Type Description
ObjectMetadataPatchBuilder &

ResetContentType()

Returns
Type Description
ObjectMetadataPatchBuilder &

SetEventBasedHold(bool)

Parameter
Name Description
v bool
Returns
Type Description
ObjectMetadataPatchBuilder &

ResetEventBasedHold()

Returns
Type Description
ObjectMetadataPatchBuilder &

SetMetadata(std::string const &, std::string const &)

Parameters
Name Description
key std::string const &
value std::string const &
Returns
Type Description
ObjectMetadataPatchBuilder &

ResetMetadata(std::string const &)

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

ResetMetadata()

Returns
Type Description
ObjectMetadataPatchBuilder &

SetTemporaryHold(bool)

Parameter
Name Description
v bool
Returns
Type Description
ObjectMetadataPatchBuilder &

ResetTemporaryHold()

Returns
Type Description
ObjectMetadataPatchBuilder &

SetCustomTime(std::chrono::system_clock::time_point)

Change the custom_time field.

Example
  namespace gcs = ::google::cloud::storage;
  using ::google::cloud::StatusOr;
  [](gcs::Client client, std::string const& bucket_name,
     std::string const& object_name) {
    auto original = client.GetObjectMetadata(bucket_name, object_name);
    if (!original) throw std::move(original).status();

    auto const tp = std::chrono::system_clock::now() - std::chrono::hours(48);
    auto updated =
        client.PatchObject(bucket_name, object_name,
                           gcs::ObjectMetadataPatchBuilder{}.SetCustomTime(tp));
    if (!updated) throw std::move(updated).status();

    std::cout << "The custom time for object " << updated->name()
              << " in bucket " << updated->bucket() << " was successfully set. "
              << "Full object details: " << *updated << "\n";
  }
Parameter
Name Description
tp std::chrono::system_clock::time_point
Returns
Type Description
ObjectMetadataPatchBuilder &

ResetCustomTime()

Returns
Type Description
ObjectMetadataPatchBuilder &