Class StorageClientImpl
Wrapper around StorageService to provide simpler operations.
Implements
Inherited Members
Namespace: Google.Cloud.Storage.V1
Assembly: Google.Cloud.Storage.V1.dll
Syntax
public sealed class StorageClientImpl : StorageClient, IDisposable
Remarks
This is the "default" implementation of StorageClient. Most client code should refer to StorageClient, creating instances with Create(GoogleCredential, EncryptionKey) and CreateAsync(GoogleCredential, EncryptionKey). The constructor of this class is public for the sake of constructor-based dependency injection.
Constructors
StorageClientImpl(StorageService, EncryptionKey)
Constructs a new client wrapping the given StorageService.
Declaration
public StorageClientImpl(StorageService service, EncryptionKey encryptionKey = null)
Parameters
Type | Name | Description |
---|---|---|
StorageService | service | The service to wrap. Must not be null. |
EncryptionKey | encryptionKey | Optional EncryptionKey to use for object-based operations by default. May be null, in which case None will be used. |
Properties
ApplicationName
The default application name used when creating a StorageService. Defaults to "google-cloud-dotnet"; must not be null.
Declaration
public static string ApplicationName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Most applications will never want to set this, which is why it's in this class rather than StorageClient.
EncryptionKey
The customer-supplied encryption key used by default for all relevant object-based operations. This can be overridden in call-specific options. This will never return null in the built-in implementation; if no encryption key is specified, None is returned.
Declaration
public override EncryptionKey EncryptionKey { get; }
Property Value
Type | Description |
---|---|
EncryptionKey |
Overrides
Service
The underlying storage service object used by this client.
Declaration
public override StorageService Service { get; }
Property Value
Type | Description |
---|---|
StorageService |
Overrides
Remarks
The StorageClient class only provides convenience operations built on top of an existing service object. Any more complex operations which are not supported by this wrapper may wish to use the same service object as the wrapper, in order to take advantage of its configuration (for authentication, application naming etc).
Methods
ClearBucketLabels(String, ModifyBucketLabelsOptions)
Clears all labels on a bucket.
Declaration
public override IDictionary<string, string> ClearBucketLabels(string bucket, ModifyBucketLabelsOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket. Must not be null. |
ModifyBucketLabelsOptions | options | The options for the operation. May be null, in which case defaults will be supplied. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.String> | A dictionary with the labels on the bucket before they were cleared. |
Overrides
ClearBucketLabelsAsync(String, ModifyBucketLabelsOptions, CancellationToken)
Clears all labels on a bucket asynchronously.
Declaration
public override Task<IDictionary<string, string>> ClearBucketLabelsAsync(string bucket, ModifyBucketLabelsOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket. Must not be null. |
ModifyBucketLabelsOptions | options | The options for the operation. May be null, in which case defaults will be supplied. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IDictionary<System.String, System.String>> | A dictionary with the labels on the bucket before they were cleared. |
Overrides
CopyObject(String, String, String, String, CopyObjectOptions)
Creates a copy of an object synchronously, potentially to a different bucket. This method uses the
rewriteObject
underlying API operation for more flexibility and reliability.
Declaration
public override Object CopyObject(string sourceBucket, string sourceObjectName, string destinationBucket, string destinationObjectName, CopyObjectOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | sourceBucket | The name of the bucket containing the object to copy. Must not be null. |
System.String | sourceObjectName | The name of the object to copy within the bucket. Must not be null. |
System.String | destinationBucket | The name of the bucket to copy the object to. Must not be null. |
System.String | destinationObjectName | The name of the object within the destination bucket. Must not be null. |
CopyObjectOptions | options | Additional options for the copy operation. May be null, in which case appropriate defaults will be used. |
Returns
Type | Description |
---|---|
Object | The Object representation of the new storage object resulting from the copy. |
Overrides
CopyObjectAsync(String, String, String, String, CopyObjectOptions, CancellationToken)
Creates a copy of an object synchronously, potentially to a different bucket. This method uses the
rewriteObject
underlying API operation for more flexibility and reliability.
Declaration
public override Task<Object> CopyObjectAsync(string sourceBucket, string sourceObjectName, string destinationBucket, string destinationObjectName, CopyObjectOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | sourceBucket | The name of the bucket containing the object to copy. Must not be null. |
System.String | sourceObjectName | The name of the object to copy within the bucket. Must not be null. |
System.String | destinationBucket | The name of the bucket to copy the object to. Must not be null. |
System.String | destinationObjectName | The name of the object within the destination bucket. Must not be null. |
CopyObjectOptions | options | Additional options for the copy operation. May be null, in which case appropriate defaults will be used. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Object> | A task representing the asynchronous operation, with a result returning the Object representation of the new storage object resulting from the copy. |
Overrides
CreateBucket(String, Bucket, CreateBucketOptions)
Creates a storage bucket synchronously.
Declaration
public override Bucket CreateBucket(string projectId, Bucket bucket, CreateBucketOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | projectId | The ID of the project to create the buckets in. Must not be null. |
Bucket | bucket | The resource representation of the bucket to create. Must not be null, and must have a name. |
CreateBucketOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
Returns
Type | Description |
---|---|
Bucket | The resource representation of the newly-created bucket. |
Overrides
CreateBucket(String, String, CreateBucketOptions)
Creates a storage bucket synchronously.
Declaration
public override Bucket CreateBucket(string projectId, string bucket, CreateBucketOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | projectId | The ID of the project to create the buckets in. Must not be null. |
System.String | bucket | The name of the bucket to create. Must not be null. |
CreateBucketOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
Returns
Type | Description |
---|---|
Bucket | The resource representation of the newly-created bucket. |
Overrides
CreateBucketAsync(String, Bucket, CreateBucketOptions, CancellationToken)
Creates a storage bucket asynchronously.
Declaration
public override Task<Bucket> CreateBucketAsync(string projectId, Bucket bucket, CreateBucketOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | projectId | The ID of the project to create the buckets in. Must not be null. |
Bucket | bucket | The resource representation of the bucket to create. Must not be null, and must have a name. |
CreateBucketOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Bucket> | A task representing the asynchronous operation, with a result returning the resource representation of the newly-created bucket. |
Overrides
CreateBucketAsync(String, String, CreateBucketOptions, CancellationToken)
Creates a storage bucket asynchronously.
Declaration
public override Task<Bucket> CreateBucketAsync(string projectId, string bucket, CreateBucketOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | projectId | The ID of the project to create the buckets in. Must not be null. |
System.String | bucket | The name of the bucket to create. Must not be null. |
CreateBucketOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Bucket> | A task representing the asynchronous operation, with a result returning the resource representation of the newly-created bucket. |
Overrides
CreateHmacKey(String, String, CreateHmacKeyOptions)
Synchronously creates a new HMAC key associated with a service account.
Declaration
public override HmacKey CreateHmacKey(string projectId, string serviceAccountEmail, CreateHmacKeyOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | projectId | The project ID in which to create the HMAC key. Must not be null. |
System.String | serviceAccountEmail | The service account to associate with the HMAC key. Must not be null. |
CreateHmacKeyOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
Returns
Type | Description |
---|---|
HmacKey | The new HMAC key, including the secret information in Secret. This secret is only ever returned when creating a key. |
Overrides
CreateHmacKeyAsync(String, String, CreateHmacKeyOptions, CancellationToken)
Asynchronously creates a new HMAC key associated with a service account.
Declaration
public override Task<HmacKey> CreateHmacKeyAsync(string projectId, string serviceAccountEmail, CreateHmacKeyOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | projectId | The project ID in which to create the HMAC key. Must not be null. |
System.String | serviceAccountEmail | The service account to associate with the HMAC key. Must not be null. |
CreateHmacKeyOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<HmacKey> | A task representing the asynchronous operation, with a result returning the the new HMAC key, including the secret information in Secret. This secret is only ever returned when creating a key. |
Overrides
CreateNotification(String, Notification, CreateNotificationOptions)
Creates a notification configuration.
Declaration
public override Notification CreateNotification(string bucket, Notification notification, CreateNotificationOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The bucket for which to create the notification configuration. Must not be null. |
Notification | notification | The notification configuration to create. Must not be null. |
CreateNotificationOptions | options | The options for the operation. May be null, in which case defaults will be supplied. |
Returns
Type | Description |
---|---|
Notification | The Notification representation of the newly-created notification configuration. |
Overrides
CreateNotificationAsync(String, Notification, CreateNotificationOptions, CancellationToken)
Asynchronously creates a notification configuration.
Declaration
public override Task<Notification> CreateNotificationAsync(string bucket, Notification notification, CreateNotificationOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The bucket for which to create the notification configuration. Must not be null. |
Notification | notification | The notification configuration to create. Must not be null. |
CreateNotificationOptions | options | The options for the operation. May be null, in which case defaults will be supplied. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Notification> | A task representing the asynchronous operation, with a result returning the Notification representation of the newly-created notification configuration. |
Overrides
CreateObjectUploader(Object, Stream, UploadObjectOptions)
Creates an instance which is capable of starting a resumable upload for an object.
Declaration
public override ObjectsResource.InsertMediaUpload CreateObjectUploader(Object destination, Stream source, UploadObjectOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Object | destination | Object to create or update. Must not be null, and must have the name, bucket and content type populated. |
System.IO.Stream | source | The stream to read the data from. Must not be null. |
UploadObjectOptions | options | Additional options for the upload. May be null, in which case appropriate defaults will be used. |
Returns
Type | Description |
---|---|
ObjectsResource.InsertMediaUpload | The ObjectsResource.InsertMediaUpload which can be used to upload the object. |
Overrides
See Also
CreateObjectUploader(String, String, String, Stream, UploadObjectOptions)
Creates an instance which is capable of starting a resumable upload for an object.
Declaration
public override ObjectsResource.InsertMediaUpload CreateObjectUploader(string bucket, string objectName, string contentType, Stream source, UploadObjectOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket containing the object. Must not be null. |
System.String | objectName | The name of the object within the bucket. Must not be null. |
System.String | contentType | The content type of the object. This should be a MIME type such as "text/html" or "application/octet-stream". May be null. |
System.IO.Stream | source | The stream to read the data from. Must not be null. |
UploadObjectOptions | options | Additional options for the upload. May be null, in which case appropriate defaults will be used. |
Returns
Type | Description |
---|---|
ObjectsResource.InsertMediaUpload | The ObjectsResource.InsertMediaUpload which can be used to upload the object. |
Overrides
See Also
DeleteBucket(Bucket, DeleteBucketOptions)
Deletes a bucket synchronously.
Declaration
public override void DeleteBucket(Bucket bucket, DeleteBucketOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Bucket | bucket | Bucket to delete. Must not be null, and must have the name populated. |
DeleteBucketOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
Overrides
DeleteBucket(String, DeleteBucketOptions)
Deletes a bucket synchronously.
Declaration
public override void DeleteBucket(string bucket, DeleteBucketOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket to delete. Must not be null. |
DeleteBucketOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
Overrides
DeleteBucketAsync(Bucket, DeleteBucketOptions, CancellationToken)
Deletes bucket asynchronously.
Declaration
public override Task DeleteBucketAsync(Bucket bucket, DeleteBucketOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
Bucket | bucket | Bucket to delete. Must not be null, and must have the name populated. |
DeleteBucketOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task representing the asynchronous operation. |
Overrides
DeleteBucketAsync(String, DeleteBucketOptions, CancellationToken)
Deletes a bucket asynchronously.
Declaration
public override Task DeleteBucketAsync(string bucket, DeleteBucketOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket to delete. Must not be null. |
DeleteBucketOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task representing the asynchronous operation. |
Overrides
DeleteHmacKey(String, String, DeleteHmacKeyOptions)
Synchronously deletes an HMAC key, which must already have been deactivated.
Declaration
public override void DeleteHmacKey(string projectId, string accessId, DeleteHmacKeyOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | projectId | The ID of the project containing the HMAC key to delete. |
System.String | accessId | The ID of the HMAC key to delete. Must not be null. |
DeleteHmacKeyOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
Overrides
DeleteHmacKeyAsync(String, String, DeleteHmacKeyOptions, CancellationToken)
Asynchronously deletes an HMAC key, which must already have been deactivated.
Declaration
public override Task DeleteHmacKeyAsync(string projectId, string accessId, DeleteHmacKeyOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | projectId | The ID of the project containing the HMAC key to delete. |
System.String | accessId | The ID of the HMAC key to delete. Must not be null. |
DeleteHmacKeyOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task representing the asynchronous operation. |
Overrides
DeleteNotification(String, String, DeleteNotificationOptions)
Deletes a notification configuration.
Declaration
public override void DeleteNotification(string bucket, string notificationId, DeleteNotificationOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The bucket associated with the notification configuration. Must not be null. |
System.String | notificationId | ID of the notification configuration to delete. Must not be null. |
DeleteNotificationOptions | options | The options for the operation. May be null, in which case defaults will be supplied. |
Overrides
DeleteNotificationAsync(String, String, DeleteNotificationOptions, CancellationToken)
Asynchronously deletes a notification configuration.
Declaration
public override Task DeleteNotificationAsync(string bucket, string notificationId, DeleteNotificationOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The bucket associated with the notification configuration. Must not be null. |
System.String | notificationId | ID of the notification configuration to delete. Must not be null. |
DeleteNotificationOptions | options | The options for the operation. May be null, in which case defaults will be supplied. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task representing the asynchronous operation. |
Overrides
DeleteObject(Object, DeleteObjectOptions)
Deletes a version of the specified object synchronously.
Declaration
public override void DeleteObject(Object obj, DeleteObjectOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | Object to delete. Must not be null, and must have the name and bucket populated. |
DeleteObjectOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
Overrides
Remarks
By default this will delete the latest version of the object, but this can be
controlled using Generation. Note that any generation information
contained within obj
is ignored; the generation to delete is only controlled
via options
. For buckets that support
multiple versions, implicitly deleting the latest version only archives
it so the object is still available and can be listed by specifying Versions.
If the version is explicitly specified, the object is permanently deleted.
If the bucket containing the object supports versioning, after this operation completes successfully there may still be another version of the same object. In buckets which do not support versioning, this operation will permanently delete the object.
If the request attempts to delete an object that does not exist or a specific version that does not exist, this counts as a failure with an HTTP status code of 404.
DeleteObject(String, String, DeleteObjectOptions)
Deletes a version of the specified object synchronously.
Declaration
public override void DeleteObject(string bucket, string objectName, DeleteObjectOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket containing the object. Must not be null. |
System.String | objectName | The name of the object within the bucket. Must not be null. |
DeleteObjectOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
Overrides
Remarks
By default this will delete the latest version of the object, but this can be controlled using Generation. For buckets that support multiple versions, implicitly deleting the latest version only archives it so the object is still available and can be listed by specifying Versions. If the version is explicitly specified, the object is permanently deleted.
If the bucket containing the object supports versioning, after this operation completes successfully there may still be another version of the same object. In buckets which do not support versioning, this operation will permanently delete the object.
If the request attempts to delete an object that does not exist or a specific version that does not exist, this counts as a failure with an HTTP status code of 404.
DeleteObjectAsync(Object, DeleteObjectOptions, CancellationToken)
Deletes a version of the specified object asynchronously.
Declaration
public override Task DeleteObjectAsync(Object obj, DeleteObjectOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
Object | obj | Object to delete. Must not be null, and must have the name and bucket populated. |
DeleteObjectOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task representing the asynchronous operation. |
Overrides
Remarks
By default this will delete the latest version of the object, but this can be
controlled using Generation. Note that any generation information
contained within obj
is ignored; the generation to delete is only controlled
via options
. For buckets that support
multiple versions, implicitly deleting the latest version only archives
it so the object is still available and can be listed by specifying Versions.
If the version is explicitly specified, the object is permanently deleted.
If the bucket containing the object supports versioning, after this operation completes successfully there may still be another version of the same object. In buckets which do not support versioning, this operation will permanently delete the object.
If the request attempts to delete an object that does not exist or a specific version that does not exist, this counts as a failure with an HTTP status code of 404.
DeleteObjectAsync(String, String, DeleteObjectOptions, CancellationToken)
Deletes a version of the specified object asynchronously.
Declaration
public override Task DeleteObjectAsync(string bucket, string objectName, DeleteObjectOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket containing the object. Must not be null. |
System.String | objectName | The name of the object within the bucket. Must not be null. |
DeleteObjectOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task representing the asynchronous operation. |
Overrides
Remarks
By default this will delete the latest version of the object, but this can be controlled using Generation. For buckets that support multiple versions, implicitly deleting the latest version only archives it so the object is still available and can be listed by specifying Versions. If the version is explicitly specified, the object is permanently deleted.
If the bucket containing the object supports versioning, after this operation completes successfully there may still be another version of the same object. In buckets which do not support versioning, this operation will permanently delete the object.
If the request attempts to delete an object that does not exist or a specific version that does not exist, this counts as a failure with an HTTP status code of 404.
Dispose()
Dispose of this instance. See the StorageClient remarks on when this should be called.
Declaration
public override void Dispose()
Overrides
DownloadObject(Object, Stream, DownloadObjectOptions, IProgress<IDownloadProgress>)
Downloads the data for an object from storage synchronously, into a specified stream.
Declaration
public override void DownloadObject(Object source, Stream destination, DownloadObjectOptions options = null, IProgress<IDownloadProgress> progress = null)
Parameters
Type | Name | Description |
---|---|---|
Object | source | Source object to download the data from. Must not be null. |
System.IO.Stream | destination | The stream to write the data into. Must not be null. |
DownloadObjectOptions | options | Additional options for the download. May be null, in which case appropriate defaults will be used. |
System.IProgress<IDownloadProgress> | progress | Progress reporter for the download. May be null. |
Overrides
Remarks
The generation number within source
is ignored by this method.
To download a specific generation, use Generation.
DownloadObject(String, String, Stream, DownloadObjectOptions, IProgress<IDownloadProgress>)
Downloads the data for an object from storage synchronously, into a specified stream.
Declaration
public override void DownloadObject(string bucket, string objectName, Stream destination, DownloadObjectOptions options = null, IProgress<IDownloadProgress> progress = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket containing the object. Must not be null. |
System.String | objectName | The name of the object within the bucket. Must not be null. |
System.IO.Stream | destination | The stream to write the data into. Must not be null. |
DownloadObjectOptions | options | Additional options for the download. May be null, in which case appropriate defaults will be used. |
System.IProgress<IDownloadProgress> | progress | Progress reporter for the download. May be null. |
Overrides
DownloadObjectAsync(Object, Stream, DownloadObjectOptions, CancellationToken, IProgress<IDownloadProgress>)
Downloads the data for an object from storage asynchronously, into a specified stream.
Declaration
public override Task DownloadObjectAsync(Object source, Stream destination, DownloadObjectOptions options = null, CancellationToken cancellationToken = default(CancellationToken), IProgress<IDownloadProgress> progress = null)
Parameters
Type | Name | Description |
---|---|---|
Object | source | Source object to download the data from. Must not be null. |
System.IO.Stream | destination | The stream to write the data into. Must not be null. |
DownloadObjectOptions | options | Additional options for the download. May be null, in which case appropriate defaults will be used. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
System.IProgress<IDownloadProgress> | progress | Progress reporter for the download. May be null. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task representing the asynchronous operation. |
Overrides
Remarks
The generation number within source
is ignored by this method.
To download a specific generation, use Generation.
DownloadObjectAsync(String, String, Stream, DownloadObjectOptions, CancellationToken, IProgress<IDownloadProgress>)
Downloads the data for an object from storage asynchronously, into a specified stream.
Declaration
public override Task DownloadObjectAsync(string bucket, string objectName, Stream destination, DownloadObjectOptions options = null, CancellationToken cancellationToken = default(CancellationToken), IProgress<IDownloadProgress> progress = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket containing the object. Must not be null. |
System.String | objectName | The name of the object within the bucket. Must not be null. |
System.IO.Stream | destination | The stream to write the data into. Must not be null. |
DownloadObjectOptions | options | Additional options for the download. May be null, in which case appropriate defaults will be used. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
System.IProgress<IDownloadProgress> | progress | Progress reporter for the download. May be null. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task representing the asynchronous operation. |
Overrides
GetBucket(String, GetBucketOptions)
Fetches the information about a bucket synchronously.
Declaration
public override Bucket GetBucket(string bucket, GetBucketOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket. Must not be null. |
GetBucketOptions | options | Additional options for the fetch operation. May be null, in which case appropriate defaults will be used. |
Returns
Type | Description |
---|---|
Bucket | The Bucket representation of the storage bucket. |
Overrides
GetBucketAsync(String, GetBucketOptions, CancellationToken)
Fetches the information about a bucket asynchronously.
Declaration
public override Task<Bucket> GetBucketAsync(string bucket, GetBucketOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket. Must not be null. |
GetBucketOptions | options | Additional options for the fetch operation. May be null, in which case appropriate defaults will be used. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Bucket> | A task representing the asynchronous operation, with a result returning the Bucket representation of the storage bucket. |
Overrides
GetBucketIamPolicy(String, GetBucketIamPolicyOptions)
Fetches the IAM policy information about a bucket synchronously.
Declaration
public override Policy GetBucketIamPolicy(string bucket, GetBucketIamPolicyOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket. Must not be null. |
GetBucketIamPolicyOptions | options | Additional options for the fetch operation. May be null, in which case appropriate defaults will be used. |
Returns
Type | Description |
---|---|
Policy | The Policy representation of the storage bucket IAM policy. |
Overrides
GetBucketIamPolicyAsync(String, GetBucketIamPolicyOptions, CancellationToken)
Fetches the IAM policy information about a bucket asynchronously.
Declaration
public override Task<Policy> GetBucketIamPolicyAsync(string bucket, GetBucketIamPolicyOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket. Must not be null. |
GetBucketIamPolicyOptions | options | Additional options for the fetch operation. May be null, in which case appropriate defaults will be used. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Policy> | A task representing the asynchronous operation, with a result returning the Policy representation of the storage bucket IAM policy. |
Overrides
GetHmacKey(String, String, GetHmacKeyOptions)
Synchronously fetches metadata for the specified HMAC key.
Declaration
public override HmacKeyMetadata GetHmacKey(string projectId, string accessId, GetHmacKeyOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | projectId | The project containing the HMAC key. Must not be null. |
System.String | accessId | The ID of the HMAC key. Must not be null. |
GetHmacKeyOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
Returns
Type | Description |
---|---|
HmacKeyMetadata | The HMAC key metadata |
Overrides
GetHmacKeyAsync(String, String, GetHmacKeyOptions, CancellationToken)
Asynchronously fetches metadata for the specified HMAC key.
Declaration
public override Task<HmacKeyMetadata> GetHmacKeyAsync(string projectId, string accessId, GetHmacKeyOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | projectId | The project containing the HMAC key. Must not be null. |
System.String | accessId | The ID of the HMAC key. Must not be null. |
GetHmacKeyOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<HmacKeyMetadata> | A task representing the asynchronous operation, with a result returning the HMAC key metadata. |
Overrides
GetNotification(String, String, GetNotificationOptions)
Fetches a notification configuration.
Declaration
public override Notification GetNotification(string bucket, string notificationId, GetNotificationOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The bucket associated with the notification configuration. Must not be null. |
System.String | notificationId | ID of the notification configuration to fetch. Must not be null. |
GetNotificationOptions | options | The options for the operation. May be null, in which case defaults will be supplied. |
Returns
Type | Description |
---|---|
Notification | The Notification representation of the notification configuration. |
Overrides
GetNotificationAsync(String, String, GetNotificationOptions, CancellationToken)
Asynchronously fetches a notification configuration.
Declaration
public override Task<Notification> GetNotificationAsync(string bucket, string notificationId, GetNotificationOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The bucket associated with the notification configuration. Must not be null. |
System.String | notificationId | ID of the notification configuration to fetch. Must not be null. |
GetNotificationOptions | options | The options for the operation. May be null, in which case defaults will be supplied. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Notification> | A task representing the asynchronous operation, with a result returning the Notification representation of the notification configuration. |
Overrides
GetObject(String, String, GetObjectOptions)
Fetches the information about an object synchronously.
Declaration
public override Object GetObject(string bucket, string objectName, GetObjectOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket containing the object. Must not be null. |
System.String | objectName | The name of the object within the bucket. Must not be null. |
GetObjectOptions | options | Additional options for the fetch operation. May be null, in which case appropriate defaults will be used. |
Returns
Type | Description |
---|---|
Object | The Object representation of the storage object. |
Overrides
Remarks
This does not retrieve the content of the object itself. Use DownloadObject(String, String, Stream, DownloadObjectOptions, IProgress<IDownloadProgress>) to download the content.
GetObjectAsync(String, String, GetObjectOptions, CancellationToken)
Fetches the information about an object asynchronously.
Declaration
public override Task<Object> GetObjectAsync(string bucket, string objectName, GetObjectOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket containing the object. Must not be null. |
System.String | objectName | The name of the object within the bucket. Must not be null. |
GetObjectOptions | options | Additional options for the fetch operation. May be null, in which case appropriate defaults will be used. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Object> | A task representing the asynchronous operation, with a result returning the Object representation of the storage object. |
Overrides
Remarks
This does not retrieve the content of the object itself. Use DownloadObjectAsync(String, String, Stream, DownloadObjectOptions, CancellationToken, IProgress<IDownloadProgress>) to download the content.
GetStorageServiceAccountEmail(String, GetStorageServiceAccountEmailOptions)
Retrieves the service account email address that Google Cloud Storage uses for operations on other services such as Google Cloud Pub/Sub.
Declaration
public override string GetStorageServiceAccountEmail(string projectId, GetStorageServiceAccountEmailOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | projectId | ID of the project to retrieve the service account for. Must not be null. |
GetStorageServiceAccountEmailOptions | options | The options for the operation. May be null, in which case defaults will be supplied. |
Returns
Type | Description |
---|---|
System.String | The email address of the service account. |
Overrides
GetStorageServiceAccountEmailAsync(String, GetStorageServiceAccountEmailOptions, CancellationToken)
Asynchronously retrieves the service account email address that Google Cloud Storage uses for operations on other services such as Google Cloud Pub/Sub.
Declaration
public override Task<string> GetStorageServiceAccountEmailAsync(string projectId, GetStorageServiceAccountEmailOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | projectId | ID of the project to retrieve the service account for. Must not be null. |
GetStorageServiceAccountEmailOptions | options | The options for the operation. May be null, in which case defaults will be supplied. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.String> | A task representing the asynchronous operation, with a result returning the email address of the service account. |
Overrides
ListBuckets(String, ListBucketsOptions)
Lists the buckets for a given project, synchronously but lazily.
Declaration
public override PagedEnumerable<Buckets, Bucket> ListBuckets(string projectId, ListBucketsOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | projectId | The ID of the project to list the buckets from. Must not be null. |
ListBucketsOptions | options | The options for the operation. May be null, in which case defaults will be supplied. |
Returns
Type | Description |
---|---|
PagedEnumerable<Buckets, Bucket> | A sequence of buckets within the project. |
Overrides
Remarks
This method fetches the buckets lazily, making requests to the underlying service for a page of results at a time, as required. No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.
ListBucketsAsync(String, ListBucketsOptions)
Asynchronously lists the buckets in a given project.
Declaration
public override PagedAsyncEnumerable<Buckets, Bucket> ListBucketsAsync(string projectId, ListBucketsOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | projectId | The ID of the project to list the buckets from. Must not be null. |
ListBucketsOptions | options | The options for the operation. May be null, in which case defaults will be supplied. |
Returns
Type | Description |
---|---|
PagedAsyncEnumerable<Buckets, Bucket> | An asynchronous sequence of buckets. |
Overrides
Remarks
This method fetches the buckets lazily, making requests to the underlying service for a page of results at a time, as required. No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.
ListHmacKeys(String, String, ListHmacKeysOptions)
Lists the HMAC keys in a given project, synchronously but lazily, optionally filtering by service account email address.
Declaration
public override PagedEnumerable<HmacKeysMetadata, HmacKeyMetadata> ListHmacKeys(string projectId, string serviceAccountEmail = null, ListHmacKeysOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | projectId | The project containing the HMAC keys. Must not be null. |
System.String | serviceAccountEmail | The service account email address to list keys for. May be null, in which case all HMAC keys associated with the project are returned. |
ListHmacKeysOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
Returns
Type | Description |
---|---|
PagedEnumerable<HmacKeysMetadata, HmacKeyMetadata> | A sequence of HMAC keys within the project. |
Overrides
Remarks
This method fetches the buckets lazily, making requests to the underlying service for a page of results at a time, as required. No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.
ListHmacKeysAsync(String, String, ListHmacKeysOptions)
Lists the HMAC keys in a given project, asynchronously and lazily, optionally filtering by service account email address.
Declaration
public override PagedAsyncEnumerable<HmacKeysMetadata, HmacKeyMetadata> ListHmacKeysAsync(string projectId, string serviceAccountEmail = null, ListHmacKeysOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | projectId | The project containing the HMAC keys. Must not be null. |
System.String | serviceAccountEmail | The service account email address to list keys for. May be null, in which case all HMAC keys associated with the project are returned. |
ListHmacKeysOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
Returns
Type | Description |
---|---|
PagedAsyncEnumerable<HmacKeysMetadata, HmacKeyMetadata> | An asynchronous sequence of HMAC keys within the project. |
Overrides
Remarks
This method fetches the buckets lazily, making requests to the underlying service for a page of results at a time, as required. No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.
ListNotifications(String, ListNotificationsOptions)
Lists notification configurations associated with a bucket.
Declaration
public override IReadOnlyList<Notification> ListNotifications(string bucket, ListNotificationsOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The bucket for which to list associated notification configurations. Must not be null. |
ListNotificationsOptions | options | The options for the operation. May be null, in which case defaults will be supplied. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<Notification> | A list of notification configurations associated with the specified bucket. This method never returns null. |
Overrides
ListNotificationsAsync(String, ListNotificationsOptions, CancellationToken)
Asynchronously lists notification configurations associated with a bucket.
Declaration
public override Task<IReadOnlyList<Notification>> ListNotificationsAsync(string bucket, ListNotificationsOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The bucket for which to list associated notification configurations. Must not be null. |
ListNotificationsOptions | options | The options for the operation. May be null, in which case defaults will be supplied. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<Notification>> | A task representing the asynchronous operation, with a result returning the list of notification configurations associated with the specified bucket. The result is never null. |
Overrides
ListObjects(String, String, ListObjectsOptions)
Lists the objects in a given bucket, synchronously but lazily.
Declaration
public override PagedEnumerable<Objects, Object> ListObjects(string bucket, string prefix = null, ListObjectsOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The bucket to list the objects from. Must not be null. |
System.String | prefix | The prefix to match. Only objects with names that start with this string will be returned. This parameter may be null or empty, in which case no filtering is performed. |
ListObjectsOptions | options | The options for the operation. May be null, in which case defaults will be supplied. |
Returns
Type | Description |
---|---|
PagedEnumerable<Objects, Object> | A sequence of objects in the specified bucket. |
Overrides
Remarks
This method fetches the objects lazily, making requests to the underlying service for a page of results at a time, as required. No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.
ListObjectsAsync(String, String, ListObjectsOptions)
Asynchronously lists the objects in a given bucket.
Declaration
public override PagedAsyncEnumerable<Objects, Object> ListObjectsAsync(string bucket, string prefix = null, ListObjectsOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The bucket to list the objects from. Must not be null. |
System.String | prefix | The prefix to match. Only objects with names that start with this string will be returned. This parameter may be null or empty, in which case no filtering is performed. |
ListObjectsOptions | options | The options for the operation. May be null, in which case defaults will be supplied. |
Returns
Type | Description |
---|---|
PagedAsyncEnumerable<Objects, Object> | An asynchronous sequence of objects in the specified bucket. |
Overrides
Remarks
This method fetches the objects lazily, making requests to the underlying service for a page of results at a time, as required. No network requests are made until the returned sequence is enumerated. This means that any exception due to an invalid request will be deferred until that time. Callers should be prepared for exceptions to be thrown while enumerating the results. In addition to failures due to invalid requests, network or service failures can cause exceptions even after the first results have been returned.
LockBucketRetentionPolicy(String, Int64, LockBucketRetentionPolicyOptions)
Locks the retention policy of a bucket. This is a one-way process: once a retention policy is locked, it cannot be shortened, removed or unlocked, although it can be increased in duration. The lock persists until the bucket is deleted.
Declaration
public override void LockBucketRetentionPolicy(string bucket, long metageneration, LockBucketRetentionPolicyOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket whose retention policy should be locked. Must not be null. |
System.Int64 | metageneration | The current metageneration of the bucket, used to validate that the bucket version to be locked is the intended one. |
LockBucketRetentionPolicyOptions | options | The options for the operation. May be null, in which case defaults will be supplied. |
Overrides
LockBucketRetentionPolicyAsync(String, Int64, LockBucketRetentionPolicyOptions, CancellationToken)
Asynchronously locks the retention policy of a bucket. This is a one-way process: once a retention policy is locked, it cannot be shortened, removed or unlocked, although it can be increased in duration. The lock persists until the bucket is deleted.
Declaration
public override Task LockBucketRetentionPolicyAsync(string bucket, long metageneration, LockBucketRetentionPolicyOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket whose retention policy should be locked. Must not be null. |
System.Int64 | metageneration | The current metageneration of the bucket, used to validate that the bucket version to be locked is the intended one. |
LockBucketRetentionPolicyOptions | options | The options for the operation. May be null, in which case defaults will be supplied. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task representing the asynchronous operation. |
Overrides
ModifyBucketLabels(String, IDictionary<String, String>, ModifyBucketLabelsOptions)
Sets or removes one or more labels on a bucket.
Declaration
public override IDictionary<string, string> ModifyBucketLabels(string bucket, IDictionary<string, string> labels, ModifyBucketLabelsOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket. Must not be null. |
System.Collections.Generic.IDictionary<System.String, System.String> | labels | The labels to set. Must contain at least one entry; keys must not be null, but values may be (indicating label removal). |
ModifyBucketLabelsOptions | options | The options for the operation. May be null, in which case defaults will be supplied. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.String> | A dictionary with the same keys as |
Overrides
Remarks
Each entry in labels
is treated as a label to set or remove. If the value is null,
it will be removed from the bucket; otherwise, it will be set/added. Labels which do not have an entry
in the dictionary will be ignored.
ModifyBucketLabelsAsync(String, IDictionary<String, String>, ModifyBucketLabelsOptions, CancellationToken)
Sets or removes one or more labels on a bucket asynchronously.
Declaration
public override Task<IDictionary<string, string>> ModifyBucketLabelsAsync(string bucket, IDictionary<string, string> labels, ModifyBucketLabelsOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket. Must not be null. |
System.Collections.Generic.IDictionary<System.String, System.String> | labels | The labels to set. Must contain at least one entry; keys must not be null, but values may be (indicating label removal). |
ModifyBucketLabelsOptions | options | The options for the operation. May be null, in which case defaults will be supplied. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IDictionary<System.String, System.String>> | A dictionary with the same keys as |
Overrides
Remarks
Each entry in labels
is treated as a label to set or remove. If the value is null,
it will be removed from the bucket; otherwise, it will be set/added. Labels which do not have an entry
in the dictionary will be ignored.
PatchBucket(Bucket, PatchBucketOptions)
Patches the metadata for a storage bucket synchronously.
Declaration
public override Bucket PatchBucket(Bucket bucket, PatchBucketOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Bucket | bucket | Bucket to update. Must not be null, and must have a populated |
PatchBucketOptions | options | Additional options for the update. May be null, in which case appropriate defaults will be used. |
Returns
Type | Description |
---|---|
Bucket | The Bucket representation of the updated storage bucket. |
Overrides
PatchBucketAsync(Bucket, PatchBucketOptions, CancellationToken)
Patches the metadata for a storage bucket asynchronously.
Declaration
public override Task<Bucket> PatchBucketAsync(Bucket bucket, PatchBucketOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
Bucket | bucket | Bucket to update. Must not be null, and must have a populated |
PatchBucketOptions | options | Additional options for the update. May be null, in which case appropriate defaults will be used. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Bucket> | A task representing the asynchronous operation, with a result returning the Bucket representation of the bucket storage bucket. |
Overrides
PatchObject(Object, PatchObjectOptions)
Patches the metadata for an object in storage synchronously.
Declaration
public override Object PatchObject(Object obj, PatchObjectOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | Object to update. Must not be null, and must have populated |
PatchObjectOptions | options | Additional options for the update. May be null, in which case appropriate defaults will be used. |
Returns
Type | Description |
---|---|
Object | The Object representation of the updated storage object. |
Overrides
PatchObjectAsync(Object, PatchObjectOptions, CancellationToken)
Patches the metadata for an object in storage asynchronously.
Declaration
public override Task<Object> PatchObjectAsync(Object obj, PatchObjectOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
Object | obj | Object to update. Must not be null, and must have populated |
PatchObjectOptions | options | Additional options for the update. May be null, in which case appropriate defaults will be used. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Object> | A task representing the asynchronous operation, with a result returning the Object representation of the updated storage object. |
Overrides
SetBucketIamPolicy(String, Policy, SetBucketIamPolicyOptions)
Updates the IAM policy information about a bucket synchronously.
Declaration
public override Policy SetBucketIamPolicy(string bucket, Policy policy, SetBucketIamPolicyOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket. Must not be null. |
Policy | policy | The new IAM policy for the bucket. Must not be null. |
SetBucketIamPolicyOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
Returns
Type | Description |
---|---|
Policy | The Policy representation of the resulting storage bucket IAM policy. |
Overrides
SetBucketIamPolicyAsync(String, Policy, SetBucketIamPolicyOptions, CancellationToken)
Updates the IAM policy information about a bucket asynchronously.
Declaration
public override Task<Policy> SetBucketIamPolicyAsync(string bucket, Policy policy, SetBucketIamPolicyOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket. Must not be null. |
Policy | policy | The new IAM policy for the bucket. Must not be null. |
SetBucketIamPolicyOptions | options | Additional options for the fetch operation. May be null, in which case appropriate defaults will be used. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Policy> | A task representing the asynchronous operation, with a result returning the Policy representation of the resulting storage bucket IAM policy. |
Overrides
TestBucketIamPermissions(String, IEnumerable<String>, TestBucketIamPermissionsOptions)
Tests the IAM permissions for a bucket synchronously.
Declaration
public override IList<string> TestBucketIamPermissions(string bucket, IEnumerable<string> permissions, TestBucketIamPermissionsOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket. Must not be null. |
System.Collections.Generic.IEnumerable<System.String> | permissions | The permissions to test. Must not be null or empty. |
TestBucketIamPermissionsOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<System.String> | The permissions held by the caller. |
Overrides
TestBucketIamPermissionsAsync(String, IEnumerable<String>, TestBucketIamPermissionsOptions, CancellationToken)
Tests the IAM policy information about a bucket asynchronously.
Declaration
public override Task<IList<string>> TestBucketIamPermissionsAsync(string bucket, IEnumerable<string> permissions, TestBucketIamPermissionsOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket. Must not be null. |
System.Collections.Generic.IEnumerable<System.String> | permissions | The permissions to test. Must not be null or empty. |
TestBucketIamPermissionsOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IList<System.String>> | A task representing the asynchronous operation, with a result returning the permissions held by the caller. |
Overrides
UpdateBucket(Bucket, UpdateBucketOptions)
Updates the metadata for a storage bucket synchronously.
Declaration
public override Bucket UpdateBucket(Bucket bucket, UpdateBucketOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Bucket | bucket | Bucket to update. Must not be null, and must have a populated |
UpdateBucketOptions | options | Additional options for the update. May be null, in which case appropriate defaults will be used. |
Returns
Type | Description |
---|---|
Bucket | The Bucket representation of the updated storage bucket. |
Overrides
Remarks
If no preconditions are explicitly set in options
, the metageneration of bucket
is used as a precondition for the update, unless ForceNoPreconditions is
set to true
.
UpdateBucketAsync(Bucket, UpdateBucketOptions, CancellationToken)
Updates the metadata for storage bucket asynchronously.
Declaration
public override Task<Bucket> UpdateBucketAsync(Bucket bucket, UpdateBucketOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
Bucket | bucket | Bucket to update. Must not be null, and must have a populated |
UpdateBucketOptions | options | Additional options for the update. May be null, in which case appropriate defaults will be used. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Bucket> | A task representing the asynchronous operation, with a result returning the Bucket representation of the storage bucket. |
Overrides
Remarks
If no preconditions are explicitly set in options
, the metageneration of bucket
is used as a precondition for the update, unless ForceNoPreconditions is
set to true
.
UpdateHmacKey(HmacKeyMetadata, UpdateHmacKeyOptions)
Synchronously updates an HMAC key's metadata.
Declaration
public override HmacKeyMetadata UpdateHmacKey(HmacKeyMetadata key, UpdateHmacKeyOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
HmacKeyMetadata | key | The key to update. Must not be null, and the ProjectId and AccessId properties must be set. |
UpdateHmacKeyOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
Returns
Type | Description |
---|---|
HmacKeyMetadata | The updated key metadata. |
Overrides
UpdateHmacKeyAsync(HmacKeyMetadata, UpdateHmacKeyOptions, CancellationToken)
Asynchronously updates an HMAC key's metadata.
Declaration
public override Task<HmacKeyMetadata> UpdateHmacKeyAsync(HmacKeyMetadata key, UpdateHmacKeyOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
HmacKeyMetadata | key | The key to update. Must not be null, and the ProjectId and AccessId properties must be set. |
UpdateHmacKeyOptions | options | Additional options for the operation. May be null, in which case appropriate defaults will be used. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<HmacKeyMetadata> | A task representing the asynchronous operation, with a result returning the updated key metadata. |
Overrides
UpdateObject(Object, UpdateObjectOptions)
Updates the metadata for an object in storage synchronously.
Declaration
public override Object UpdateObject(Object obj, UpdateObjectOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | Object to update. Must not be null, and must have populated |
UpdateObjectOptions | options | Additional options for the update. May be null, in which case appropriate defaults will be used. |
Returns
Type | Description |
---|---|
Object | The Object representation of the updated storage object. |
Overrides
Remarks
If no preconditions are explicitly set in options
, the generation and
metageneration of obj
are used as a precondition for the update,
unless ForceNoPreconditions is
set to true
.
UpdateObjectAsync(Object, UpdateObjectOptions, CancellationToken)
Updates the metadata for an object in storage asynchronously.
Declaration
public override Task<Object> UpdateObjectAsync(Object obj, UpdateObjectOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
Object | obj | Object to update. Must not be null, and must have populated |
UpdateObjectOptions | options | Additional options for the update. May be null, in which case appropriate defaults will be used. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Object> | A task representing the asynchronous operation, with a result returning the Object representation of the storage object. |
Overrides
Remarks
If no preconditions are explicitly set in options
, the generation and
metageneration of obj
are used as a precondition for the update,
unless ForceNoPreconditions is
set to true
.
UploadObject(Object, Stream, UploadObjectOptions, IProgress<IUploadProgress>)
Uploads the data for an object in storage synchronously, from a specified stream.
Declaration
public override Object UploadObject(Object destination, Stream source, UploadObjectOptions options = null, IProgress<IUploadProgress> progress = null)
Parameters
Type | Name | Description |
---|---|---|
Object | destination | Object to create or update. Must not be null, and must have the name, bucket and content type populated. |
System.IO.Stream | source | The stream to read the data from. Must not be null. |
UploadObjectOptions | options | Additional options for the upload. May be null, in which case appropriate defaults will be used. |
System.IProgress<IUploadProgress> | progress | Progress reporter for the upload. May be null. |
Returns
Type | Description |
---|---|
Object | The Object representation of the uploaded object. |
Overrides
UploadObject(String, String, String, Stream, UploadObjectOptions, IProgress<IUploadProgress>)
Uploads the data for an object in storage synchronously, from a specified stream.
Declaration
public override Object UploadObject(string bucket, string objectName, string contentType, Stream source, UploadObjectOptions options = null, IProgress<IUploadProgress> progress = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket containing the object. Must not be null. |
System.String | objectName | The name of the object within the bucket. Must not be null. |
System.String | contentType | The content type of the object. This should be a MIME type such as "text/html" or "application/octet-stream". May be null. |
System.IO.Stream | source | The stream to read the data from. Must not be null. |
UploadObjectOptions | options | Additional options for the upload. May be null, in which case appropriate defaults will be used. |
System.IProgress<IUploadProgress> | progress | Progress reporter for the upload. May be null. |
Returns
Type | Description |
---|---|
Object | The Object representation of the uploaded object. |
Overrides
UploadObjectAsync(Object, Stream, UploadObjectOptions, CancellationToken, IProgress<IUploadProgress>)
Uploads the data for an object in storage asynchronously, from a specified stream.
Declaration
public override Task<Object> UploadObjectAsync(Object destination, Stream source, UploadObjectOptions options = null, CancellationToken cancellationToken = default(CancellationToken), IProgress<IUploadProgress> progress = null)
Parameters
Type | Name | Description |
---|---|---|
Object | destination | Object to create or update. Must not be null, and must have the name, bucket and content type populated. |
System.IO.Stream | source | The stream to read the data from. Must not be null. |
UploadObjectOptions | options | Additional options for the upload. May be null, in which case appropriate defaults will be used. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
System.IProgress<IUploadProgress> | progress | Progress reporter for the upload. May be null. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Object> | A task representing the asynchronous operation, with a result returning the Object representation of the uploaded object. |
Overrides
UploadObjectAsync(String, String, String, Stream, UploadObjectOptions, CancellationToken, IProgress<IUploadProgress>)
Uploads the data for an object in storage asynchronously, from a specified stream.
Declaration
public override Task<Object> UploadObjectAsync(string bucket, string objectName, string contentType, Stream source, UploadObjectOptions options = null, CancellationToken cancellationToken = default(CancellationToken), IProgress<IUploadProgress> progress = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | bucket | The name of the bucket containing the object. Must not be null. |
System.String | objectName | The name of the object within the bucket. Must not be null. |
System.String | contentType | The content type of the object. This should be a MIME type such as "text/html" or "application/octet-stream". May be null. |
System.IO.Stream | source | The stream to read the data from. Must not be null. |
UploadObjectOptions | options | Additional options for the upload. May be null, in which case appropriate defaults will be used. |
System.Threading.CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
System.IProgress<IUploadProgress> | progress | Progress reporter for the upload. May be null. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Object> | A task representing the asynchronous operation, with a result returning the Object representation of the uploaded object. |