/* * MinIO .NET Library for Amazon S3 Compatible Cloud Storage, * (C) 2017-2021 MinIO, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using Minio.DataModel; using Minio.DataModel.Args; using Minio.DataModel.Encryption; using Minio.DataModel.ILM; using Minio.DataModel.Notification; using Minio.DataModel.ObjectLock; using Minio.DataModel.Replication; using Minio.DataModel.Result; using Minio.DataModel.Tags; using Minio.Exceptions; namespace Minio.ApiEndpoints; public interface IBucketOperations { /// /// Create a bucket with the given name. /// /// MakeBucketArgs Arguments Object that has bucket info like name, location. etc /// Optional cancellation token to cancel the operation /// Task /// When access or secret key is invalid /// When bucketName is invalid /// When object-lock or another extension is not implemented Task MakeBucketAsync(MakeBucketArgs args, CancellationToken cancellationToken = default); /// /// List all objects in a bucket /// /// Optional cancellation token to cancel the operation /// Task with an iterator lazily populated with objects /// When access or secret key is invalid Task ListBucketsAsync(CancellationToken cancellationToken = default); /// /// Check if a private bucket with the given name exists. /// /// BucketExistsArgs Arguments Object which has bucket identifier information - bucket name, region /// Optional cancellation token to cancel the operation /// Task /// When access or secret key is invalid /// When bucket name is invalid /// When bucket is not found Task BucketExistsAsync(BucketExistsArgs args, CancellationToken cancellationToken = default); /// /// Remove the bucket with the given name. /// /// RemoveBucketArgs Arguments Object which has bucket identifier information like bucket name .etc. /// Optional cancellation token to cancel the operation /// Task /// When access or secret key is invalid /// When bucket name is invalid /// When bucket is not found Task RemoveBucketAsync(RemoveBucketArgs args, CancellationToken cancellationToken = default); /// /// List all objects non-recursively in a bucket with a given prefix, optionally emulating a directory /// /// /// ListObjectsArgs Arguments Object with information like Bucket name, prefix, recursive listing, /// versioning /// /// Optional cancellation token to cancel the operation /// An observable of items that client can subscribe to /// When access or secret key is invalid /// When bucket name is invalid /// When bucket is not found /// /// For example, if you call ListObjectsAsync on a bucket with versioning /// enabled or object lock enabled /// IObservable ListObjectsAsync(ListObjectsArgs args, CancellationToken cancellationToken = default); /// /// Gets notification configuration for this bucket /// /// GetBucketNotificationsArgs Arguments Object with information like Bucket name /// Optional cancellation token to cancel the operation /// /// When access or secret key is invalid /// When bucket name is invalid /// When bucket is not found Task GetBucketNotificationsAsync(GetBucketNotificationsArgs args, CancellationToken cancellationToken = default); /// /// Sets the notification configuration for this bucket /// /// /// SetBucketNotificationsArgs Arguments Object with information like Bucket name, notification object /// with configuration to set /// /// Optional cancellation token to cancel the operation /// /// When access or secret key is invalid /// When bucket name is invalid /// When bucket is not found /// When configuration XML provided is invalid Task SetBucketNotificationsAsync(SetBucketNotificationsArgs args, CancellationToken cancellationToken = default); /// /// Removes all bucket notification configurations stored on the server. /// /// RemoveAllBucketNotificationsArgs Arguments Object with information like Bucket name /// Optional cancellation token to cancel the operation /// /// When access or secret key is invalid /// When bucket name is invalid /// When bucket is not found /// When configuration XML provided is invalid Task RemoveAllBucketNotificationsAsync(RemoveAllBucketNotificationsArgs args, CancellationToken cancellationToken = default); /// /// Subscribes to bucket change notifications (a Minio-only extension) /// /// /// ListenBucketNotificationsArgs Arguments Object with information like Bucket name, listen events, /// prefix filter keys, suffix fileter keys /// /// Optional cancellation token to cancel the operation /// An observable of JSON-based notification events /// When access or secret key is invalid /// When bucket name is invalid /// When bucket is not found /// When configuration XML provided is invalid IObservable ListenBucketNotificationsAsync(ListenBucketNotificationsArgs args, CancellationToken cancellationToken = default); /// /// Gets Tagging values set for this bucket /// /// GetBucketTagsArgs Arguments Object with information like Bucket name /// Optional cancellation token to cancel the operation /// Tagging Object with key-value tag pairs /// When access or secret key is invalid /// When bucket name is invalid /// When bucket is not found /// When a functionality or extension is not implemented Task GetBucketTagsAsync(GetBucketTagsArgs args, CancellationToken cancellationToken = default); /// /// Sets the Tagging values for this bucket /// /// SetBucketTagsArgs Arguments Object with information like Bucket name, tag key-value pairs /// Optional cancellation token to cancel the operation /// /// When access or secret key is invalid /// When bucket name is invalid /// When bucket is not found /// When a functionality or extension is not implemented /// When configuration XML provided is invalid Task SetBucketTagsAsync(SetBucketTagsArgs args, CancellationToken cancellationToken = default); /// /// Removes Tagging values stored for the bucket. /// /// RemoveBucketTagsArgs Arguments Object with information like Bucket name /// Optional cancellation token to cancel the operation /// /// When access or secret key is invalid /// When bucket name is invalid /// When bucket is not found /// When a functionality or extension is not implemented /// When configuration XML provided is invalid Task RemoveBucketTagsAsync(RemoveBucketTagsArgs args, CancellationToken cancellationToken = default); /// /// Sets the Object Lock Configuration on this bucket /// /// /// SetObjectLockConfigurationArgs Arguments Object with information like Bucket name, object lock /// configuration to set /// /// Optional cancellation token to cancel the operation /// /// When access or secret key is invalid /// When bucket name is invalid /// When bucket is not found /// When object lock configuration on bucket is not set /// When a functionality or extension is not implemented /// When configuration XML provided is invalid Task SetObjectLockConfigurationAsync(SetObjectLockConfigurationArgs args, CancellationToken cancellationToken = default); /// /// Gets the Object Lock Configuration on this bucket /// /// GetObjectLockConfigurationArgs Arguments Object with information like Bucket name /// Optional cancellation token to cancel the operation /// ObjectLockConfiguration object /// When access or secret key is invalid /// When bucket name is invalid /// When bucket is not found /// When a functionality or extension is not implemented /// When object lock configuration on bucket is not set Task GetObjectLockConfigurationAsync(GetObjectLockConfigurationArgs args, CancellationToken cancellationToken = default); /// /// Removes the Object Lock Configuration on this bucket /// /// RemoveObjectLockConfigurationArgs Arguments Object with information like Bucket name /// Optional cancellation token to cancel the operation /// /// When access or secret key is invalid /// When bucket name is invalid /// When bucket is not found /// When object lock configuration on bucket is not set /// When a functionality or extension is not implemented /// When configuration XML provided is invalid Task RemoveObjectLockConfigurationAsync(RemoveObjectLockConfigurationArgs args, CancellationToken cancellationToken = default); /// /// Get Versioning information on the bucket with given bucket name /// /// GetVersioningArgs takes bucket as argument. /// Optional cancellation token to cancel the operation /// GetVersioningResponse with information populated from REST response /// When access or secret key is invalid /// When bucket name is invalid /// When a functionality or extension is not implemented /// When bucket is not found Task GetVersioningAsync(GetVersioningArgs args, CancellationToken cancellationToken = default); /// /// Set Versioning as specified on the bucket with given bucket name /// /// SetVersioningArgs Arguments Object with information like Bucket name, Versioning configuration /// Optional cancellation token to cancel the operation /// Task /// When access or secret key is invalid /// When bucket name is invalid /// When bucket is not found /// When a functionality or extension is not implemented /// When configuration XML provided is invalid Task SetVersioningAsync(SetVersioningArgs args, CancellationToken cancellationToken = default); /// /// Sets the Encryption Configuration for the bucket. /// /// SetBucketEncryptionArgs Arguments Object with information like Bucket name, encryption config /// Optional cancellation token to cancel the operation /// Task /// When access or secret key is invalid /// When bucket name is invalid /// When bucket is not found /// When a functionality or extension is not implemented /// When configuration XML provided is invalid Task SetBucketEncryptionAsync(SetBucketEncryptionArgs args, CancellationToken cancellationToken = default); /// /// Returns the Encryption Configuration for the bucket. /// /// GetBucketEncryptionArgs Arguments Object encapsulating information like Bucket name /// Optional cancellation token to cancel the operation /// An object of type ServerSideEncryptionConfiguration /// When access or secret key is invalid /// When bucket name is invalid /// When a functionality or extension is not implemented /// When bucket is not found Task GetBucketEncryptionAsync(GetBucketEncryptionArgs args, CancellationToken cancellationToken = default); /// /// Removes the Encryption Configuration for the bucket. /// /// RemoveBucketEncryptionArgs Arguments Object encapsulating information like Bucket name /// Optional cancellation token to cancel the operation /// Task /// When access or secret key is invalid /// When bucket name is invalid /// When bucket is not found /// When a functionality or extension is not implemented /// When configuration XML provided is invalid Task RemoveBucketEncryptionAsync(RemoveBucketEncryptionArgs args, CancellationToken cancellationToken = default); /// /// Sets the Lifecycle configuration for this bucket /// /// SetBucketLifecycleArgs Arguments Object with information like Bucket name, tag key-value pairs /// Optional cancellation token to cancel the operation /// /// When access or secret key is invalid /// When bucket name is invalid /// When bucket is not found /// When a functionality or extension is not implemented /// When configuration XML provided is invalid Task SetBucketLifecycleAsync(SetBucketLifecycleArgs args, CancellationToken cancellationToken = default); /// /// Gets Lifecycle configuration set for this bucket returned in an object /// /// GetBucketLifecycleArgs Arguments Object with information like Bucket name /// Optional cancellation token to cancel the operation /// Lifecycle Object with key-value tag pairs /// When access or secret key is invalid /// When bucket name is invalid /// When a functionality or extension is not implemented /// When bucket is not found Task GetBucketLifecycleAsync(GetBucketLifecycleArgs args, CancellationToken cancellationToken = default); /// /// Removes Lifecycle configuration stored for the bucket. /// /// RemoveBucketLifecycleArgs Arguments Object with information like Bucket name /// Optional cancellation token to cancel the operation /// /// When access or secret key is invalid /// When bucket name is invalid /// When bucket is not found /// When a functionality or extension is not implemented /// When configuration XML provided is invalid Task RemoveBucketLifecycleAsync(RemoveBucketLifecycleArgs args, CancellationToken cancellationToken = default); /// /// Gets Replication configuration set for this bucket /// /// GetBucketReplicationArgs Arguments Object with information like Bucket name /// Optional cancellation token to cancel the operation /// Replication configuration object /// When access or secret key provided is invalid /// When bucket name is invalid /// When bucket replication configuration is not set /// When a functionality or extension is not implemented /// When bucket is not found Task GetBucketReplicationAsync(GetBucketReplicationArgs args, CancellationToken cancellationToken = default); /// /// Sets the Replication configuration for this bucket /// /// /// SetBucketReplicationArgs Arguments Object with information like Bucket name, Replication /// Configuration object /// /// Optional cancellation token to cancel the operation /// /// When access or secret key provided is invalid /// When bucket name is invalid /// When bucket replication configuration is not set /// When a functionality or extension is not implemented /// When bucket is not found Task SetBucketReplicationAsync(SetBucketReplicationArgs args, CancellationToken cancellationToken = default); /// /// Removes Replication configuration stored for the bucket. /// /// RemoveBucketReplicationArgs Arguments Object with information like Bucket name /// Optional cancellation token to cancel the operation /// /// When access or secret key provided is invalid /// When bucket name is invalid /// When bucket replication configuration is not set /// When a functionality or extension is not implemented /// When bucket is not found Task RemoveBucketReplicationAsync(RemoveBucketReplicationArgs args, CancellationToken cancellationToken = default); Task GetPolicyAsync(GetPolicyArgs args, CancellationToken cancellationToken = default); IObservable ListenBucketNotificationsAsync(string bucketName, IList events, string prefix = "", string suffix = "", CancellationToken cancellationToken = default); Task RemovePolicyAsync(RemovePolicyArgs args, CancellationToken cancellationToken = default); Task SetPolicyAsync(SetPolicyArgs args, CancellationToken cancellationToken = default); }