Google Cloud Storage C++ Client 2.13.0
A C++ Client Library for Google Cloud Storage
|
The Google Cloud Storage (GCS) Client. More...
#include <google/cloud/storage/client.h>
Classes | |
struct | NoDecorations |
Define a tag to disable automatic decorations of the RawClient. More... | |
Public Member Functions | |
Client (Options opts={}) | |
Build a new client. More... | |
template<typename... Options> | |
StatusOr< PolicyDocumentResult > | CreateSignedPolicyDocument (PolicyDocument document, Options &&... options) |
Create a signed policy document. More... | |
template<typename... Options> | |
StatusOr< PolicyDocumentV4Result > | GenerateSignedPostPolicyV4 (PolicyDocumentV4 document, Options &&... options) |
Create a signed V4 policy document. More... | |
template<typename... Policies> | |
Client (ClientOptions options, Policies &&... policies) | |
Creates the default client type given the options. More... | |
template<typename... Policies> | |
Client (std::shared_ptr< oauth2::Credentials > credentials, Policies &&... policies) | |
Creates the default client type given the credentials and policies. More... | |
template<typename... Policies> | |
Client (std::shared_ptr< internal::RawClient > client, Policies &&... policies) | |
Builds a client and maybe override the retry, idempotency, and/or backoff policies. More... | |
Client (std::shared_ptr< internal::RawClient > client, NoDecorations) | |
Builds a client with a specific RawClient, without decorations. More... | |
std::shared_ptr< internal::RawClient > | raw_client () const |
Access the underlying RawClient . More... | |
Bucket operations. | |
Buckets are the basic containers that hold your data. Everything that you store in GCS must be contained in a bucket. You can use buckets to organize your data and control access to your data, but unlike directories and folders, you cannot nest buckets.
| |
template<typename... Options> | |
ListBucketsReader | ListBucketsForProject (std::string const &project_id, Options &&... options) |
Fetches the list of buckets for a given project. More... | |
template<typename... Options> | |
ListBucketsReader | ListBuckets (Options &&... options) |
Fetches the list of buckets for the default project. More... | |
template<typename... Options> | |
StatusOr< BucketMetadata > | CreateBucket (std::string bucket_name, BucketMetadata metadata, Options &&... options) |
Creates a new Google Cloud Storage bucket using the default project. More... | |
template<typename... Options> | |
StatusOr< BucketMetadata > | CreateBucketForProject (std::string bucket_name, std::string project_id, BucketMetadata metadata, Options &&... options) |
Creates a new Google Cloud Storage Bucket in a given project. More... | |
template<typename... Options> | |
StatusOr< BucketMetadata > | GetBucketMetadata (std::string const &bucket_name, Options &&... options) |
Fetches the bucket metadata. More... | |
template<typename... Options> | |
Status | DeleteBucket (std::string const &bucket_name, Options &&... options) |
Deletes a Google Cloud Storage Bucket. More... | |
template<typename... Options> | |
StatusOr< BucketMetadata > | UpdateBucket (std::string bucket_name, BucketMetadata metadata, Options &&... options) |
Updates the metadata in a Google Cloud Storage Bucket. More... | |
template<typename... Options> | |
StatusOr< BucketMetadata > | PatchBucket (std::string bucket_name, BucketMetadata const &original, BucketMetadata const &updated, Options &&... options) |
Computes the difference between two BucketMetadata objects and patches a bucket based on that difference. More... | |
template<typename... Options> | |
StatusOr< BucketMetadata > | PatchBucket (std::string bucket_name, BucketMetadataPatchBuilder const &builder, Options &&... options) |
Patches the metadata in a Google Cloud Storage Bucket given a desired set changes. More... | |
template<typename... Options> | |
StatusOr< NativeIamPolicy > | GetNativeBucketIamPolicy (std::string const &bucket_name, Options &&... options) |
Fetches the native IAM policy for a Bucket. More... | |
template<typename... Options> | |
StatusOr< NativeIamPolicy > | SetNativeBucketIamPolicy (std::string const &bucket_name, NativeIamPolicy const &iam_policy, Options &&... options) |
Sets the native IAM Policy for a Bucket. More... | |
template<typename... Options> | |
StatusOr< std::vector< std::string > > | TestBucketIamPermissions (std::string bucket_name, std::vector< std::string > permissions, Options &&... options) |
Tests the IAM permissions of the caller against a Bucket. More... | |
template<typename... Options> | |
StatusOr< BucketMetadata > | LockBucketRetentionPolicy (std::string const &bucket_name, std::uint64_t metageneration, Options &&... options) |
Locks the retention policy for a bucket. More... | |
Object operations | |
Objects are the individual pieces of data that you store in GCS. Objects have two components: object data and object metadata. Object data (sometimes referred to as media) is typically a file that you want to store in GCS. Object metadata is information that describe various object qualities.
| |
template<typename... Options> | |
StatusOr< ObjectMetadata > | InsertObject (std::string const &bucket_name, std::string const &object_name, absl::string_view contents, Options &&... options) |
Creates an object given its name and contents. More... | |
template<typename... Options> | |
StatusOr< ObjectMetadata > | InsertObject (std::string const &bucket_name, std::string const &object_name, std::string const &contents, Options &&... options) |
Creates an object given its name and contents. More... | |
template<typename... Options> | |
StatusOr< ObjectMetadata > | InsertObject (std::string const &bucket_name, std::string const &object_name, char const *contents, Options &&... options) |
Creates an object given its name and contents. More... | |
template<typename... Options> | |
StatusOr< ObjectMetadata > | CopyObject (std::string source_bucket_name, std::string source_object_name, std::string destination_bucket_name, std::string destination_object_name, Options &&... options) |
Copies an existing object. More... | |
template<typename... Options> | |
StatusOr< ObjectMetadata > | GetObjectMetadata (std::string const &bucket_name, std::string const &object_name, Options &&... options) |
Fetches the object metadata. More... | |
template<typename... Options> | |
ListObjectsReader | ListObjects (std::string const &bucket_name, Options &&... options) |
Lists the objects in a bucket. More... | |
template<typename... Options> | |
ListObjectsAndPrefixesReader | ListObjectsAndPrefixes (std::string const &bucket_name, Options &&... options) |
Lists the objects and prefixes in a bucket. More... | |
template<typename... Options> | |
ObjectReadStream | ReadObject (std::string const &bucket_name, std::string const &object_name, Options &&... options) |
Reads the contents of an object. More... | |
template<typename... Options> | |
ObjectWriteStream | WriteObject (std::string const &bucket_name, std::string const &object_name, Options &&... options) |
Writes contents into an object. More... | |
template<typename... Options> | |
StatusOr< ObjectMetadata > | UploadFile (std::string const &file_name, std::string const &bucket_name, std::string const &object_name, Options &&... options) |
Uploads a file to an object. More... | |
template<typename... Options> | |
Status | DeleteResumableUpload (std::string const &upload_session_url, Options &&... options) |
Cancel a resumable upload. More... | |
template<typename... Options> | |
Status | DownloadToFile (std::string const &bucket_name, std::string const &object_name, std::string const &file_name, Options &&... options) |
Downloads a Cloud Storage object to a file. More... | |
template<typename... Options> | |
Status | DeleteObject (std::string const &bucket_name, std::string const &object_name, Options &&... options) |
Deletes an object. More... | |
template<typename... Options> | |
StatusOr< ObjectMetadata > | UpdateObject (std::string bucket_name, std::string object_name, ObjectMetadata metadata, Options &&... options) |
Updates the metadata in a Google Cloud Storage Object. More... | |
template<typename... Options> | |
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. More... | |
template<typename... Options> | |
StatusOr< ObjectMetadata > | PatchObject (std::string bucket_name, std::string object_name, ObjectMetadataPatchBuilder const &builder, Options &&... options) |
Patches the metadata in a Google Cloud Storage Object. More... | |
template<typename... Options> | |
StatusOr< ObjectMetadata > | ComposeObject (std::string bucket_name, std::vector< ComposeSourceObject > source_objects, std::string destination_object_name, Options &&... options) |
Composes existing objects into a new object in the same bucket. More... | |
template<typename... Options> | |
ObjectRewriter | RewriteObject (std::string source_bucket_name, std::string source_object_name, std::string destination_bucket_name, std::string destination_object_name, Options &&... options) |
Creates an ObjectRewriter to copy the source object. More... | |
template<typename... Options> | |
ObjectRewriter | ResumeRewriteObject (std::string source_bucket_name, std::string source_object_name, std::string destination_bucket_name, std::string destination_object_name, std::string rewrite_token, Options &&... options) |
Creates an ObjectRewriter to resume a previously created rewrite. More... | |
template<typename... Options> | |
StatusOr< ObjectMetadata > | RewriteObjectBlocking (std::string source_bucket_name, std::string source_object_name, std::string destination_bucket_name, std::string destination_object_name, Options &&... options) |
Rewrites the object, blocking until the rewrite completes, and returns the resulting ObjectMetadata . More... | |
Bucket Access Control List operations. | |
You can control who has access to your GCS buckets and objects as well as what level of access they have.
| |
template<typename... Options> | |
StatusOr< std::vector< BucketAccessControl > > | ListBucketAcl (std::string const &bucket_name, Options &&... options) |
Retrieves the list of BucketAccessControl items for a bucket. More... | |
template<typename... Options> | |
StatusOr< BucketAccessControl > | CreateBucketAcl (std::string const &bucket_name, std::string const &entity, std::string const &role, Options &&... options) |
Creates a new entry in a bucket ACL. More... | |
template<typename... Options> | |
Status | DeleteBucketAcl (std::string const &bucket_name, std::string const &entity, Options &&... options) |
Deletes an entry from a bucket ACL. More... | |
template<typename... Options> | |
StatusOr< BucketAccessControl > | GetBucketAcl (std::string const &bucket_name, std::string const &entity, Options &&... options) |
Gets the value of an existing bucket ACL. More... | |
template<typename... Options> | |
StatusOr< BucketAccessControl > | UpdateBucketAcl (std::string const &bucket_name, BucketAccessControl const &acl, Options &&... options) |
Updates the value of an existing bucket ACL. More... | |
template<typename... Options> | |
StatusOr< BucketAccessControl > | PatchBucketAcl (std::string const &bucket_name, std::string const &entity, BucketAccessControl const &original_acl, BucketAccessControl const &new_acl, Options &&... options) |
Patches the value of an existing bucket ACL. More... | |
template<typename... Options> | |
StatusOr< BucketAccessControl > | PatchBucketAcl (std::string const &bucket_name, std::string const &entity, BucketAccessControlPatchBuilder const &builder, Options &&... options) |
Patches the value of an existing bucket ACL. More... | |
Object Access Control List operations. | |
You can control who has access to your GCS buckets and objects as well as what level of access they have.
| |
template<typename... Options> | |
StatusOr< std::vector< ObjectAccessControl > > | ListObjectAcl (std::string const &bucket_name, std::string const &object_name, Options &&... options) |
Retrieves the list of ObjectAccessControl items for an object. More... | |
template<typename... Options> | |
StatusOr< ObjectAccessControl > | CreateObjectAcl (std::string const &bucket_name, std::string const &object_name, std::string const &entity, std::string const &role, Options &&... options) |
Creates a new entry in the object ACL. More... | |
template<typename... Options> | |
Status | DeleteObjectAcl (std::string const &bucket_name, std::string const &object_name, std::string const &entity, Options &&... options) |
Deletes one access control entry in one object. More... | |
template<typename... Options> | |
StatusOr< ObjectAccessControl > | GetObjectAcl (std::string const &bucket_name, std::string const &object_name, std::string const &entity, Options &&... options) |
Gets the value of an existing object ACL. More... | |
template<typename... Options> | |
StatusOr< ObjectAccessControl > | UpdateObjectAcl (std::string const &bucket_name, std::string const &object_name, ObjectAccessControl const &acl, Options &&... options) |
Updates the value of an existing object ACL. More... | |
template<typename... Options> | |
StatusOr< ObjectAccessControl > | PatchObjectAcl (std::string const &bucket_name, std::string const &object_name, std::string const &entity, ObjectAccessControl const &original_acl, ObjectAccessControl const &new_acl, Options &&... options) |
Patches the value of an existing object ACL. More... | |
template<typename... Options> | |
StatusOr< ObjectAccessControl > | PatchObjectAcl (std::string const &bucket_name, std::string const &object_name, std::string const &entity, ObjectAccessControlPatchBuilder const &builder, Options &&... options) |
Patches the value of an existing object ACL. More... | |
Bucket Default Object Access Control List operations. | |
When you upload an object to GCS without specifying an ACL, the object is created with the Default Object ACL for its bucket. These operations are used to query and modify the Default Object ACL of a bucket.
| |
template<typename... Options> | |
StatusOr< std::vector< ObjectAccessControl > > | ListDefaultObjectAcl (std::string const &bucket_name, Options &&... options) |
Retrieves the default object ACL for a bucket as a vector of ObjectAccessControl items. More... | |
template<typename... Options> | |
StatusOr< ObjectAccessControl > | CreateDefaultObjectAcl (std::string const &bucket_name, std::string const &entity, std::string const &role, Options &&... options) |
Creates a new entry in the default object ACL for a bucket. More... | |
template<typename... Options> | |
Status | DeleteDefaultObjectAcl (std::string const &bucket_name, std::string const &entity, Options &&... options) |
Deletes an entry from the default object ACL in a bucket. More... | |
template<typename... Options> | |
StatusOr< ObjectAccessControl > | GetDefaultObjectAcl (std::string const &bucket_name, std::string const &entity, Options &&... options) |
Gets the value of a default object ACL in a bucket. More... | |
template<typename... Options> | |
StatusOr< ObjectAccessControl > | UpdateDefaultObjectAcl (std::string const &bucket_name, ObjectAccessControl const &acl, Options &&... options) |
Updates the value of an existing default object ACL. More... | |
template<typename... Options> | |
StatusOr< ObjectAccessControl > | PatchDefaultObjectAcl (std::string const &bucket_name, std::string const &entity, ObjectAccessControl const &original_acl, ObjectAccessControl const &new_acl, Options &&... options) |
Patches the value of an existing default object ACL. More... | |
template<typename... Options> | |
StatusOr< ObjectAccessControl > | PatchDefaultObjectAcl (std::string const &bucket_name, std::string const &entity, ObjectAccessControlPatchBuilder const &builder, Options &&... options) |
Patches the value of an existing default object ACL. More... | |
Service account operations. | |
Service accounts allow applications to authenticate and access GCP resources and services. When acting on your behalf, GCS uses such a service account. GCS creates one service account per project. These operations allow you to query the GCS service account for a project.
| |
template<typename... Options> | |
StatusOr< ServiceAccount > | GetServiceAccountForProject (std::string const &project_id, Options &&... options) |
Gets the GCS service account for a given project. More... | |
template<typename... Options> | |
StatusOr< ServiceAccount > | GetServiceAccount (Options &&... options) |
Gets the GCS service account for the default project. More... | |
template<typename... Options> | |
ListHmacKeysReader | ListHmacKeys (Options &&... options) |
List the available HMAC keys. More... | |
template<typename... Options> | |
StatusOr< std::pair< HmacKeyMetadata, std::string > > | CreateHmacKey (std::string service_account, Options &&... options) |
Create a new HMAC key. More... | |
template<typename... Options> | |
Status | DeleteHmacKey (std::string access_id, Options &&... options) |
Delete a HMAC key in a given project. More... | |
template<typename... Options> | |
StatusOr< HmacKeyMetadata > | GetHmacKey (std::string access_id, Options &&... options) |
Get an existing HMAC key in a given project. More... | |
template<typename... Options> | |
StatusOr< HmacKeyMetadata > | UpdateHmacKey (std::string access_id, HmacKeyMetadata resource, Options &&... options) |
Update an existing HMAC key in a given project. More... | |
Signed URL support operations. | |
template<typename... Options> | |
StatusOr< std::string > | CreateV2SignedUrl (std::string verb, std::string bucket_name, std::string object_name, Options &&... options) |
Create a V2 signed URL for the given parameters. More... | |
template<typename... Options> | |
StatusOr< std::string > | CreateV4SignedUrl (std::string verb, std::string bucket_name, std::string object_name, Options &&... options) |
Create a V4 signed URL for the given parameters. More... | |
Pub/Sub operations. | |
Cloud Pub/Sub Notifications sends information about changes to objects in your buckets to Cloud Pub/Sub, where the information is added to a Cloud Pub/Sub topic of your choice in the form of messages.
| |
template<typename... Options> | |
StatusOr< std::vector< NotificationMetadata > > | ListNotifications (std::string const &bucket_name, Options &&... options) |
Retrieves the list of Notifications for a Bucket. More... | |
template<typename... Options> | |
StatusOr< NotificationMetadata > | CreateNotification (std::string const &bucket_name, std::string const &topic_name, NotificationMetadata metadata, Options &&... options) |
Creates a new notification config for a Bucket. More... | |
template<typename... Options> | |
StatusOr< NotificationMetadata > | CreateNotification (std::string const &bucket_name, std::string const &topic_name, std::string const &payload_format, NotificationMetadata metadata, Options &&... options) |
Creates a new notification config for a Bucket. More... | |
template<typename... Options> | |
StatusOr< NotificationMetadata > | GetNotification (std::string const &bucket_name, std::string const ¬ification_id, Options &&... options) |
Gets the details about a notification config in a given Bucket. More... | |
template<typename... Options> | |
Status | DeleteNotification (std::string const &bucket_name, std::string const ¬ification_id, Options &&... options) |
Delete an existing notification config in a given Bucket. More... | |
Static Public Member Functions | |
static StatusOr< Client > | CreateDefaultClient () |
Create a Client using ClientOptions::CreateDefaultClientOptions(). More... | |
Friends | |
Equality | |
bool | operator== (Client const &a, Client const &b) |
bool | operator!= (Client const &a, Client const &b) |
The Google Cloud Storage (GCS) Client.
This is the main class to interact with GCS. It provides member functions to invoke all the APIs in the service.
The application can limit the maximum size of this connection pool using storage::ConnectionPoolSizeOption
. If returning a connection to the pool would make the pool larger than this limit then the oldest connection in the pool is closed (recall that all connections in the pool are inactive). Note that this is the maximum size of the pool, the client library does not create connections until needed.
Note that the application may (at times) use more connections than the maximum size of the pool. For example if N downloads are in progress the library may need N connections, even if the pool size is smaller.
Two clients that compare equal share the same connection pool. Two clients created with the default constructor or with the constructor from a google::cloud::Options
are never equal and do not share connection pools. Clients created via copy (or move) construction compare equal and share the connection pool.
Finding or loading the ADCs can fail. This will result in run-time errors when making requests.
If you prefer to explicitly load the ADCs use:
To load a service account credentials key file use:
Other credential types are available, including:
google::cloud::MakeInsecureCredentials()
for anonymous access to public GCS buckets or objects.google::cloud::MakeAccessTokenCredentials()
to use an access token obtained through any out-of-band mechanism.google::cloud::MakeImpersonateServiceAccountCredentials()
to use the IAM credentials service and [impersonate a service account].google::cloud::MakeServiceAccountCredentials()
to use a service account key file.StatusOr<T>
to report errors. When an operation fails to perform its work the returned StatusOr<T>
contains the error details. If the ok()
member function in the StatusOr<T>
returns true
then it contains the expected result. Please consult the `StatusOr<T>` documentation for more details.In addition, the main page contains examples using StatusOr<T>
to handle errors.
Some applications may want to retrieve specific versions. In this case just provide the Generation
request option:
Each function documents the types accepted as optional request options. These parameters can be specified in any order. Specifying a request option that is not applicable to a member function results in a compile-time error.
All operations support the following common request options:
Fields
: return a partial response, which includes only the desired fields.QuotaUser
: attribute the request to this specific label for quota purposes.UserProject
: change the request costs (if applicable) to this GCP project.CustomHeader
: include a custom header with the request. These are typically used for testing, though they are sometimes helpful if environments where HTTPS traffic is mediated by a proxy.IfMatchEtag
: a pre-condition, the operation succeeds only if the resource ETag matches. Typically used in OCC loops ("change X only if its Etag is
still Y"). Note that GCS sometimes ignores this header, we recommend you use the GCS specific pre-conditions (e.g., IfGenerationMatch
, IfMetagenerationMatch
and their *NotMatch
counterparts) instead.IfNoneMatchEtag
: a pre-condition, abort the operation if the resource ETag has not changed. Typically used in caching ("return the contents of X
only if the Etag is different from the last value I got, which was Y"). Note that GCS sometimes ignores this header, we recommend you use the GCS specific pre-conditions (e.g., IfGenerationMatch
, IfMetagenerationMatch
and their *NotMatch
counterparts) instead.UserIp
: attribute the request to this specific IP address for quota purpose. Not recommended, prefer QuotaUser
instead.In addition to the request options, which are passed on to the service to modify the request, you can specify options that override the local behavior of the library. For example, you can override the local retry policy:
The library automatically retries requests that fail with transient errors, and follows the recommended practice to backoff between retries.
The default policies are to continue retrying for up to 15 minutes, and to use truncated (at 5 minutes) exponential backoff, doubling the maximum backoff period between retries. Likewise, the idempotency policy is configured to retry all operations.
The application can override these policies when constructing objects of this class. The documentation for the constructors show examples of this in action.
LimitedTimeRetryPolicy
and LimitedErrorCountRetryPolicy
for alternative retry policies.ExponentialBackoffPolicy
to configure different parameters for the exponential backoff policy.AlwaysRetryIdempotencyPolicy
and StrictIdempotencyPolicy
for alternative idempotency policies.
|
explicit |
Build a new client.
opts | the configuration parameters for the Client . |
|
inlineexplicit |
Creates the default client type given the options.
options | the client options, these are used to control credentials, buffer sizes, etc. |
policies | the client policies, these control the behavior of the client, for example, how to backoff when an operation needs to be retried, or what operations cannot be retried because they are not idempotent. |
google::cloud::Options
instead.
|
inlineexplicit |
Creates the default client type given the credentials and policies.
credentials | a set of credentials to initialize the ClientOptions . |
policies | the client policies, these control the behavior of the client, for example, how to backoff when an operation needs to be retried, or what operations cannot be retried because they are not idempotent. |
google::cloud::Options
instead.
|
inlineexplicit |
Builds a client and maybe override the retry, idempotency, and/or backoff policies.
|
inlineexplicit |
Builds a client with a specific RawClient, without decorations.
|
inline |
Composes existing objects into a new object in the same bucket.
bucket_name | the name of the bucket used for source object and destination object. |
source_objects | objects used to compose destination_object_name . |
destination_object_name | the composed object name. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include DestinationPredefinedAcl , EncryptionKey , IfGenerationMatch , IfMetagenerationMatch , KmsKeyName , UserProject , and WithObjectMetadata . |
IfGenerationMatch
.
|
inline |
Copies an existing object.
Use CopyObject
to copy between objects in the same location and storage class. Copying objects across locations or storage classes can fail for large objects and retrying the operation will not succeed.
RewriteObject()
to copy objects, RewriteObject()
can copy objects to different locations, with different storage class, and/or with different encryption keys.source_bucket_name | the name of the bucket that contains the object to be copied. |
source_object_name | the name of the object to copy. |
destination_bucket_name | the name of the bucket that will contain the new object. |
destination_object_name | the name of the new object. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include DestinationKmsKeyName , DestinationPredefinedAcl ,EncryptionKey ,IfGenerationMatch , IfGenerationNotMatch , IfMetagenerationMatch , IfMetagenerationNotMatch , IfSourceGenerationMatch , IfSourceGenerationNotMatch , IfSourceMetagenerationMatch , IfSourceMetagenerationNotMatch , Projection , SourceGeneration , SourceEncryptionKey , UserProject , and WithObjectMetadata . |
IfGenerationMatch
.Objects: rewrite
over Objects: copy
.
|
inline |
Creates a new Google Cloud Storage bucket using the default project.
If the default project is not configured the server will reject the request, and this function returns the error status.
bucket_name | the name of the new bucket. |
metadata | the metadata for the new Bucket. The name field is ignored in favor of bucket_name . |
options | a list of optional query parameters and/or request headers. Valid types for this operation include PredefinedAcl , PredefinedDefaultObjectAcl , Projection , UserProject , and OverrideDefaultProject . |
|
inline |
Creates a new entry in a bucket ACL.
bucket_name | the name of the bucket. |
entity | the name of the entity added to the ACL. |
role | the role of the entity. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include UserProject . |
entity
parameter. role
parameter.
|
inline |
Creates a new Google Cloud Storage Bucket in a given project.
bucket_name | the name of the new bucket. |
project_id | the id of the project that will host the new bucket. |
metadata | the metadata for the new Bucket. The name field is ignored in favor of bucket_name . |
options | a list of optional query parameters and/or request headers. Valid types for this operation include PredefinedAcl , PredefinedDefaultObjectAcl , Projection , and UserProject . OverrideDefaultProject is accepted, but has no effect. |
Create a Client using ClientOptions::CreateDefaultClientOptions().
google::cloud::Options
instead.
|
inline |
Creates a new entry in the default object ACL for a bucket.
The default object ACL sets the ACL for any object created in the bucket, unless a different ACL is specified when the object is created.
bucket_name | the name of the bucket. |
entity | the name of the entity added to the ACL. |
role | the role of the entity. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include UserProject . |
entity
parameter. role
parameter.
|
inline |
Create a new HMAC key.
service_account | the service account email where you want to create the new HMAC key. |
options | a list of optional query parameters and/or request headers. In addition to the options common to all requests, this operation accepts OverrideDefaultProject . |
|
inline |
Creates a new notification config for a Bucket.
Cloud Pub/Sub Notifications send information about changes to objects in your buckets to Google Cloud Pub/Sub service. You can create multiple notifications per Bucket, with different topics and filtering options.
bucket_name | the name of the bucket. |
topic_name | the Google Cloud Pub/Sub topic that will receive the notifications. This requires the full name of the topic, i.e.: projects/<PROJECT_ID>/topics/<TOPIC_ID> . |
metadata | define any optional parameters for the notification, such as the list of event types, or any custom attributes. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include UserProject . |
|
inline |
Creates a new notification config for a Bucket.
Cloud Pub/Sub Notifications send information about changes to objects in your buckets to Google Cloud Pub/Sub service. You can create multiple notifications per Bucket, with different topics and filtering options.
bucket_name | the name of the bucket. |
topic_name | the Google Cloud Pub/Sub topic that will receive the notifications. This requires the full name of the topic, i.e.: projects/<PROJECT_ID>/topics/<TOPIC_ID> . |
payload_format | how will the data be formatted in the notifications, consider using the helpers in the payload_format namespace, or specify one of the valid formats defined in: https://cloud.google.com/storage/docs/json_api/v1/notifications |
metadata | define any optional parameters for the notification, such as the list of event types, or any custom attributes. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include UserProject . |
|
inline |
Creates a new entry in the object ACL.
bucket_name | the name of the bucket that contains the object. |
object_name | the name of the object. |
entity | the name of the entity added to the ACL. |
role | the role of the entity. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include Generation , and UserProject . |
entity
parameter. role
parameter.
|
inline |
Create a signed policy document.
ExactMatchObject()
condition contains two elements. Using the provided helper functions can prevent errors.document | the policy document. |
options | a list of optional parameters, this includes: SigningAccount , and SigningAccountDelegates . |
PolicyDocumentCondition
with less opportunities for typos: StartsWith()
, ExactMatchObject()
, ExactMatch()
, ContentLengthRange()
.
|
inline |
Create a V2 signed URL for the given parameters.
WithBilling()
) but not all sub-resources are valid for objects. Likewise, only a single sub-resource may be retrieved in each request.verb | the operation allowed through this signed URL, GET , POST , PUT , HEAD , etc. are valid values. |
bucket_name | the name of the bucket. |
object_name | the name of the object, note that the object may not exist for signed URLs that upload new objects. Use an empty string for requests that only affect a bucket. |
options | a list of optional parameters for the signed URL, this include: ExpirationTime , MD5HashValue , ContentType , SigningAccount , SigningAccountDelegates , AddExtensionHeaderOption , AddQueryParameterOption , and AddSubResourceOption . Note that only the last AddSubResourceOption option has any effect. |
The following functions create a AddSubResourceOption
with less opportunities for typos in the sub-resource name: WithAcl()
, WithBilling()
, WithCompose()
, WithCors()
, WithEncryption()
, WithEncryptionConfig()
, WithLifecycle()
, WithLocation()
, WithLogging()
, WithStorageClass()
, and WithTagging()
.
Likewise, the following helper functions can create properly formatted AddExtensionHeaderOption
objects: WithGeneration()
, WithGenerationMarker()
, WithMarker()
, WithResponseContentDisposition()
, WithResponseContentType()
, and WithUserProject()
.
|
inline |
Create a V4 signed URL for the given parameters.
WithBilling()
) but not all sub-resources are valid for objects. Likewise, only a single sub-resource may be retrieved in each request.verb | the operation allowed through this signed URL, GET , POST , PUT , HEAD , etc. are valid values. |
bucket_name | the name of the bucket. |
object_name | the name of the object, note that the object may not exist for signed URLs that upload new objects. Use an empty string for requests that only affect a bucket. |
options | a list of optional parameters for the signed URL, this include: SignedUrlTimestamp , SignedUrlDuration , MD5HashValue , ContentType , SigningAccount , SigningAccountDelegates , AddExtensionHeaderOption , AddQueryParameterOption , and AddSubResourceOption . Note that only the last AddSubResourceOption option has any effect. |
The following functions create a AddSubResourceOption
with less opportunities for typos in the sub-resource name: WithAcl()
, WithBilling()
, WithCompose()
, WithCors()
, WithEncryption()
, WithEncryptionConfig()
, WithLifecycle()
, WithLocation()
, WithLogging()
, WithStorageClass()
, and WithTagging()
.
Likewise, the following helper functions can create properly formatted AddExtensionHeaderOption
objects: WithGeneration()
, WithGenerationMarker()
, WithMarker()
, WithResponseContentDisposition()
, WithResponseContentType()
, and WithUserProject()
.
|
inline |
Deletes a Google Cloud Storage Bucket.
bucket_name | the bucket to be deleted. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include IfMetagenerationMatch , IfMetagenerationNotMatch , and UserProject . |
IfMetagenerationMatch
.
|
inline |
Deletes an entry from a bucket ACL.
bucket_name | the name of the bucket. |
entity | the name of the entity added to the ACL. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include UserProject . |
entity
parameter.
|
inline |
Deletes an entry from the default object ACL in a bucket.
The default object ACL sets the ACL for any object created in the bucket, unless a different ACL is specified when the object is created.
bucket_name | the name of the bucket. |
entity | the name of the entity added to the ACL. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include UserProject . |
entity
parameter.
|
inline |
Delete a HMAC key in a given project.
access_id | the HMAC key access_id() that you want to delete. Each HMAC key is assigned an access_id() attribute at creation time. |
options | a list of optional query parameters and/or request headers. In addition to the options common to all requests, this operation accepts OverrideDefaultProject . |
|
inline |
Delete an existing notification config in a given Bucket.
Cloud Pub/Sub Notifications sends information about changes to objects in your buckets to Google Cloud Pub/Sub service. You can create multiple notifications per Bucket, with different topics and filtering options. This function deletes one of the notification configs.
bucket_name | the name of the bucket. |
notification_id | the id of the notification config. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include UserProject . |
notification_id
, the state after calling this function multiple times is to delete that notification. New notifications get different ids.
|
inline |
Deletes an object.
bucket_name | the name of the bucket that contains the object. |
object_name | the name of the object to be deleted. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include Generation , IfGenerationMatch , IfGenerationNotMatch , IfMetagenerationMatch , IfMetagenerationNotMatch , and UserProject . |
IfGenerationMatch
Generation
.
|
inline |
Deletes one access control entry in one object.
bucket_name | the name of the bucket that contains the object. |
object_name | the name of the object to be deleted. |
entity | the name of the entity (user, team, group) to be removed from the Object's ACL. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include Generation , and UserProject . |
entity
parameters.
|
inline |
Cancel a resumable upload.
upload_session_url | the url of the upload session. Returned by ObjectWriteStream::resumable_session_id . |
options | a list of optional query parameters and/or request headers. Valid types for this operation include UserProject . |
upload_session_url
.
|
inline |
Downloads a Cloud Storage object to a file.
bucket_name | the name of the bucket that contains the object. |
object_name | the name of the object to be downloaded. |
file_name | the name of the destination file that will have the object media. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include IfGenerationMatch , IfGenerationNotMatch , IfMetagenerationMatch , IfMetagenerationNotMatch , Generation , ReadFromOffset , ReadRange , and UserProject . |
|
inline |
Create a signed V4 policy document.
ExactMatchObject()
condition contains two elements. Using the provided helper functions can prevent errors.document | the policy document. |
options | a list of optional parameters, this includes: AddExtensionFieldOption , BucketBoundHostname , PredefinedAcl , Scheme , SigningAccountDelegates , SigningAccount , VirtualHostname |
PolicyDocumentCondition
with less opportunities for typos: StartsWith()
, ExactMatchObject()
, ExactMatch()
, ContentLengthRange()
.
|
inline |
Gets the value of an existing bucket ACL.
bucket_name | the name of the bucket to query. |
entity | the name of the entity to query. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include UserProject . |
entity
parameter.
|
inline |
Fetches the bucket metadata.
bucket_name | query metadata information about this bucket. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include IfMetagenerationMatch , IfMetagenerationNotMatch , UserProject , and Projection . |
|
inline |
Gets the value of a default object ACL in a bucket.
The default object ACL sets the ACL for any object created in the bucket, unless a different ACL is specified when the object is created.
bucket_name | the name of the bucket. |
entity | the name of the entity. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include UserProject . |
entity
parameter.
|
inline |
Get an existing HMAC key in a given project.
access_id | the HMAC key access_id() that you want to delete. Each HMAC key is assigned an access_id() attribute at creation time. |
options | a list of optional query parameters and/or request headers. In addition to the options common to all requests, this operation accepts OverrideDefaultProject . |
|
inline |
Fetches the native IAM policy for a Bucket.
Google Cloud Identity & Access Management (IAM) lets administrators authorize who can take action on specific resources, including Google Cloud Storage Buckets. This operation allows you to query the IAM policies for a Bucket. IAM policies are a superset of the Bucket ACL, changes to the Bucket ACL are reflected in the IAM policy, and vice-versa. The documentation describes the mapping between legacy Bucket ACLs and IAM policies.
Consult the documentation for a more detailed description of IAM policies and their use in Google Cloud Storage.
bucket_name | query metadata information about this bucket. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include UserProject . |
NativeIamPolicy
class.
|
inline |
Gets the details about a notification config in a given Bucket.
Cloud Pub/Sub Notifications sends information about changes to objects in your buckets to Google Cloud Pub/Sub service. You can create multiple notifications per Bucket, with different topics and filtering options. This function fetches the detailed information for a given notification config.
bucket_name | the name of the bucket. |
notification_id | the id of the notification config. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include UserProject . |
|
inline |
Gets the value of an existing object ACL.
bucket_name | the name of the bucket that contains the object. |
object_name | the name of the object. |
entity | the name of the entity added to the ACL. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include Generation , and UserProject . |
entity
parameters.
|
inline |
Fetches the object metadata.
bucket_name | the bucket containing the object. |
object_name | the object name. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include Generation , IfGenerationMatch , IfGenerationNotMatch , IfMetagenerationMatch , IfMetagenerationNotMatch , Projection , and UserProject . |
|
inline |
Gets the GCS service account for the default project.
A service account is a special Google account that belongs to your application, virtual machine, or to a Google service when acting on your behalf. This API allows you to discover the GCS service account for the default project associated with this object.
The default project is required to be configured in the ClientOptions
used to construct this object. If the application does not set the project id in the ClientOptions
, the value of the GOOGLE_CLOUD_PROJECT
is used. If neither the environment variable is set, nor a value is set explicitly by the application, the server will reject the request and this function will return the error status.
options | a list of optional query parameters and/or request headers. Valid types for this operation include UserProject , and OverrideDefaultProject . |
|
inline |
Gets the GCS service account for a given project.
A service account is a special Google account that belongs to your application, virtual machine, or to a Google service when acting on your behalf. This API allows you to discover the GCS service account for the project_id
project.
project_id | the project to query. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include UserProject . OverrideDefaultProject is accepted, but has no effect. |
|
inline |
Creates an object given its name and contents.
bucket_name | the name of the bucket that will contain the object. |
object_name | the name of the object to be created. |
contents | the contents (media) for the new object. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include ContentEncoding , ContentType , Crc32cChecksumValue , DisableCrc32cChecksum , DisableMD5Hash , EncryptionKey , IfGenerationMatch , IfGenerationNotMatch , IfMetagenerationMatch , IfMetagenerationNotMatch , KmsKeyName , MD5HashValue , PredefinedAcl , Projection , UserProject , and WithObjectMetadata . |
IfGenerationMatch
.This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
Creates an object given its name and contents.
bucket_name | the name of the bucket that will contain the object. |
object_name | the name of the object to be created. |
contents | the contents (media) for the new object. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include ContentEncoding , ContentType , Crc32cChecksumValue , DisableCrc32cChecksum , DisableMD5Hash , EncryptionKey , IfGenerationMatch , IfGenerationNotMatch , IfMetagenerationMatch , IfMetagenerationNotMatch , KmsKeyName , MD5HashValue , PredefinedAcl , Projection , UserProject , and WithObjectMetadata . |
IfGenerationMatch
.This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
Creates an object given its name and contents.
bucket_name | the name of the bucket that will contain the object. |
object_name | the name of the object to be created. |
contents | the contents (media) for the new object. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include ContentEncoding , ContentType , Crc32cChecksumValue , DisableCrc32cChecksum , DisableMD5Hash , EncryptionKey , IfGenerationMatch , IfGenerationNotMatch , IfMetagenerationMatch , IfMetagenerationNotMatch , KmsKeyName , MD5HashValue , PredefinedAcl , Projection , UserProject , and WithObjectMetadata . |
IfGenerationMatch
.This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
Retrieves the list of BucketAccessControl
items for a bucket.
bucket_name | the name of the bucket. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include UserProject . |
|
inline |
Fetches the list of buckets for the default project.
The default project is required to be configured in the ClientOptions
used to construct this object. If the application does not set the project id in the ClientOptions
, the value of the GOOGLE_CLOUD_PROJECT
is used. If neither the environment variable is set, nor a value is set explicitly by the application, the returned ListBucketsReader
will return an error status when used.
options | a list of optional query parameters and/or request headers. Valid types for this operation include MaxResults , Prefix , Projection , UserProject , and OverrideDefaultProject . |
|
inline |
Fetches the list of buckets for a given project.
project_id | the project to query. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include MaxResults , Prefix , Projection , and UserProject . OverrideDefaultProject is accepted, but has no effect. |
|
inline |
Retrieves the default object ACL for a bucket as a vector of ObjectAccessControl
items.
The default object ACL sets the ACL for any object created in the bucket, unless a different ACL is specified when the object is created.
bucket_name | the name of the bucket. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include IfMetagenerationMatch , IfMetagenerationNotMatch and UserProject . |
|
inline |
List the available HMAC keys.
options | a list of optional query parameters and/or request headers. In addition to the options common to all requests, this operation accepts Deleted MaxResults , OverrideDefaultProject , and ServiceAccountFilter . |
|
inline |
Retrieves the list of Notifications for a Bucket.
Cloud Pub/Sub Notifications sends information about changes to objects in your buckets to Google Cloud Pub/Sub service.
bucket_name | the name of the bucket. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include UserProject . |
|
inline |
Retrieves the list of ObjectAccessControl items for an object.
bucket_name | the name of the bucket that contains the object. |
object_name | the name of the object to be deleted. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include Generation , and UserProject . |
|
inline |
Lists the objects in a bucket.
bucket_name | the name of the bucket to list. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include MaxResults , Prefix , Delimiter , IncludeTrailingDelimiter , StartOffset , EndOffset , Projection , UserProject , and Versions . |
|
inline |
Lists the objects and prefixes in a bucket.
bucket_name | the name of the bucket to list. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include IfMetagenerationMatch , IfMetagenerationNotMatch , UserProject , Projection , Prefix , Delimiter , IncludeTrailingDelimiter , StartOffset , EndOffset , and Versions . |
|
inline |
Locks the retention policy for a bucket.
The Bucket Lock feature allows you to configure a data retention policy for a Cloud Storage bucket that governs how long objects in the bucket must be retained. The feature also allows you to lock the data retention policy, permanently preventing the policy from being reduced or removed.
bucket_name | the name of the bucket. |
metageneration | the expected value of the metageneration on the bucket. The request will fail if the metageneration does not match the current value. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include UserProject . |
metageneration
parameter is always required, and it acts as a pre-condition on the operation.
|
inline |
Computes the difference between two BucketMetadata objects and patches a bucket based on that difference.
A Buckets: update
request changes all the writeable attributes of a bucket, in contrast, a Buckets: patch
request only changes the subset of the attributes included in the request.
This function creates a patch request to change the writeable attributes in original
to the values in updated
. Non-writeable attributes are ignored, and attributes not present in updated
are removed. Typically this function is used after the application obtained a value with GetBucketMetadata
and has modified these parameters.
bucket_name | the bucket to be updated. |
original | the initial value of the bucket metadata. |
updated | the updated value for the bucket metadata. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include IfMetagenerationMatch , IfMetagenerationNotMatch , PredefinedAcl , PredefinedDefaultObjectAcl , Projection , and UserProject . |
IfMetagenerationMatch
.
|
inline |
Patches the metadata in a Google Cloud Storage Bucket given a desired set changes.
A Buckets: update
request changes all the writeable attributes of a bucket, in contrast, a Buckets: patch
request only changes the subset of the attributes included in the request. This function creates a patch request based on the given BucketMetadataPatchBuilder
which represents the desired set of changes.
bucket_name | the bucket to be updated. |
builder | the set of updates to perform in the Bucket. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include IfMetagenerationMatch , IfMetagenerationNotMatch , PredefinedAcl , PredefinedDefaultObjectAcl , Projection , and UserProject . |
IfMetagenerationMatch
.
|
inline |
Patches the value of an existing bucket ACL.
Computes the delta between a previous value for an BucketAccessControl and the new value for an BucketAccessControl and apply that delta.
role
, and it may only be set to a new value (it cannot be removed). The API is offered for consistency with the other resource types where Patch and Update APIs have different semantics.bucket_name | the name of the bucket. |
entity | the identifier for the user, group, service account, or predefined set of actors holding the permission. |
original_acl | the original ACL value. |
new_acl | the new ACL value. Note that only changes on writeable fields will be accepted by the server. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include UserProject , and the standard options available to all operations. |
entity
parameters.
|
inline |
Patches the value of an existing bucket ACL.
This API allows the application to patch an BucketAccessControl without having to read the current value.
role
, and it may only be set to a new value (it cannot be removed). The API is offered for consistency with the other resource types where Patch and Update APIs have different semantics.bucket_name | the name of the bucket. |
entity | the identifier for the user, group, service account, or predefined set of actors holding the permission. |
builder | a builder ready to create the patch. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include Generation , UserProject , IfMatchEtag , and IfNoneMatchEtag . |
entity
parameters.
|
inline |
Patches the value of an existing default object ACL.
Compute the delta between a previous and new values for a default object access control, and apply that delta.
role
, and it may only be set to a new value (it cannot be removed). The API is offered for consistency with the other resource types where Patch and Update APIs have different semantics.bucket_name | the name of the bucket. |
entity | the identifier for the user, group, service account, or predefined set of actors holding the permission. |
original_acl | the original ACL value. |
new_acl | the new ACL value. Note that only changes on writeable fields will be accepted by the server. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include UserProject , as well as the standard parameters, such as IfMatchEtag , and IfNoneMatchEtag . |
entity
parameter. role
parameter.
|
inline |
Patches the value of an existing default object ACL.
This API allows the application to patch an ObjectAccessControl without having to read the current value.
role
, and it may only be set to a new value (it cannot be removed). The API is offered for consistency with the other resource types where Patch and Update APIs have different semantics.bucket_name | the name of the bucket. |
entity | the identifier for the user, group, service account, or predefined set of actors holding the permission. |
builder | a builder ready to create the patch. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include UserProject , as well as the standard parameters, such as IfMatchEtag , and IfNoneMatchEtag . |
entity
parameter. role
parameter.
|
inline |
Patches the metadata in a Google Cloud Storage Object.
This function creates a patch request to change the writeable attributes in original
to the values in updated
. Non-writeable attributes are ignored, and attributes not present in updated
are removed. Typically this function is used after the application obtained a value with GetObjectMetadata
and has modified these parameters.
bucket_name | the bucket that contains the object to be updated. |
object_name | the object to be updated. |
original | the initial value of the object metadata. |
updated | the updated value for the object metadata. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include Generation , EncryptionKey , IfGenerationMatch , IfGenerationNotMatch , IfMetagenerationMatch , IfMetagenerationNotMatch , PredefinedAcl , Projection , and UserProject . |
IfMetagenerationMatch
.
|
inline |
Patches the metadata in a Google Cloud Storage Object.
This function creates a patch request based on the given builder
. Typically this function is used when the application needs to set an object's metadata fields regardless of their previous value (i.e. when calling GetObjectMetadata first is not necessary).
bucket_name | the bucket that contains the object to be updated. |
object_name | the object to be updated. |
builder | the set of updates to perform in the Object metadata. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include Generation , EncryptionKey , IfGenerationMatch , IfGenerationNotMatch , IfMetagenerationMatch , IfMetagenerationNotMatch , PredefinedAcl , EncryptionKey , Projection , and UserProject . |
IfMetagenerationMatch
.
|
inline |
Patches the value of an existing object ACL.
Compute the delta between a previous value for an ObjectAccessControl and the new value for an ObjectAccessControl and apply that delta.
role
, and it may only be set to a new value (it cannot be removed). The API is offered for consistency with the other resource types where Patch and Update APIs have different semantics.bucket_name | the name of the bucket that contains the object. |
object_name | the name of the object. |
entity | the identifier for the user, group, service account, or predefined set of actors holding the permission. |
original_acl | the original ACL value. |
new_acl | the new ACL value. Note that only changes on writeable fields will be accepted by the server. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include Generation , UserProject , IfMatchEtag , and IfNoneMatchEtag . |
entity
parameters.
|
inline |
Patches the value of an existing object ACL.
This API allows the application to patch an ObjectAccessControl without having to read the current value.
role
, and it may only be set to a new value (it cannot be removed). The API is offered for consistency with the other resource types where Patch and Update APIs have different semantics.bucket_name | the name of the bucket that contains the object. |
object_name | the name of the object. |
entity | the identifier for the user, group, service account, or predefined set of actors holding the permission. |
builder | a builder ready to create the patch. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include Generation , UserProject , IfMatchEtag , and IfNoneMatchEtag . |
entity
parameters.
|
inline |
Access the underlying RawClient
.
|
inline |
Reads the contents of an object.
Returns an object derived from std::istream
which can be used to read the contents of the GCS blob. The application should check the badbit
(e.g. by calling stream.bad()
) on the returned object to detect if there was an error reading from the blob. If badbit
is set, the application can check the status()
variable to get details about the failure. Applications can also set the exception mask on the returned stream, in which case an exception is thrown if an error is detected.
bucket_name | the name of the bucket that contains the object. |
object_name | the name of the object to be read. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include DisableCrc32cChecksum , DisableMD5Hash , EncryptionKey , Generation , IfGenerationMatch , IfGenerationNotMatch , IfMetagenerationMatch , IfMetagenerationNotMatch , ReadFromOffset , ReadRange , ReadLast , UserProject , and AcceptEncoding . |
|
inline |
Creates an ObjectRewriter
to resume a previously created rewrite.
Applications use this function to resume a rewrite operation, possibly created with RewriteObject()
. Rewrite can reliably copy objects across location boundaries, and can rewrite objects with different encryption keys. For large objects this operation can take a long time, thus applications should consider checkpointing the rewrite token (accessible in the ObjectRewriter
) and restarting the operation in the event the program is terminated.
ObjectRewriter::Iterate()
may be required to completely rewrite an object.source_bucket_name | the name of the bucket containing the source object. |
source_object_name | the name of the source object. |
destination_bucket_name | where the destination object will be located. |
destination_object_name | what to name the destination object. |
rewrite_token | the token from a previous successful rewrite iteration. Can be the empty string, in which case this starts a new rewrite operation. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include DestinationKmsKeyName , DestinationPredefinedAcl , EncryptionKey , IfGenerationMatch , IfGenerationNotMatch , IfMetagenerationMatch , IfSourceGenerationMatch , IfSourceGenerationNotMatch , IfSourceMetagenerationMatch , IfSourceMetagenerationNotMatch , MaxBytesRewrittenPerCall , Projection , SourceEncryptionKey , SourceGeneration , UserProject , and WithObjectMetadata . |
IfGenerationMatch
.
|
inline |
Creates an ObjectRewriter
to copy the source object.
Applications use this function to reliably copy objects across location boundaries, and to rewrite objects with different encryption keys. The operation returns a ObjectRewriter
, which the application can use to initiate the copy and to iterate if the copy requires more than one call to complete.
ObjectRewriter::Iterate()
may be required to completely rewrite an object.source_bucket_name | the name of the bucket containing the source object. |
source_object_name | the name of the source object. |
destination_bucket_name | where the destination object will be located. |
destination_object_name | what to name the destination object. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include DestinationKmsKeyName , DestinationPredefinedAcl , EncryptionKey , IfGenerationMatch , IfGenerationNotMatch , IfMetagenerationMatch , IfSourceGenerationMatch , IfSourceGenerationNotMatch , IfSourceMetagenerationMatch , IfSourceMetagenerationNotMatch , MaxBytesRewrittenPerCall , Projection , SourceEncryptionKey , SourceGeneration , UserProject , and WithObjectMetadata . |
IfGenerationMatch
.
|
inline |
Rewrites the object, blocking until the rewrite completes, and returns the resulting ObjectMetadata
.
Applications use this function to reliably copy objects across location boundaries, and to rewrite objects with different encryption keys. The operation blocks until the rewrite completes, and returns the resulting ObjectMetadata
.
RewriteObject()
or ResumeRewriteObject()
.source_bucket_name | the name of the bucket containing the source object. |
source_object_name | the name of the source object. |
destination_bucket_name | where the destination object will be located. |
destination_object_name | what to name the destination object. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include DestinationKmsKeyName , DestinationPredefinedAcl , EncryptionKey , IfGenerationMatch , IfGenerationNotMatch , IfMetagenerationMatch , IfSourceGenerationMatch , IfSourceGenerationNotMatch , IfSourceMetagenerationMatch , IfSourceMetagenerationNotMatch , MaxBytesRewrittenPerCall , Projection , SourceEncryptionKey , SourceGeneration , UserProject , and WithObjectMetadata . |
IfGenerationMatch
.
|
inline |
Sets the native IAM Policy for a Bucket.
Google Cloud Identity & Access Management (IAM) lets administrators authorize who can take action on specific resources, including Google Cloud Storage Buckets. This operation allows you to set the IAM policies for a Bucket. IAM policies are a superset of the Bucket ACL, changes to the Bucket ACL are reflected in the IAM policy, and vice-versa. The documentation describes the mapping between legacy Bucket ACLs and IAM policies.
Consult the documentation for a more detailed description of IAM policies their use in Google Cloud Storage.
GetNativeBucketIamPolicy()
to fetch the current value and ETag before calling SetNativeBucketIamPolicy()
. Applications should use optimistic concurrency control techniques to retry changes in case some other application modified the IAM policy between the GetNativeBucketIamPolicy
and SetNativeBucketIamPolicy
calls.bucket_name | query metadata information about this bucket. |
iam_policy | the new IAM policy. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include UserProject . |
IfMetagenerationMatch
.NativeIamPolicy
class.
|
inline |
Tests the IAM permissions of the caller against a Bucket.
Google Cloud Identity & Access Management (IAM) lets administrators authorize who can take action on specific resources, including Google Cloud Storage Buckets. This operation tests the permissions of the caller for a Bucket. You must provide a list of permissions, this API will return the subset of those permissions that the current caller has in the given Bucket.
Consult the documentation for a more detailed description of IAM policies their use in Google Cloud Storage.
bucket_name | query metadata information about this bucket. |
permissions | the list of permissions to check. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include UserProject . |
|
inline |
Updates the metadata in a Google Cloud Storage Bucket.
A Buckets: update
request changes all the writeable attributes of a bucket, in contrast, a Buckets: patch
request only changes the subset of the attributes included in the request. This function creates a Buckets: update
request to change the writable attributes in BucketMetadata
.
bucket_name | the name of the new bucket. |
metadata | the new metadata for the Bucket. The name field is ignored in favor of bucket_name . |
options | a list of optional query parameters and/or request headers. Valid types for this operation include IfMetagenerationMatch , IfMetagenerationNotMatch , PredefinedAcl , PredefinedDefaultObjectAcl , Projection , and UserProject . |
IfMetagenerationMatch
.
|
inline |
Updates the value of an existing bucket ACL.
role
, and it may only be set to a new value (it cannot be removed). The API is offered for consistency with the other resource types where Patch and Update APIs have different semantics.bucket_name | the name of the bucket. |
acl | the new ACL value. Note that only the writable values of the ACL will be modified by the server. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include UserProject . |
entity
parameter. role
parameter.
|
inline |
Updates the value of an existing default object ACL.
The default object ACL sets the ACL for any object created in the bucket, unless a different ACL is specified when the object is created.
role
, and it may only be set to a new value (it cannot be removed). The API is offered for consistency with the other resource types where Patch and Update APIs have different semantics.bucket_name | the name of the bucket. |
acl | the new ACL value. Note that only the writable values of the ACL will be modified by the server. |
options | a list of optional query parameters and/or request Valid types for this operation include UserProject . |
entity
parameter. role
parameter.
|
inline |
Update an existing HMAC key in a given project.
access_id | the HMAC key access_id() that you want to delete. Each HMAC key is assigned an access_id() attribute at creation time. |
resource | the desired changes to the HMAC key resource. Only the state field may be changed. The etag field may be set but it is only used as a pre-condition, the application cannot set the etag . |
options | a list of optional query parameters and/or request headers. In addition to the options common to all requests, this operation accepts OverrideDefaultProject . |
etag
attribute in resource
is set, or if the IfMatchEtag
option is set.
|
inline |
Updates the metadata in a Google Cloud Storage Object.
bucket_name | the name of the bucket that contains the object. |
object_name | the name of the object. |
metadata | the new metadata for the Object. Only the writeable fields accepted by the Objects: update API are used, all other fields are ignored. In particular, note that bucket and name are ignored in favor of bucket_name and object_name . |
options | a list of optional query parameters and/or request headers. Valid types for this operation include Generation , EncryptionKey , IfGenerationMatch , IfGenerationNotMatch , IfMetagenerationMatch , IfMetagenerationNotMatch , PredefinedAcl , Projection , and UserProject . |
IfMetagenerationMatch
.
|
inline |
Updates the value of an existing object ACL.
role
, and it may only be set to a new value (it cannot be removed). The API is offered for consistency with the other resource types where Patch and Update APIs have different semantics.bucket_name | the name of the bucket that contains the object. |
object_name | the name of the object. |
acl | the new ACL value. Note that only the writable values of the ACL will be modified by the server. |
options | a list of optional query parameters and/or request Valid types for this operation include Generation , and UserProject . |
entity
parameters.
|
inline |
Uploads a file to an object.
WriteObject()
is probably a better alternative.file_name | the name of the file to be uploaded. |
bucket_name | the name of the bucket that contains the object. |
object_name | the name of the object to be read. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include ContentEncoding , ContentType , Crc32cChecksumValue , DisableCrc32cChecksum , DisableMD5Hash , EncryptionKey , IfGenerationMatch , IfGenerationNotMatch , IfMetagenerationMatch , IfMetagenerationNotMatch , KmsKeyName , MD5HashValue , PredefinedAcl , Projection , UserProject , UploadFromOffset , UploadLimit and WithObjectMetadata . |
IfGenerationMatch
.
|
inline |
Writes contents into an object.
This creates a std::ostream
object to upload contents. The application can use either the regular operator<<()
, or std::ostream::write()
to upload data.
This function always uses resumable uploads. The application can provide a #RestoreResumableUploadSession()
option to resume a previously created upload. The returned object has accessors to query the session id and the next byte expected by GCS.
For small uploads we recommend using InsertObject
, consult the documentation for details.
If the application does not provide a #RestoreResumableUploadSession()
option, or it provides the #NewResumableUploadSession()
option then a new resumable upload session is created.
More information about buffering and recommendations around performance in the ObjectWriteStream
class documentation.
bucket_name | the name of the bucket that contains the object. |
object_name | the name of the object to be read. |
options | a list of optional query parameters and/or request headers. Valid types for this operation include ContentEncoding , ContentType , Crc32cChecksumValue , DisableCrc32cChecksum , DisableMD5Hash , EncryptionKey , IfGenerationMatch , IfGenerationNotMatch , IfMetagenerationMatch , IfMetagenerationNotMatch , KmsKeyName , MD5HashValue , PredefinedAcl , Projection , UseResumableUploadSession , UserProject , WithObjectMetadata , UploadContentLength , AutoFinalize , and UploadBufferSize . |
IfGenerationMatch
.