Google Cloud Storage C++ Client  1.40.2
A C++ Client Library for Google Cloud Storage
Public Member Functions | List of all members
google::cloud::storage::ObjectMetadataPatchBuilder Class Reference

Prepares a patch for the Bucket resource. More...

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

Public Member Functions

 ObjectMetadataPatchBuilder ()=default
 
std::string BuildPatch () const
 
ObjectMetadataPatchBuilderSetAcl (std::vector< ObjectAccessControl > const &v)
 
ObjectMetadataPatchBuilderResetAcl ()
 Clears the ACL. More...
 
ObjectMetadataPatchBuilderSetCacheControl (std::string const &v)
 
ObjectMetadataPatchBuilderResetCacheControl ()
 
ObjectMetadataPatchBuilderSetContentDisposition (std::string const &v)
 
ObjectMetadataPatchBuilderResetContentDisposition ()
 
ObjectMetadataPatchBuilderSetContentEncoding (std::string const &v)
 
ObjectMetadataPatchBuilderResetContentEncoding ()
 
ObjectMetadataPatchBuilderSetContentLanguage (std::string const &v)
 
ObjectMetadataPatchBuilderResetContentLanguage ()
 
ObjectMetadataPatchBuilderSetContentType (std::string const &v)
 
ObjectMetadataPatchBuilderResetContentType ()
 
ObjectMetadataPatchBuilderSetEventBasedHold (bool v)
 
ObjectMetadataPatchBuilderResetEventBasedHold ()
 
ObjectMetadataPatchBuilderSetMetadata (std::string const &key, std::string const &value)
 
ObjectMetadataPatchBuilderResetMetadata (std::string const &key)
 
ObjectMetadataPatchBuilderResetMetadata ()
 
ObjectMetadataPatchBuilderSetTemporaryHold (bool v)
 
ObjectMetadataPatchBuilderResetTemporaryHold ()
 
ObjectMetadataPatchBuilderSetCustomTime (std::chrono::system_clock::time_point tp)
 Change the custom_time field. More...
 
ObjectMetadataPatchBuilderResetCustomTime ()
 

Detailed Description

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.

Definition at line 420 of file object_metadata.h.

Constructor & Destructor Documentation

◆ ObjectMetadataPatchBuilder()

google::cloud::storage::ObjectMetadataPatchBuilder::ObjectMetadataPatchBuilder ( )
default

Member Function Documentation

◆ BuildPatch()

std::string google::cloud::storage::ObjectMetadataPatchBuilder::BuildPatch ( ) const

◆ ResetAcl()

ObjectMetadataPatchBuilder& google::cloud::storage::ObjectMetadataPatchBuilder::ResetAcl ( )

Clears the ACL.

Warning
Currently the server ignores requests to reset the full ACL.

◆ ResetCacheControl()

ObjectMetadataPatchBuilder& google::cloud::storage::ObjectMetadataPatchBuilder::ResetCacheControl ( )

◆ ResetContentDisposition()

ObjectMetadataPatchBuilder& google::cloud::storage::ObjectMetadataPatchBuilder::ResetContentDisposition ( )

◆ ResetContentEncoding()

ObjectMetadataPatchBuilder& google::cloud::storage::ObjectMetadataPatchBuilder::ResetContentEncoding ( )

◆ ResetContentLanguage()

ObjectMetadataPatchBuilder& google::cloud::storage::ObjectMetadataPatchBuilder::ResetContentLanguage ( )

◆ ResetContentType()

ObjectMetadataPatchBuilder& google::cloud::storage::ObjectMetadataPatchBuilder::ResetContentType ( )

◆ ResetCustomTime()

ObjectMetadataPatchBuilder& google::cloud::storage::ObjectMetadataPatchBuilder::ResetCustomTime ( )

◆ ResetEventBasedHold()

ObjectMetadataPatchBuilder& google::cloud::storage::ObjectMetadataPatchBuilder::ResetEventBasedHold ( )

◆ ResetMetadata() [1/2]

ObjectMetadataPatchBuilder& google::cloud::storage::ObjectMetadataPatchBuilder::ResetMetadata ( )

◆ ResetMetadata() [2/2]

ObjectMetadataPatchBuilder& google::cloud::storage::ObjectMetadataPatchBuilder::ResetMetadata ( std::string const &  key)

◆ ResetTemporaryHold()

ObjectMetadataPatchBuilder& google::cloud::storage::ObjectMetadataPatchBuilder::ResetTemporaryHold ( )

◆ SetAcl()

ObjectMetadataPatchBuilder& google::cloud::storage::ObjectMetadataPatchBuilder::SetAcl ( std::vector< ObjectAccessControl > const &  v)

◆ SetCacheControl()

ObjectMetadataPatchBuilder& google::cloud::storage::ObjectMetadataPatchBuilder::SetCacheControl ( std::string const &  v)

◆ SetContentDisposition()

ObjectMetadataPatchBuilder& google::cloud::storage::ObjectMetadataPatchBuilder::SetContentDisposition ( std::string const &  v)

◆ SetContentEncoding()

ObjectMetadataPatchBuilder& google::cloud::storage::ObjectMetadataPatchBuilder::SetContentEncoding ( std::string const &  v)

◆ SetContentLanguage()

ObjectMetadataPatchBuilder& google::cloud::storage::ObjectMetadataPatchBuilder::SetContentLanguage ( std::string const &  v)

◆ SetContentType()

ObjectMetadataPatchBuilder& google::cloud::storage::ObjectMetadataPatchBuilder::SetContentType ( std::string const &  v)

◆ SetCustomTime()

ObjectMetadataPatchBuilder& google::cloud::storage::ObjectMetadataPatchBuilder::SetCustomTime ( std::chrono::system_clock::time_point  tp)

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::runtime_error(original.status().message());
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::runtime_error(updated.status().message());
std::cout << "The custom time for object " << updated->name()
<< " in bucket " << updated->bucket() << " was successfully set. "
<< "Full object details: " << *updated << "\n";
}

◆ SetEventBasedHold()

ObjectMetadataPatchBuilder& google::cloud::storage::ObjectMetadataPatchBuilder::SetEventBasedHold ( bool  v)

◆ SetMetadata()

ObjectMetadataPatchBuilder& google::cloud::storage::ObjectMetadataPatchBuilder::SetMetadata ( std::string const &  key,
std::string const &  value 
)

◆ SetTemporaryHold()

ObjectMetadataPatchBuilder& google::cloud::storage::ObjectMetadataPatchBuilder::SetTemporaryHold ( bool  v)