Google Cloud Storage C++ Client  1.32.1
A C++ Client Library for Google Cloud Storage
Public Member Functions | List of all members
google::cloud::storage::v1::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 298 of file object_metadata.h.

Constructor & Destructor Documentation

◆ ObjectMetadataPatchBuilder()

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

Member Function Documentation

◆ BuildPatch()

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

Definition at line 102 of file object_metadata.cc.

◆ ResetAcl()

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

Clears the ACL.

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

Definition at line 130 of file object_metadata.cc.

◆ ResetCacheControl()

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

Definition at line 144 of file object_metadata.cc.

◆ ResetContentDisposition()

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

Definition at line 159 of file object_metadata.cc.

◆ ResetContentEncoding()

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

Definition at line 173 of file object_metadata.cc.

◆ ResetContentLanguage()

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

Definition at line 187 of file object_metadata.cc.

◆ ResetContentType()

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

Definition at line 201 of file object_metadata.cc.

◆ ResetCustomTime()

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

Definition at line 255 of file object_metadata.cc.

◆ ResetEventBasedHold()

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

Definition at line 212 of file object_metadata.cc.

◆ ResetMetadata() [1/2]

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

Definition at line 231 of file object_metadata.cc.

◆ ResetMetadata() [2/2]

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

Definition at line 224 of file object_metadata.cc.

◆ ResetTemporaryHold()

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

Definition at line 243 of file object_metadata.cc.

◆ SetAcl()

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

Definition at line 114 of file object_metadata.cc.

◆ SetCacheControl()

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

Definition at line 135 of file object_metadata.cc.

◆ SetContentDisposition()

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

Definition at line 149 of file object_metadata.cc.

◆ SetContentEncoding()

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

Definition at line 164 of file object_metadata.cc.

◆ SetContentLanguage()

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

Definition at line 178 of file object_metadata.cc.

◆ SetContentType()

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

Definition at line 192 of file object_metadata.cc.

◆ SetCustomTime()

ObjectMetadataPatchBuilder & google::cloud::storage::v1::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,
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";
}
The Google Cloud Storage (GCS) Client.
Definition: client.h:195
StatusOr< ObjectMetadata > PatchObject(std::string bucket_name, std::string object_name, ObjectMetadata const &original, ObjectMetadata const &updated, Options &&... options)
Patches the metadata in a Google Cloud Storage Object.
Definition: client.h:1419
StatusOr< ObjectMetadata > GetObjectMetadata(std::string const &bucket_name, std::string const &object_name, Options &&... options)
Fetches the object metadata.
Definition: client.h:1033
Prepares a patch for the Bucket resource.
ObjectMetadataPatchBuilder & SetCustomTime(std::chrono::system_clock::time_point tp)
Change the custom_time field.
Contains all the Google Cloud Storage C++ client APIs.

Definition at line 248 of file object_metadata.cc.

◆ SetEventBasedHold()

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

Definition at line 206 of file object_metadata.cc.

◆ SetMetadata()

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

Definition at line 217 of file object_metadata.cc.

◆ SetTemporaryHold()

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

Definition at line 237 of file object_metadata.cc.