Class ObjectMetadataPatchBuilder (2.19.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
TypeDescription
std::string

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

Parameter
NameDescription
v std::vector< ObjectAccessControl > const &
Returns
TypeDescription
ObjectMetadataPatchBuilder &

ResetAcl()

Clears the ACL.

Returns
TypeDescription
ObjectMetadataPatchBuilder &

SetCacheControl(std::string const &)

Parameter
NameDescription
v std::string const &
Returns
TypeDescription
ObjectMetadataPatchBuilder &

ResetCacheControl()

Returns
TypeDescription
ObjectMetadataPatchBuilder &

SetContentDisposition(std::string const &)

Parameter
NameDescription
v std::string const &
Returns
TypeDescription
ObjectMetadataPatchBuilder &

ResetContentDisposition()

Returns
TypeDescription
ObjectMetadataPatchBuilder &

SetContentEncoding(std::string const &)

Parameter
NameDescription
v std::string const &
Returns
TypeDescription
ObjectMetadataPatchBuilder &

ResetContentEncoding()

Returns
TypeDescription
ObjectMetadataPatchBuilder &

SetContentLanguage(std::string const &)

Parameter
NameDescription
v std::string const &
Returns
TypeDescription
ObjectMetadataPatchBuilder &

ResetContentLanguage()

Returns
TypeDescription
ObjectMetadataPatchBuilder &

SetContentType(std::string const &)

Parameter
NameDescription
v std::string const &
Returns
TypeDescription
ObjectMetadataPatchBuilder &

ResetContentType()

Returns
TypeDescription
ObjectMetadataPatchBuilder &

SetEventBasedHold(bool)

Parameter
NameDescription
v bool
Returns
TypeDescription
ObjectMetadataPatchBuilder &

ResetEventBasedHold()

Returns
TypeDescription
ObjectMetadataPatchBuilder &

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

Parameters
NameDescription
key std::string const &
value std::string const &
Returns
TypeDescription
ObjectMetadataPatchBuilder &

ResetMetadata(std::string const &)

Parameter
NameDescription
key std::string const &
Returns
TypeDescription
ObjectMetadataPatchBuilder &

ResetMetadata()

Returns
TypeDescription
ObjectMetadataPatchBuilder &

SetTemporaryHold(bool)

Parameter
NameDescription
v bool
Returns
TypeDescription
ObjectMetadataPatchBuilder &

ResetTemporaryHold()

Returns
TypeDescription
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
NameDescription
tp std::chrono::system_clock::time_point
Returns
TypeDescription
ObjectMetadataPatchBuilder &

ResetCustomTime()

Returns
TypeDescription
ObjectMetadataPatchBuilder &