From 244d873a73a8c3f1bf42e64eaf3e78a9cd4e42e7 Mon Sep 17 00:00:00 2001 From: Ravind Kumar Date: Fri, 4 Mar 2022 12:39:19 -0500 Subject: [PATCH] Sync for MinIO Server Release RELEASE.2022-03-03 --- source/conf.py | 12 +- source/default-conf.py | 2 + source/sdk/dotnet/API.md | 2030 ++++++++++++++++++++++++++++++++------ source/sdk/java/API.md | 84 +- source/sdk/python/API.md | 46 +- 5 files changed, 1851 insertions(+), 323 deletions(-) diff --git a/source/conf.py b/source/conf.py index f5c9d1fd..2dfd7d42 100644 --- a/source/conf.py +++ b/source/conf.py @@ -47,7 +47,7 @@ extensions = [ 'sphinxcontrib.images', 'myst_parser', 'sphinx_design', - 'sphinx.ext.intersphinx' + 'sphinx.ext.intersphinx', ] # -- External Links @@ -139,10 +139,10 @@ rst_prolog = """ .. |podman| replace:: `Podman `__ .. |kes-stable| replace:: 0.16.1 -.. |minio-tag| replace:: `RELEASE.2022-02-16T00-35-27Z `__ -.. |minio-latest| replace:: RELEASE.2022-02-16T00-35-27Z -.. |minio-rpm| replace:: https://dl.min.io/server/minio/release/linux-amd64/minio-20220216003527.0.0.x86_64.rpm -.. |minio-deb| replace:: https://dl.min.io/server/minio/release/linux-amd64/minio_20220216003527.0.0_amd64.deb +.. |minio-tag| replace:: `RELEASE.2022-03-03T21-21-16Z `__ +.. |minio-latest| replace:: RELEASE.2022-03-03T21-21-16Z +.. |minio-rpm| replace:: https://dl.min.io/server/minio/release/linux-amd64/minio-20220303212116.0.0.x86_64.rpm +.. |minio-deb| replace:: https://dl.min.io/server/minio/release/linux-amd64/minio_20220303212116.0.0_amd64.deb .. |subnet| replace:: `MinIO SUBNET ` -""" +""" \ No newline at end of file diff --git a/source/default-conf.py b/source/default-conf.py index 5eb310c2..60e487f8 100644 --- a/source/default-conf.py +++ b/source/default-conf.py @@ -38,6 +38,7 @@ release = '0.1' extensions = [ 'sphinx.ext.extlinks', 'minio', + 'cond', 'sphinx_copybutton', 'sphinx_markdown_tables', 'sphinx-prompt', @@ -46,6 +47,7 @@ extensions = [ 'sphinxcontrib.images', 'myst_parser', 'sphinx_design', + 'sphinx.ext.intersphinx', ] # -- External Links diff --git a/source/sdk/dotnet/API.md b/source/sdk/dotnet/API.md index e9b131ed..28a02e57 100644 --- a/source/sdk/dotnet/API.md +++ b/source/sdk/dotnet/API.md @@ -28,9 +28,27 @@ var s3Client = new MinioClient("s3.amazonaws.com", | [`bucketExists`](#bucketExists) | [`copyObject`](#copyObject) | [`presignedPostPolicy`](#presignedPostPolicy) |[`setBucketNotification`](#setBucketNotification) | | [`removeBucket`](#removeBucket) | [`statObject`](#statObject) | | [`getBucketNotification`](#getBucketNotification) | | [`listObjects`](#listObjects) | [`removeObject`](#removeObject) | | [`removeAllBucketNotification`](#removeAllBucketNotification) | -| [`listIncompleteUploads`](#listIncompleteUploads) | [`removeObjects`](#removeObjects) | | | -| [`listenBucketNotifications`](#listenBucketNotifications) | [`removeIncompleteUpload`](#removeIncompleteUpload) | | | -| | [`selectObjectContent`](#selectObjectContent) | | | +| [`listIncompleteUploads`](#listIncompleteUploads) | [`removeObjects`](#removeObjects) | | | +| [`listenBucketNotifications`](#listenBucketNotifications) | [`selectObjectContent`](#selectObjectContent) | | | +| [`setVersioning`](#setVersioning) | [`setLegalHold`](#setLegalHold) | | | +| [`getVersioning`](#getVersioning) | [`getLegalHold`](#getLegalHold) | | | +| [`setBucketEncryption`](#setBucketEncryption) | [`setObjectTags`](#setObjectTags) | | | +| [`getBucketEncryption`](#getBucketEncryption) | [`getObjectTags`](#getObjectTags) | | | +| [`removeBucketEncryption`](#removeBucketEncryption) | [`removeObjectTags`](#removeObjectTags) | | | +| [`setBucketTags`](#setBucketTags) | [`setObjectRetention`](#setObjectRetention) | | | +| [`getBucketTags`](#getBucketTags) | [`getObjectRetention`](#getObjectRetention) | | | +| [`removeBucketTags`](#removeBucketTags) | [`clearObjectRetention`](#clearObjectRetention) | | | +| [`setObjectLock`](#setObjectLock) | [`removeIncompleteUpload`](#removeIncompleteUpload) | | | +| [`getObjectLock`](#getObjectLock) | | | | +| [`removeObjectLock`](#removeObjectLock) | | | | +| [`setBucketLifecycle`](#setBucketLifecycle) | | | | +| [`getBucketLifecycle`](#getBucketLifecycle) | | | | +| [`removeBucketLifecycle`](#removeBucketLifecycle) | | | | +| [`setBucketReplication`](#setBucketReplication) | | | | +| [`getBucketReplication`](#getBucketReplication) | | | | +| [`removeBucketReplication`](#removeBucketReplication) | | | | + + ## 1. Constructors @@ -69,7 +87,76 @@ __Proxy__ |---| |`Chain .WithProxy(proxyObject) to MinIO Client object to use proxy ` | -__Example__ +| | +|---| +|`public MinioClient()` | +| Creates MinIO client. This client gives an empty object that can be used with Chaining to populate only the member variables we need. + The next important step is to connect to an endpoint. You can chain one of the overloaded method WithEndpoint() to client object to connect. + This client object also uses Http access by default. To use Https, chain method WithSSL() to client object to use secure transfer protocol. + To use non-anonymous access, chain method WithCredentials() to the client object along with the access key & secret key. + Finally chain the method Build() to get the finally built client object. | + + +__Parameters__ + +| None | + + +__Secure Access__ + +| | +|---| +|`Chain .WithSSL() to MinIO Client object to use https instead of http. ` | + + +__Endpoint__ + +| | +|---| +|`Chain .WithEndpoint() to MinIO Client object to initialize the endpoint. ` | + + +__Parameters__ +|Param | Type | Description | +|:--- |:--- |:--- | +| ``endpoint`` | _string_ | Server Name (Resolvable) or IP address as the endpoint | + +| Return Type | Exceptions | +|:--- |:--- | +| ``MinioClient`` | Listed Exceptions: | +| | | + + + +__Endpoint__ + +| | +|---| +|`Chain .WithEndpoint() to MinIO Client object to initialize the endpoint. ` | + + +__Parameters__ +|Param | Type | Description | +|:--- |:--- |:--- | +| ``endpoint`` | _string_ | Server Name (Resolvable) or IP address as the endpoint | +| ``port`` | _int_ | Port on which the server is listening | +| ``secure`` | _bool_ | If true, use https; if not, use http | + +| Return Type | Exceptions | +|:--- |:--- | +| ``MinioClient`` | Listed Exceptions: | +| | | + + +__Proxy__ + +| | +|---| +|`Chain .WithProxy(proxyObject) to MinIO Client object to use proxy ` | + + + +__Examples__ ### MinIO @@ -91,9 +178,22 @@ MinioClient minioClient = new MinioClient("my-ip-address:9000", "minio", "minio1 // 4. Initializing minio client with temporary credentials MinioClient minioClient = new MinioClient("my-ip-address:9000", "tempuserid", "temppasswd", sessionToken:"sessionToken"); + +// 5. Using Builder with public MinioClient(), Endpoint, Credentials & Secure connection +MinioClient minioClient = new MinioClient() + .WithEndpoint("play.min.io") + .WithCredentials("Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG") + .WithSSL() + .Build() +// 6. Using Builder with public MinioClient(), Endpoint, Credentials & Secure connection +MinioClient minioClient = new MinioClient() + .WithEndpoint("play.min.io", 9000, true) + .WithCredentials("Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG") + .Build() ``` + ### AWS S3 @@ -102,9 +202,15 @@ MinioClient minioClient = new MinioClient("my-ip-address:9000", "tempuserid", "t MinioClient s3Client = new MinioClient("s3.amazonaws.com").WithSSL(); // 2. public MinioClient(String endpoint, String accessKey, String secretKey) -MinioClient s3Client = new MinioClient("s3.amazonaws.com:80", +MinioClient s3Client = new MinioClient("s3.amazonaws.com", accessKey:"YOUR-ACCESSKEYID", secretKey:"YOUR-SECRETACCESSKEY").WithSSL(); +// 3. Using Builder with public MinioClient(), Endpoint, Credentials & Secure connection +MinioClient minioClient = new MinioClient() + .WithEndpoint("s3.amazonaws.com") + .WithCredentials("YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY") + .WithSSL() + .Build() ``` ## 2. Bucket operations @@ -159,6 +265,55 @@ catch (MinioException e) } ``` +### MakeBucketAsync(MakeBucketArgs args) +`Task MakeBucketAsync(MakeBucketArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Creates a new bucket. + + +__Parameters__ + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _MakeBucketArgs_ | Arguments Object - name, location. | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task`` | Listed Exceptions: | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``ConnectionException`` : upon connection error | +| | ``AccessDeniedException`` : upon access denial | +| | ``RedirectionException`` : upon redirection by server | +| | ``InternalClientException`` : upon internal library error | + + +__Example__ + + +```cs +try +{ + // Create bucket if it doesn't exist. + bool found = await minioClient.BucketExistsAsync(bktExistArgs); + if (found) + { + Console.WriteLine(bktExistArgs.BucketName +" already exists"); + } + else + { + // Create bucket 'my-bucketname'. + await minioClient.MakeBucketAsync(mkBktArgs); + Console.WriteLine(mkBktArgs.BucketName + " is created successfully"); + } +} +catch (MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + ### ListBucketsAsync() @@ -245,6 +400,49 @@ catch (MinioException e) ``` +### BucketExistsAsync(BucketExistsArgs) + +`Task BucketExistsAsync(BucketExistsArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Checks if a bucket exists. + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _BucketExistsArgs_ | Argument object - bucket name. | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task`` : true if the bucket exists | Listed Exceptions: | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``ConnectionException`` : upon connection error | +| | ``AccessDeniedException`` : upon access denial | +| | ``ErrorResponseException`` : upon unsuccessful execution | +| | ``InternalClientException`` : upon internal library error | + + + +__Example__ + + +```cs +try +{ + // Check whether 'my-bucketname' exists or not. + bool found = await minioClient.BucketExistsAsync(args); + Console.WriteLine(args.BucketName + " " + ((found == true) ? "exists" : "does not exist")); +} +catch (MinioException e) +{ + Console.WriteLine("[Bucket] Exception: {0}", e); +} +``` + ### RemoveBucketAsync(string bucketName) @@ -258,7 +456,7 @@ NOTE: - removeBucket does not delete the objects inside the bucket. The objects __Parameters__ - + |Param | Type | Description | |:--- |:--- |:--- | | ``bucketName`` | _string_ | Name of the bucket | @@ -301,21 +499,737 @@ catch(MinioException e) } ``` - -### ListObjectsAsync(string bucketName, string prefix = null, bool recursive = true) +### RemoveBucketAsync(RemoveBucketArgs args) -`IObservable ListObjectsAsync(string bucketName, string prefix = null, bool recursive = false, CancellationToken cancellationToken = default(CancellationToken))` +`Task RemoveBucketAsync(RemoveBucketArgs args, CancellationToken cancellationToken = default(CancellationToken))` -Lists all objects in a bucket. +Removes a bucket. + + +NOTE: - removeBucket does not delete the objects inside the bucket. The objects need to be deleted using the removeObject API. + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _RemoveBucketArgs_ | Arguments Object - bucket name | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| Task | Listed Exceptions: | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``ConnectionException`` : upon connection error | +| | ``AccessDeniedException`` : upon access denial | +| | ``ErrorResponseException`` : upon unsuccessful execution | +| | ``InternalClientException`` : upon internal library error | +| | ``BucketNotFoundException`` : upon missing bucket | + + +__Example__ + + +```cs +try +{ + // Check if my-bucket exists before removing it. + bool found = await minioClient.BucketExistsAsync(bktExistsArgs); + if (found) + { + // Remove bucket my-bucketname. This operation will succeed only if the bucket is empty. + await minioClient.RemoveBucketAsync(rmBktArgs); + Console.WriteLine(rmBktArgs.BucketName + " is removed successfully"); + } + else + { + Console.WriteLine(bktExistsArgs.BucketName + " does not exist"); + } +} +catch(MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + +### public async Task GetVersioningAsync(GetVersioningArgs args) + +`Task GetVersioningAsync(GetVersioningArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Get versioning information for a bucket. __Parameters__ |Param | Type | Description | |:--- |:--- |:--- | -| ``bucketName`` | _string_ | Name of the bucket | -| ``prefix`` | _string_ | Prefix string. List objects whose name starts with ``prefix`` | -| ``recursive`` | _bool_ | when false, emulates a directory structure where each listing returned is either a full object or part of the object's key up to the first '/'. All objects with the same prefix up to the first '/' will be merged into one entry. Defaults to `false`| +| ``args`` | _GetVersioningArgs_ | Arguments Object - bucket name. | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +|Return Type | Exceptions | +|:--- |:--- | +| ``VersioningConfiguration``:VersioningConfiguration with information populated from response. | _None_ | + + +__Example__ + + +```cs +try +{ + // Check whether 'mybucket' exists or not. + bool found = minioClient.BucketExistsAsync(bktExistsArgs); + if (found) + { + var args = new GetVersioningArgs("mybucket") + .WithSSL(); + VersioningConfiguration vc = await minio.GetVersioningInfoAsync(args); + } + else + { + Console.WriteLine(bktExistsArgs.BucketName + " does not exist"); + } +} +catch (MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + + +### public async Task SetVersioningAsync(SetVersioningArgs args) + +`Task SetVersioningAsync(SetVersioningArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Set versioning to Enabled or Suspended for a bucket. + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _SetVersioningArgs_ | Arguments Object - bucket name, versioning status. | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +|Return Type | Exceptions | +|:--- |:--- | +| ``Task``: | _None_ | + + +__Example__ + + +```cs +try +{ + // Check whether 'mybucket' exists or not. + bool found = minioClient.BucketExistsAsync(bktExistsArgs); + if (found) + { + var args = new SetVersioningArgs("mybucket") + .WithSSL() + .WithVersioningEnabled(); + + await minio.SetVersioningAsync(setArgs); + } + else + { + Console.WriteLine(bktExistsArgs.BucketName + " does not exist"); + } +} +catch (MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + + + +### SetBucketEncryptionAsync(SetBucketEncryptionArgs args) + +`Task SetBucketEncryptionAsync(SetBucketEncryptionArgs args, CancellationToken cancellationToken = default(CancellationToken));` + +Sets the Bucket Encryption Configuration of a bucket. + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _SetBucketEncryptionArgs_ | SetBucketEncryptionArgs Argument Object with bucket, encryption configuration | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task`` | Listed Exceptions: | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``BucketNotFoundException`` : upon bucket with name not found | +| | ``MalFormedXMLException`` : upon configuration XML in http request validation failure | +| | ``UnexpectedMinioException`` : upon internal errors encountered during the operation | + + + +__Example__ + + +```cs +try +{ + // Set Encryption Configuration for the bucket + SetBucketEncryptionArgs args = new SetBucketEncryptionArgs() + .WithBucket(bucketName) + .WithEncryptionConfig(config); + await minio.SetBucketEncryptionAsync(args); +} +catch(MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + +### GetBucketEncryptionAsync(GetBucketEncryptionArgs args) + +`Task GetBucketEncryptionAsync(GetBucketEncryptionArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Gets the Bucket Encryption configuration of the bucket. + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _GetBucketEncryptionArgs_ | GetBucketEncryptionArgs Argument Object with bucket name | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task``: ServerSideEncryptionConfiguration object which contains the bucket encryption configuration. | Listed Exceptions: | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``BucketNotFoundException`` : upon bucket with name not found | +| | ``MalFormedXMLException`` : upon configuration XML in http request validation failure | +| | ``UnexpectedMinioException`` : upon internal errors encountered during the operation | + + + +__Example__ + + +```cs +try +{ + // Get Bucket Encryption Configuration for the bucket + var args = new GetBucketEncryptionArgs() + .WithBucket(bucketName); + ServerSideEncryptionConfiguration config = await minio.GetBucketEncryptionAsync(args); + Console.WriteLine($"Got encryption configuration for bucket {bucketName}."); +} +catch(MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + + +### RemoveBucketEncryptionAsync(RemoveBucketEncryptionArgs args) + +`Task RemoveBucketEncryptionAsync(RemoveBucketEncryptionArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Remove the Bucket Encryption configuration of an object. + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _RemoveBucketEncryptionArgs_ | RemoveBucketEncryptionArgs Argument Object with bucket name | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task`` | Listed Exceptions: | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``BucketNotFoundException`` : upon bucket with name not found | +| | ``MalFormedXMLException`` : upon configuration XML in http request validation failure | +| | ``UnexpectedMinioException`` : upon internal errors encountered during the operation | + + + +__Example__ + + +```cs +try +{ + // Remove Bucket Encryption Configuration for the bucket + var args = new RemoveBucketEncryptionArgs() + .WithBucket(bucketName); + await minio.RemoveBucketEncryptionAsync(args); + Console.WriteLine($"Removed encryption configuration for bucket {bucketName}."); +} +catch(MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + +### SetBucketTagsAsync(SetBucketTagsArgs args) + +`Task SetBucketTagsAsync(SetBucketTagsArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Sets tags to a bucket. + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _SetBucketTagsArgs_ | SetBucketTagsArgs Argument Object with bucket, tags to set | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task`` | Listed Exceptions: | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``BucketNotFoundException`` : upon bucket with name not found | +| | ``MalFormedXMLException`` : upon configuration XML in http request validation failure | +| | ``UnexpectedMinioException`` : upon internal errors encountered during the operation | + + + +__Example__ + + +```cs +try +{ + // Set Tags for the bucket + SetBucketTagsArgs args = new SetBucketTagsArgs() + .WithBucket(bucketName) + .WithTagging(tags); + await minio.SetBucketTagsAsync(args); + Console.WriteLine($"Set Tags for bucket {bucketName}."); +} +catch(MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + +### GetBucketTagsAsync(GetBucketTagsArgs args) + +`Task GetBucketTagsAsync(GetBucketTagsArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Gets tags of a bucket. + + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _GetBucketTagsArgs_ | GetBucketTagsArgs Argument Object with bucket name | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task``: Tagging object which containing tag-value pairs. | Listed Exceptions: | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``BucketNotFoundException`` : upon bucket with name not found | +| | ``MalFormedXMLException`` : upon configuration XML in http request validation failure | +| | ``UnexpectedMinioException`` : upon internal errors encountered during the operation | + + + +__Example__ + + +```cs +try +{ + // Get Bucket Tags for the bucket + var args = new GetBucketTagsArgs() + .WithBucket(bucketName); + var tags = await minio.GetBucketTagsAsync(args); + Console.WriteLine($"Got tags for bucket {bucketName}."); +} +catch(MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + + +### RemoveBucketTagsAsync(RemoveBucketTagsArgs args) + +`Task RemoveBucketTagsAsync(RemoveBucketTagsArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Deletes tags of a bucket. + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _RemoveBucketTagsArgs_ | RemoveBucketTagsArgs Argument Object with bucket name | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task`` | Listed Exceptions: | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``BucketNotFoundException`` : upon bucket with name not found | +| | ``MalFormedXMLException`` : upon configuration XML in http request validation failure | +| | ``UnexpectedMinioException`` : upon internal errors encountered during the operation | + + + +__Example__ + + +```cs +try +{ + // Remove Bucket Encryption Configuration for the bucket + var args = new RemoveBucketTagsArgs() + .WithBucket(bucketName); + await minio.RemoveBucketTagsAsync(args); + Console.WriteLine($"Removed tags for bucket {bucketName}."); +} +catch(MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + + +### SetBucketLifecycleAsync(SetBucketLifecycleArgs args) + +`Task SetBucketLifecycleAsync(SetBucketLifecycleArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Sets Lifecycle configuration to a bucket. + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _SetBucketLifecycleArgs_ | SetBucketLifecycleArgs Argument Object with bucket name, Lifecycle configuration to set | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task`` | Listed Exceptions: | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``BucketNotFoundException`` : upon bucket with name not found | +| | ``MalFormedXMLException`` : upon configuration XML in http request validation failure | +| | ``UnexpectedMinioException`` : upon internal errors encountered during the operation | + + + +__Example__ + + +```cs +try +{ + // Set Lifecycle configuration for the bucket + SetBucketLifecycleArgs args = new SetBucketLifecycleArgs() + .WithBucket(bucketName) + .WithConfiguration(lfc); + await minio.SetBucketLifecycleAsync(args); + Console.WriteLine($"Set Lifecycle for bucket {bucketName}."); +} +catch(MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + +### GetBucketLifecycleAsync(GetBucketLifecycleArgs args) + +`Task GetBucketLifecycleAsync(GetBucketLifecycleArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Gets Lifecycle configuration of a bucket. + + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _GetBucketLifecycleArgs_ | GetBucketLifecycleArgs Argument Object with bucket name | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task``: LifecycleConfiguration object which contains the Lifecycle configuration details. | Listed Exceptions: | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``BucketNotFoundException`` : upon bucket with name not found | +| | ``MalFormedXMLException`` : upon configuration XML in http request validation failure | +| | ``UnexpectedMinioException`` : upon internal errors encountered during the operation | + + + +__Example__ + + +```cs +try +{ + // Get Bucket Lifecycle configuration for the bucket + var args = new GetBucketLifecycleArgs() + .WithBucket(bucketName); + var lfc = await minio.GetBucketLifecycleAsync(args); + Console.WriteLine($"Got Lifecycle configuration for bucket {bucketName}."); +} +catch(MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + + +### RemoveBucketLifecycleAsync(RemoveBucketLifecycleArgs args) + +`Task RemoveBucketLifecycleAsync(RemoveBucketLifecycleArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Deletes Lifecycle configuration of a bucket. + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _RemoveBucketLifecycleArgs_ | RemoveBucketLifecycleArgs Argument Object with bucket name | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task`` | Listed Exceptions: | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``BucketNotFoundException`` : upon bucket with name not found | +| | ``MalFormedXMLException`` : upon configuration XML in http request validation failure | +| | ``UnexpectedMinioException`` : upon internal errors encountered during the operation | + + + +__Example__ + + +```cs +try +{ + // Remove Bucket Lifecycle Configuration for the bucket + var args = new RemoveBucketLifecycleArgs() + .WithBucket(bucketName); + await minio.RemoveBucketLifecycleAsync(args); + Console.WriteLine($"Removed Lifecycle configuration for bucket {bucketName}."); +} +catch(MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + + + +### SetBucketReplicationAsync(SetBucketReplicationArgs args) + +`Task SetBucketReplicationAsync(SetBucketReplicationArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Sets Replication configuration to a bucket. + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _SetBucketReplicationArgs_ | SetBucketReplicationArgs Argument Object with bucket name, Replication configuration to set | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task`` | Listed Exceptions: | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``BucketNotFoundException`` : upon bucket with name not found | +| | ``MalFormedXMLException`` : upon configuration XML in http request validation failure | +| | ``UnexpectedMinioException`` : upon internal errors encountered during the operation | + + + +__Example__ + + +```cs +try +{ + // Set Replication configuration for the bucket + SetBucketReplicationArgs args = new SetBucketReplicationArgs() + .WithBucket(bucketName) + .WithConfiguration(cfg); + await minio.SetBucketReplicationAsync(args); + Console.WriteLine($"Set Replication configuration for bucket {bucketName}."); +} +catch(MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + +### GetBucketReplicationAsync(GetBucketReplicationArgs args) + +`Task GetBucketReplicationAsync(GetBucketReplicationArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Gets Replication configuration of a bucket. + + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _GetBucketReplicationArgs_ | GetBucketReplicationArgs Argument Object with bucket name | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task``: ReplicationConfiguration object which contains the Replication configuration details. | Listed Exceptions: | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``BucketNotFoundException`` : upon bucket with name not found | +| | ``MalFormedXMLException`` : upon configuration XML in http request validation failure | +| | ``UnexpectedMinioException`` : upon internal errors encountered during the operation | + + + +__Example__ + + +```cs +try +{ + // Get Bucket Replication for the bucket + var args = new GetBucketReplicationArgs() + .WithBucket(bucketName); + var cfg = await minio.GetBucketReplicationAsync(args); + Console.WriteLine($"Got Replication configuration for bucket {bucketName}."); +} +catch(MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + + +### RemoveBucketReplicationAsync(RemoveBucketReplicationArgs args) + +`Task RemoveBucketReplicationAsync(RemoveBucketReplicationArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Deletes Replication configuration of a bucket. + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _RemoveBucketReplicationArgs_ | RemoveBucketReplicationArgs Argument Object with bucket name | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task`` | Listed Exceptions: | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``BucketNotFoundException`` : upon bucket with name not found | +| | ``MalFormedXMLException`` : upon configuration XML in http request validation failure | +| | ``UnexpectedMinioException`` : upon internal errors encountered during the operation | + + + +__Example__ + + +```cs +try +{ + // Remove Bucket Replication Configuration for the bucket + var args = new RemoveBucketReplicationArgs() + .WithBucket(bucketName); + await minio.RemoveBucketReplicationAsync(args); + Console.WriteLine($"Removed Replication configuration for bucket {bucketName}."); +} +catch(MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + + +### ListObjectsAsync(ListObjectArgs args) + +`IObservable ListObjectsAsync(ListObjectArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Lists all objects (with version IDs, if existing) in a bucket. + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _ListObjectArgs_ | ListObjectArgs object - encapsulates bucket name, prefix, show recursively, show versions. | | ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | @@ -330,12 +1244,17 @@ __Example__ ```cs try { + // Just list of objects // Check whether 'mybucket' exists or not. bool found = minioClient.BucketExistsAsync("mybucket"); if (found) { // List objects from 'my-bucketname' - IObservable observable = minioClient.ListObjectsAsync("mybucket", "prefix", true); + ListObjectArgs args = new ListObjectArgs() + .WithBucket("mybucket") + .WithPrefix("prefix") + .WithRecursive(true); + IObservable observable = minioClient.ListObjectsAsync(args); IDisposable subscription = observable.Subscribe( item => Console.WriteLine("OnNext: {0}", item.Key), ex => Console.WriteLine("OnError: {0}", ex.Message), @@ -350,13 +1269,190 @@ catch (MinioException e) { Console.WriteLine("Error occurred: " + e); } + +try +{ + // List of objects with version IDs. + // Check whether 'mybucket' exists or not. + bool found = minioClient.BucketExistsAsync("mybucket"); + if (found) + { + // List objects from 'my-bucketname' + ListObjectArgs args = new ListObjectArgs() + .WithBucket("mybucket") + .WithPrefix("prefix") + .WithRecursive(true) + .WithVersions(true) + IObservable observable = minioClient.ListObjectsAsync(args, true); + IDisposable subscription = observable.Subscribe( + item => Console.WriteLine("OnNext: {0} - {1}", item.Key, item.VersionId), + ex => Console.WriteLine("OnError: {0}", ex.Message), + () => Console.WriteLine("OnComplete: {0}")); + } + else + { + Console.WriteLine("mybucket does not exist"); + } +} +catch (MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} + +``` + + + + +### SetObjectLockConfigurationAsync(SetObjectLockConfigurationArgs args) + +`Task SetObjectLockConfigurationAsync(SetObjectLockConfigurationArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Sets object-lock configuration in a bucket. + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _SetObjectLockConfigurationArgs_ | SetObjectLockConfigurationArgs Argument Object with bucket, lock configuration to set | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task`` | Listed Exceptions: | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``BucketNotFoundException`` : upon bucket with name not found | +| | ``MalFormedXMLException`` : upon configuration XML in http request validation failure | +| | ``UnexpectedMinioException`` : upon internal errors encountered during the operation | + + + +__Example__ + + +```cs +try +{ + ObjectLockConfiguration config = = new ObjectLockConfiguration(RetentionMode.GOVERNANCE, 35); + // Set Object Lock Configuration for the bucket + SetObjectLockConfigurationArgs args = new SetObjectLockConfigurationArgs() + .WithBucket(bucketName) + .WithLockConfiguration(config); + await minio.SetObjectLockConfigurationAsync(args); + Console.WriteLine($"Set Object lock configuration to bucket {bucketName}."); +} +catch(MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + + +### GetObjectLockConfigurationAsync(GetObjectLockConfigurationArgs args) + +`Task GetObjectLockConfigurationAsync(GetObjectLockConfigurationArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Gets object-lock configuration of a bucket. + + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _GetObjectLockConfigurationArgs_ | GetObjectLockConfigurationArgs Argument Object with bucket name | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task``: ObjectLockConfiguration object which containing lock-enabled status & Object lock rule. | Listed Exceptions: | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``BucketNotFoundException`` : upon bucket with name not found | +| | ``MalFormedXMLException`` : upon configuration XML in http request validation failure | +| | ``UnexpectedMinioException`` : upon internal errors encountered during the operation | + + + +__Example__ + + +```cs +try +{ + // Get the Object Lock Configuration for the bucket + var args = new GetObjectLockConfigurationArgs() + .WithBucket(bucketName); + var config = await minio.GetObjectLockConfigurationAsync(args); + Console.WriteLine($"Object lock configuration on bucket {bucketName} is : " + config.ObjectLockEnabled); +} +catch(MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + + +### RemoveObjectLockConfigurationAsync(RemoveObjectLockConfigurationArgs args) + +`Task RemoveObjectLockConfigurationAsync(RemoveObjectLockConfigurationArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Removes object-lock configuration on a bucket. + + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _RemoveObjectLockConfigurationArgs_ | RemoveObjectLockConfigurationArgs Argument Object with bucket name | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task`` | Listed Exceptions: | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``BucketNotFoundException`` : upon bucket with name not found | +| | ``MalFormedXMLException`` : upon configuration XML in http request validation failure | +| | ``UnexpectedMinioException`` : upon internal errors encountered during the operation | + + + +__Example__ + + +```cs +try +{ + // Remove Object Lock Configuration on the bucket + var args = new RemoveObjectLockConfigurationArgs() + .WithBucket(bucketName); + await minio.RemoveObjectLockConfigurationAsync(args); + Console.WriteLine($"Removed Object lock configuration on bucket {bucketName}."); +} +catch(MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} + ``` -### ListIncompleteUploads(string bucketName, string prefix, bool recursive) +### ListIncompleteUploads(ListIncompleteUploadsArgs args) -`IObservable ListIncompleteUploads(string bucketName, string prefix, bool recursive, CancellationToken cancellationToken = default(CancellationToken))` +`IObservable ListIncompleteUploads(ListIncompleteUploadsArgs args, CancellationToken cancellationToken = default(CancellationToken))` Lists partially uploaded objects in a bucket. @@ -366,9 +1462,7 @@ __Parameters__ |Param | Type | Description | |:--- |:--- |:--- | -| ``bucketName`` | _string_ | Name of the bucket | -| ``prefix`` | _string_ | Prefix string. List objects whose name starts with ``prefix`` | -| ``recursive`` | _bool_ | when false, emulates a directory structure where each listing returned is either a full object or part of the object's key up to the first '/'. All objects with the same prefix up to the first '/' will be merged into one entry | +| ``args`` | _ListIncompleteUploadsArgs_ | ListIncompleteUploadsArgs object - encapsulates bucket name, prefix, show recursively. | | ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | @@ -388,7 +1482,11 @@ try if (found) { // List all incomplete multipart upload of objects in 'mybucket' - IObservable observable = minioClient.ListIncompleteUploads("mybucket", "prefix", true); + ListIncompleteUploadsArgs listArgs = new ListIncompleteUploadsArgs() + .WithBucket("mybucket") + .WithPrefix("prefix") + .WithRecursive(true); + IObservable observable = minioClient.ListIncompleteUploads(listArgs); IDisposable subscription = observable.Subscribe( item => Console.WriteLine("OnNext: {0}", item.Key), ex => Console.WriteLine("OnError: {0}", ex.Message), @@ -407,9 +1505,9 @@ catch (MinioException e) -### ListenBucketNotificationsAsync(string bucketName, IList events, string prefix = "", string suffix = "") +### ListenBucketNotificationsAsync(ListenBucketNotificationsArgs args) -`IObservable ListenBucketNotificationsAsync(string bucketName, IList events, string prefix = "", string suffix = "", CancellationToken cancellationToken = default(CancellationToken))` +`IObservable ListenBucketNotificationsAsync(ListenBucketNotificationsArgs args, CancellationToken cancellationToken = default(CancellationToken))` Subscribes to bucket change notifications (a Minio-only extension) @@ -418,10 +1516,7 @@ __Parameters__ |Param | Type | Description | |:--- |:--- |:--- | -| ``bucketName`` | _string_ | Bucket to get notifications from | -| ``events`` | _IList< EventType >_ | Events to listen for | -| ``prefix`` | _string_ | Filter keys starting with this prefix | -| ``suffix`` | _string_ | Filter keys ending with this suffix | +| ``args`` | _ListenBucketNotificationsArgs_ | ListenBucketNotificationsArgs object - encapsulates bucket name, list of events, prefix, suffix. | | ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | @@ -439,7 +1534,12 @@ try var events = new List { EventType.ObjectCreatedAll }; var prefix = null; var suffix = null; - IObservable observable = minioClient.ListenBucketNotificationsAsync(bucketName, events, prefix, suffix); + ListenBucketNotificationsArgs args = new ListenBucketNotificationsArgs() + .WithBucket(bucketName) + .WithEvents(events) + .WithPrefix(prefix) + .WithSuffix(suffix); + IObservable observable = minioClient.ListenBucketNotificationsAsync(args); IDisposable subscription = observable.Subscribe( notification => Console.WriteLine($"Notification: {notification.json}"), @@ -454,8 +1554,8 @@ catch (MinioException e) ``` -### GetPolicyAsync(string bucketName) -`Task GetPolicyAsync(string bucketName, CancellationToken cancellationToken = default(CancellationToken))` +### GetPolicyAsync(GetPolicyArgs args) +`Task GetPolicyAsync(GetPolicyArgs args, CancellationToken cancellationToken = default(CancellationToken))` Get bucket policy. @@ -464,7 +1564,7 @@ __Parameters__ |Param | Type | Description | |:--- |:--- |:--- | -| ``bucketName`` | _string_ | Name of the bucket. | +| ``args`` | _GetPolicyArgs_ | GetPolicyArgs object encapsulating bucket name. | | ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | @@ -485,8 +1585,10 @@ __Example__ ```cs try { - String policyJson = await minioClient.GetPolicyAsync("myBucket"); - Console.WriteLine("Current policy: " + policy.GetType().ToString()); + GetPolicyArgs args = new GetPolicyArgs() + .WithBucket("myBucket"); + String policyJson = await minioClient.GetPolicyAsync(args); + Console.WriteLine("Current policy: " + policyJson); } catch (MinioException e) { @@ -495,8 +1597,8 @@ catch (MinioException e) ``` -### SetPolicyAsync(string bucketName, string policyJson) -`Task SetPolicyAsync(string bucketName, string policyJson, CancellationToken cancellationToken = default(CancellationToken))` +### SetPolicyAsync(SetPolicyArgs args) +`Task SetPolicyAsync(SetPolicyArgs args, CancellationToken cancellationToken = default(CancellationToken))` Set policy on bucket. @@ -504,8 +1606,7 @@ __Parameters__ |Param | Type | Description | |:--- |:--- |:--- | -| ``bucketName`` | _string_ | Name of the bucket | -| ``policyJson`` | _string_ | Policy as a json string | +| ``args`` | _SetPolicyArgs_ | SetPolicyArgs object encapsulating bucket name, Policy as a json string. | | ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | @@ -526,7 +1627,10 @@ __Example__ try { string policyJson = $@"{{""Version"":""2012-10-17"",""Statement"":[{{""Action"":[""s3:GetBucketLocation""],""Effect"":""Allow"",""Principal"":{{""AWS"":[""*""]}},""Resource"":[""arn:aws:s3:::{bucketName}""],""Sid"":""""}},{{""Action"":[""s3:ListBucket""],""Condition"":{{""StringEquals"":{{""s3:prefix"":[""foo"",""prefix/""]}}}},""Effect"":""Allow"",""Principal"":{{""AWS"":[""*""]}},""Resource"":[""arn:aws:s3:::{bucketName}""],""Sid"":""""}},{{""Action"":[""s3:GetObject""],""Effect"":""Allow"",""Principal"":{{""AWS"":[""*""]}},""Resource"":[""arn:aws:s3:::{bucketName}/foo*"",""arn:aws:s3:::{bucketName}/prefix/*""],""Sid"":""""}}]}}"; - await minioClient.SetPolicyAsync("myBucket", policyJson); + SetPolicyArgs args = new SetPolicyArgs() + .WithBucket("myBucket") + .WithPolicy(policyJson); + await minioClient.SetPolicyAsync(args); } catch (MinioException e) { @@ -536,8 +1640,8 @@ catch (MinioException e) -### SetBucketNotificationAsync(string bucketName, BucketNotification notification) -`Task SetBucketNotificationAsync(string bucketName, BucketNotification notification, CancellationToken cancellationToken = default(CancellationToken))` +### SetBucketNotificationAsync(SetBucketNotificationsArgs args) +`Task SetBucketNotificationAsync(SetBucketNotificationsArgs args, CancellationToken cancellationToken = default(CancellationToken))` Sets notification configuration for a given bucket @@ -545,8 +1649,7 @@ __Parameters__ |Param | Type | Description | |:--- |:--- |:--- | -| ``bucketName`` | _string_ | Name of the bucket | -| ``notification`` | _BucketNotification_ | Notifications to apply | +| ``args`` | _SetBucketNotificationsArgs_ | SetBucketNotificationsArgs object encapsulating bucket name, notification configuration object. | | ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | @@ -578,9 +1681,11 @@ try queueConfiguration.AddEvents(new List() { EventType.ObjectCreatedCompleteMultipartUpload }); notification.AddQueue(queueConfiguration); - await minio.SetBucketNotificationsAsync(bucketName, - notification); - Console.WriteLine("Notifications set for the bucket " + bucketName + " successfully"); + SetBucketNotificationsArgs args = new SetBucketNotificationsArgs() + .WithBucket(bucketName) + .WithBucketNotificationConfiguration(notification); + await minio.SetBucketNotificationsAsync(args); + Console.WriteLine("Notifications set for the bucket " + args.BucketName + " successfully"); } catch (MinioException e) { @@ -589,8 +1694,8 @@ catch (MinioException e) ``` -### GetBucketNotificationAsync(string bucketName) -`Task GetBucketNotificationAsync(string bucketName, CancellationToken cancellationToken = default(CancellationToken))` +### GetBucketNotificationAsync(GetBucketNotificationsArgs args) +`Task GetBucketNotificationAsync(GetBucketNotificationsArgs args, CancellationToken cancellationToken = default(CancellationToken))` Get bucket notification configuration @@ -599,7 +1704,7 @@ __Parameters__ |Param | Type | Description | |:--- |:--- |:--- | -| ``bucketName`` | _string_ | Name of the bucket. | +| ``args`` | _GetBucketNotificationsArgs_ | GetBucketNotificationsArgs object encapsulating bucket name. | | ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | @@ -620,7 +1725,9 @@ __Example__ ```cs try { - BucketNotification notifications = await minioClient.GetBucketNotificationAsync(bucketName); + GetBucketNotificationsArgs args = new GetBucketNotificationsArgs() + .WithBucket(bucketName); + BucketNotification notifications = await minioClient.GetBucketNotificationAsync(args); Console.WriteLine("Notifications is " + notifications.ToXML()); } catch (MinioException e) @@ -630,8 +1737,8 @@ catch (MinioException e) ``` -### RemoveAllBucketNotificationsAsync(string bucketName) -`Task RemoveAllBucketNotificationsAsync(string bucketName, CancellationToken cancellationToken = default(CancellationToken))` +### RemoveAllBucketNotificationsAsync(RemoveAllBucketNotificationsArgs args) +`Task RemoveAllBucketNotificationsAsync(RemoveAllBucketNotificationsArgs args, CancellationToken cancellationToken = default(CancellationToken))` Remove all notification configurations set on the bucket @@ -640,7 +1747,7 @@ __Parameters__ |Param | Type | Description | |:--- |:--- |:--- | -| ``bucketName`` | _string_ | Name of the bucket. | +| ``args`` | _RemoveAllBucketNotificationsArgs_ | RemoveAllBucketNotificationsArgs args encapsulating the bucket name. | | ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | @@ -661,7 +1768,9 @@ __Example__ ```cs try { - await minioClient.RemoveAllBucketNotificationsAsync(bucketName); + RemoveAllBucketNotificationsArgs args = new RemoveAllBucketNotificationsArgs() + .WithBucket(bucketName); + await minioClient.RemoveAllBucketNotificationsAsync(args); Console.WriteLine("Notifications successfully removed from the bucket " + bucketName); } catch (MinioException e) @@ -673,11 +1782,11 @@ catch (MinioException e) ## 3. Object operations -### GetObjectAsync(string bucketName, string objectName, Action callback, ServerSideEncryption sse) +### GetObjectAsync(GetObjectArgs args, ServerSideEncryption sse) -`Task GetObjectAsync(string bucketName, string objectName, Action callback, ServerSideEncryption sse = null, CancellationToken cancellationToken = default(CancellationToken))` +`Task GetObjectAsync(GetObjectArgs args, ServerSideEncryption sse = null, CancellationToken cancellationToken = default(CancellationToken))` -Downloads an object as a stream. +Downloads an object. __Parameters__ @@ -685,10 +1794,7 @@ __Parameters__ |Param | Type | Description | |:--- |:--- |:--- | -| ``bucketName`` | _string_ | Name of the bucket | -| ``objectName`` | _string_ | Object name in the bucket | -| ``callback`` | _Action_ | Call back to process stream | -| ``sse`` | _ServerSideEncryption_ | Server-side encryption option | Optional parameter. Defaults to null | +| ``args`` | _GetObjectArgs_ | GetObjectArgs Argument Object encapsulating bucket, object names, version Id, ServerSideEncryption object, offset, length | | ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | @@ -700,167 +1806,121 @@ __Parameters__ | | ``InternalClientException`` : upon internal library error. | -__Example__ +__Examples__ ```cs +//1. With Bucket & Object names. try { // Check whether the object exists using statObject(). // If the object is not found, statObject() throws an exception, // else it means that the object exists. // Execution is successful. - await minioClient.StatObjectAsync("mybucket", "myobject"); + StatObjectArgs statObjectArgs = new StatObjectArgs() + .WithBucket("mybucket") + .WithObject("myobject"); + await minioClient.StatObjectAsync(statObjectArgs); // Get input stream to have content of 'my-objectname' from 'my-bucketname' - await minioClient.GetObjectAsync("mybucket", "myobject", - (stream) => - { - stream.CopyTo(Console.OpenStandardOutput()); - }); + GetObjectArgs getObjectArgs = new GetObjectArgs() + .WithBucket("mybucket") + .WithObject("myobject") + .WithCallbackStream((stream) => + { + stream.CopyTo(Console.OpenStandardOutput()); + }); + await minioClient.GetObjectAsync(getObjectArgs); } catch (MinioException e) { Console.WriteLine("Error occurred: " + e); } -``` - - -### GetObjectAsync(string bucketName, string objectName, long offset, long length, Action callback, ServerSideEncryption sse) - -`Task GetObjectAsync(string bucketName, string objectName, long offset, long length, Action callback, ServerSideEncryption sse = null, CancellationToken cancellationToken = default(CancellationToken))` - -Downloads the specified range bytes of an object as a stream.Both offset and length are required. - - -__Parameters__ - - -|Param | Type | Description | -|:--- |:--- |:--- | -| ``bucketName`` | _string_ | Name of the bucket. | -| ``objectName`` | _string_ | Object name in the bucket. | -| ``offset``| _long_ | Offset of the object from where stream will start | -| ``length``| _long_| Length of the object to read in from the stream | -| ``callback`` | _Action_ | Call back to process stream | -| ``sse`` | _ServerSideEncryption_ | Server-side encryption option | Optional parameter. Defaults to null | -| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | - - -| Return Type | Exceptions | -|:--- |:--- | -| ``Task``: Task callback returns an InputStream containing the object data. | Listed Exceptions: | -| | ``InvalidBucketNameException`` : upon invalid bucket name. | -| | ``ConnectionException`` : upon connection error. | -| | ``InternalClientException`` : upon internal library error. | - - -__Example__ - - -```cs -try -{ + // 2. With Offset Length specifying a range of bytes & the object as a stream. + try + { // Check whether the object exists using statObject(). // If the object is not found, statObject() throws an exception, // else it means that the object exists. // Execution is successful. - await minioClient.StatObjectAsync("mybucket", "myobject"); + StatObjectArgs statObjectArgs = new StatObjectArgs() + .WithBucket("mybucket") + .WithObject("myobject"); + await minioClient.StatObjectAsync(statObjectArgs); // Get input stream to have content of 'my-objectname' from 'my-bucketname' - await minioClient.GetObjectAsync("mybucket", "myobject", 1024L, 10L, - (stream) => - { - stream.CopyTo(Console.OpenStandardOutput()); - }); + GetObjectArgs getObjectArgs = new GetObjectArgs() + .WithBucket("mybucket") + .WithObject("myobject") + .WithOffset(1024L) + .WithObjectSize(10L) + .WithCallbackStream((stream) => + { + stream.CopyTo(Console.OpenStandardOutput()); + }); + await minioClient.GetObjectAsync(getObjectArgs); } catch (MinioException e) { Console.WriteLine("Error occurred: " + e); } -``` - -### GetObjectAsync(String bucketName, String objectName, String fileName, ServerSideEncryption sse) - -`Task GetObjectAsync(string bucketName, string objectName, string fileName, ServerSideEncryption sse = null, CancellationToken cancellationToken = default(CancellationToken))` - -Downloads and saves the object as a file in the local filesystem. - - -__Parameters__ - - -|Param | Type | Description | -|:--- |:--- |:--- | -| ``bucketName`` | _String_ | Name of the bucket | -| ``objectName`` | _String_ | Object name in the bucket | -| ``fileName`` | _String_ | File name | -| ``sse`` | _ServerSideEncryption_ | Server-side encryption option | Optional parameter. Defaults to null | -| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | - - -| Return Type | Exceptions | -|:--- |:--- | -| ``Task `` | Listed Exceptions: | -| | ``InvalidBucketNameException`` : upon invalid bucket name | -| | ``ConnectionException`` : upon connection error | -| | ``InternalClientException`` : upon internal library error | - -__Example__ - -```cs -try -{ + //3. Downloads and saves the object as a file in the local filesystem. + try + { // Check whether the object exists using statObjectAsync(). // If the object is not found, statObjectAsync() throws an exception, // else it means that the object exists. // Execution is successful. - await minioClient.StatObjectAsync("mybucket", "myobject"); + StatObjectArgs statObjectArgs = new StatObjectArgs() + .WithBucket("mybucket") + .WithObject("myobject"); + await minioClient.StatObjectAsync(statObjectArgs); // Gets the object's data and stores it in photo.jpg - await minioClient.GetObjectAsync("mybucket", "myobject", "photo.jpg"); + GetObjectArgs getObjectArgs = new GetObjectArgs() + .WithBucket("mybucket") + .WithObject("myobject") + .WithFileName("photo.jpg"); + await minioClient.GetObjectAsync(getObjectArgs); } catch (MinioException e) { Console.WriteLine("Error occurred: " + e); } + ``` + -### PutObjectAsync(string bucketName, string objectName, Stream data, long size, string contentType, ServerSideEncryption sse) +### PutObjectAsync(PutObjectArgs args) -` Task PutObjectAsync(string bucketName, string objectName, Stream data, long size, string contentType, Dictionary metaData = null, ServerSideEncryption sse = null, CancellationToken cancellationToken = default(CancellationToken))` +` Task PutObjectAsync(PutObjectArgs args, CancellationToken cancellationToken = default(CancellationToken))` -Uploads contents from a stream to objectName. - +PutObjectAsync: Uploads object from a file or stream. __Parameters__ |Param | Type | Description | |:--- |:--- |:--- | -| ``bucketName`` | _string_ | Name of the bucket | -| ``objectName`` | _string_ | Object name in the bucket | -| ``data`` | _Stream_ | Stream to upload | -| ``size`` | _long_ | size of stream | -| ``contentType`` | _string_ | Content type of the file. Defaults to "application/octet-stream" | -| ``metaData`` | _Dictionary_ | Dictionary of metadata headers. Defaults to null. | -| ``sse`` | _ServerSideEncryption_ | Server-side encryption option | Optional parameter. Defaults to null | - +| ``args`` | _PutObjectArgs_ | Arguments object - bucket name, object name, file name, object data stream, object size, content type, object metadata, SSE. etc. | | ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | | Return Type | Exceptions | |:--- |:--- | | ``Task`` | Listed Exceptions: | -| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``InvalidObjectNameException`` : upon invalid object name | | | ``ConnectionException`` : upon connection error | | | ``InternalClientException`` : upon internal library error | | | ``EntityTooLargeException``: upon proposed upload size exceeding max allowed | | | ``UnexpectedShortReadException``: data read was shorter than size of input buffer | | | ``ArgumentNullException``: upon null input stream | +| | ``InvalidOperationException``: upon input value to PutObjectArgs being invalid | __Example__ @@ -871,18 +1931,17 @@ The maximum size of a single object is limited to 5TB. putObject transparently u ```cs try { - byte[] bs = File.ReadAllBytes(fileName); - System.IO.MemoryStream filestream = new System.IO.MemoryStream(bs); - // Specify SSE-C encryption options Aes aesEncryption = Aes.Create(); aesEncryption.KeySize = 256; aesEncryption.GenerateKey(); var ssec = new SSEC(aesEncryption.Key); - await minio.PutObjectAsync("mybucket", - "island.jpg", - filestream, - filestream.Length, - "application/octet-stream", ssec); + PutObjectArgs putObjectArgs = new PutObjectArgs() + .WithBucket("mybucket") + .WithObject("island.jpg") + .WithFilename("/mnt/photos/island.jpg") + .WithContentType("application/octet-stream") + .WithServerSideEncryption(ssec); + await minio.PutObjectAsync(putObjectArgs); Console.WriteLine("island.jpg is uploaded successfully"); } catch(MinioException e) @@ -891,59 +1950,11 @@ catch(MinioException e) } ``` - -### PutObjectAsync(string bucketName, string objectName, string filePath, string contentType=null, ServerSideEncryption sse) -` Task PutObjectAsync(string bucketName, string objectName, string filePath, string contentType = null, Dictionary metaData = null, ServerSideEncryption sse = null, CancellationToken cancellationToken = default(CancellationToken))` - - -Uploads contents from a file to objectName. - - - -__Parameters__ - -|Param | Type | Description | -|:--- |:--- |:--- | -| ``bucketName`` | _string_ | Name of the bucket | -| ``objectName`` | _string_ | Object name in the bucket | -| ``fileName`` | _string_ | File to upload | -| ``contentType`` | _string_ | Content type of the file. Defaults to " | -| ``metadata`` | _Dictionary_ | Dictionary of meta data headers and their values.Defaults to null.| -| ``sse`` | _ServerSideEncryption_ | Server-side encryption option | Optional parameter. Defaults to null | - -| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | - - -| Return Type | Exceptions | -|:--- |:--- | -| ``Task`` | Listed Exceptions: | -| | ``InvalidBucketNameException`` : upon invalid bucket name | -| | ``ConnectionException`` : upon connection error | -| | ``InternalClientException`` : upon internal library error | -| | ``EntityTooLargeException``: upon proposed upload size exceeding max allowed | - -__Example__ - - -The maximum size of a single object is limited to 5TB. putObject transparently uploads objects larger than 5MiB in multiple parts. Uploaded data is carefully verified using MD5SUM signatures. - - -```cs -try -{ - await minio.PutObjectAsync("mybucket", "island.jpg", "/mnt/photos/island.jpg", contentType: "application/octet-stream"); - Console.WriteLine("island.jpg is uploaded successfully"); -} -catch(MinioException e) -{ - Console.WriteLine("Error occurred: " + e); -} -``` -### StatObjectAsync(string bucketName, string objectName, ServerSideEncryption sse) +### StatObjectAsync(StatObjectArgs args) -`Task StatObjectAsync(string bucketName, string objectName, ServerSideEncryption sse = null, CancellationToken cancellationToken = default(CancellationToken))` +`Task StatObjectAsync(StatObjectArgs args, CancellationToken cancellationToken = default(CancellationToken))` Gets metadata of an object. @@ -953,9 +1964,7 @@ __Parameters__ |Param | Type | Description | |:--- |:--- |:--- | -| ``bucketName`` | _string_ | Name of the bucket | -| ``objectName`` | _string_ | Object name in the bucket | -| ``sse`` | _ServerSideEncryption_ | Server-side encryption option | Optional parameter. Defaults to null | +| ``args`` | _StatObjectArgs_ | StatObjectArgs Argument Object with bucket, object names & server side encryption object | | ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | @@ -975,7 +1984,10 @@ __Example__ try { // Get the metadata of the object. - ObjectStat objectStat = await minioClient.StatObjectAsync("mybucket", "myobject"); + StatObjectArgs statObjectArgs = new StatObjectArgs() + .WithBucket("mybucket") + .WithObject("myobject"); + ObjectStat objectStat = await minioClient.StatObjectAsync(statObjectArgs); Console.WriteLine(objectStat); } catch(MinioException e) @@ -985,9 +1997,9 @@ catch(MinioException e) ``` -### CopyObjectAsync(string bucketName, string objectName, string destBucketName, string destObjectName = null, CopyConditions copyConditions = null, Dictionary metadata = null, ServerSideEncryption sseSrc = null, ServerSideEncryption sseDest = null) +### CopyObjectAsync(CopyObjectArgs args) -*`Task CopyObjectAsync(string bucketName, string objectName, string destBucketName, string destObjectName = null, CopyConditions copyConditions = null, Dictionary metadata = null, ServerSideEncryption sseSrc = null, ServerSideEncryption sseDest = null, CancellationToken cancellationToken = default(CancellationToken))`* +*`Task CopyObjectAsync(CopyObjectArgs args, CancellationToken cancellationToken = default(CancellationToken))`* Copies content from objectName to destObjectName. @@ -997,21 +2009,19 @@ __Parameters__ |Param | Type | Description | |:--- |:--- |:--- | -| ``bucketName`` | _string_ | Name of the source bucket | -| ``objectName`` | _string_ | Object name in the source bucket to be copied | -| ``destBucketName`` | _string_ | Destination bucket name | -| ``destObjectName`` | _string_ | Destination object name to be created, if not provided defaults to source object name| -| ``copyConditions`` | _CopyConditions_ | Map of conditions useful for applying restrictions on copy operation| -| ``metadata`` | _Dictionary_ | Dictionary of meta data headers and their values on the destination side.Defaults to null.| -| ``sseSrc`` | _ServerSideEncryption_ | Server-side encryption option for source object | Optional parameter. Defaults to null | -| ``sseDest`` | _ServerSideEncryption_ | Server-side encryption option for destination object| Optional parameter. Defaults to null | +| ``args`` | _CopyObjectArgs_ | Arguments object - bucket name, object name, destination bucket name, destination object name, copy conditions, metadata, Source SSE, Destination SSE. etc. | | ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | | Return Type | Exceptions | |:--- |:--- | | ``Task`` | Listed Exceptions: | -| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``InvalidObjectNameException`` : upon invalid object name | +| | ``BucketNotFoundException`` : upon bucket with name not found | +| | ``ObjectNotFoundException`` : upon object with name not found | +| | ``MalFormedXMLException`` : upon configuration XML in http request validation failure | | | ``ConnectionException`` : upon connection error | | | ``InternalClientException`` : upon internal library error | | | ``ArgumentException`` : upon missing bucket/object names | @@ -1044,10 +2054,11 @@ catch(MinioException e) } ``` - -### RemoveObjectAsync(string bucketName, string objectName) -`Task RemoveObjectAsync(string bucketName, string objectName, CancellationToken cancellationToken = default(CancellationToken))` + +### RemoveObjectAsync(RemoveObjectArgs args) + +`Task RemoveObjectAsync(RemoveObjectArgs args, CancellationToken cancellationToken = default(CancellationToken))` Removes an object. @@ -1056,8 +2067,7 @@ __Parameters__ |Param | Type | Description | |:--- |:--- |:--- | -| ``bucketName`` | _string_ | Name of the bucket | -| ``objectName`` | _string_ | Object name in the bucket | +| ``args`` | _RemoveObjectArgs_ | Arguments Object. | | ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | | Return Type | Exceptions | @@ -1073,31 +2083,50 @@ __Example__ ```cs +// 1. Remove object myobject from the bucket mybucket. try { - // Remove objectname from the bucket my-bucketname. - await minioClient.RemoveObjectAsync("mybucket", "myobject"); + RemoveObjectArgs rmArgs = new RemoveObjectArgs() + .WithBucket("mybucket") + .WithObject("myobject"); + await minioClient.RemoveObjectAsync(args); Console.WriteLine("successfully removed mybucket/myobject"); } catch (MinioException e) { Console.WriteLine("Error: " + e); } + +// 2. Remove one version of object myobject with versionID from mybucket. +try +{ + RemoveObjectArgs rmArgs = new RemoveObjectArgs() + .WithBucket("mybucket") + .WithObject("myobject") + .WithVersionId("versionId"); + await minioClient.RemoveObjectAsync(args); + Console.WriteLine("successfully removed mybucket/myobject{versionId}"); +} +catch (MinioException e) +{ + Console.WriteLine("Error: " + e); +} + ``` -### RemoveObjectAsync(string bucketName, IEnumerable objectsList) +### RemoveObjectsAsync(RemoveObjectsArgs args) -`Task> RemoveObjectAsync(string bucketName, IEnumerable objectsList, CancellationToken cancellationToken = default(CancellationToken))` +`Task> RemoveObjectsAsync(RemoveObjectsArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Removes a list of objects or object versions. -Removes a list of objects. __Parameters__ |Param | Type | Description | |:--- |:--- |:--- | -| ``bucketName`` | _string_ | Name of the bucket | -| ``objectsList`` | _IEnumerable_ | IEnumerable of Object names | +| ``args`` | _RemoveObjectsArgs_ | Arguments Object - bucket name, List of Objects to be deleted or List of Tuples with Tuple(object name, List of version IDs). | | ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | | Return Type | Exceptions | @@ -1113,14 +2142,49 @@ __Example__ ```cs +// 1. Remove list of objects in objectNames from the bucket bucketName. try { + string bucketName = "mybucket" List objectNames = new LinkedList(); objectNames.add("my-objectname1"); objectNames.add("my-objectname2"); objectNames.add("my-objectname3"); - // Remove list of objects in objectNames from the bucket bucketName. - IObservable observable = await minio.RemoveObjectAsync(bucketName, objectNames); + RemoveObjectsAsync rmArgs = new RemoveObjectsAsync() + .WithBucket(bucketName) + .WithObjects(objectNames); + IObservable observable = await minio.RemoveObjectAsync(rmArgs); + IDisposable subscription = observable.Subscribe( + deleteError => Console.WriteLine("Object: {0}", deleteError.Key), + ex => Console.WriteLine("OnError: {0}", ex), + () => + { + Console.WriteLine("Removed objects from " + bucketName + "\n"); + }); +} +catch (MinioException e) +{ + Console.WriteLine("Error: " + e); +} + +// 2. Remove list of objects (only specific versions mentioned in Version ID list) from the bucket bucketName +try +{ + string bucketName = "mybucket"; + string objectName = "myobject1"; + List versionIDs = new List(); + versionIDs.Add("abcobject1version1dce"); + versionIDs.Add("abcobject1version2dce"); + versionIDs.Add("abcobject1version3dce"); + List> objectsVersions = new List>(); + objectsVersions.Add(new Tuple>(objectName, versionIDs)); + objectsVersions.Add(new Tuple("myobject2" "abcobject2version1dce")); + objectsVersions.Add(new Tuple("myobject2", "abcobject2version2dce")); + objectsVersions.Add(new Tuple("myobject2", "abcobject2version3dce")); + RemoveObjectsAsync rmArgs = new RemoveObjectsAsync() + .WithBucket(bucketName) + .WithObjectsVersions(objectsVersions); + IObservable observable = await minio.RemoveObjectsAsync(rmArgs); IDisposable subscription = observable.Subscribe( deleteError => Console.WriteLine("Object: {0}", deleteError.Key), ex => Console.WriteLine("OnError: {0}", ex), @@ -1133,12 +2197,14 @@ catch (MinioException e) { Console.WriteLine("Error: " + e); } + ``` - -### RemoveIncompleteUploadAsync(string bucketName, string objectName) -`Task RemoveIncompleteUploadAsync(string bucketName, string objectName, CancellationToken cancellationToken = default(CancellationToken))` + +### RemoveIncompleteUploadAsync(RemoveIncompleteUploadArgs args) + +`Task RemoveIncompleteUploadAsync(RemoveIncompleteUploadArgs args, CancellationToken cancellationToken = default(CancellationToken))` Removes a partially uploaded object. @@ -1147,8 +2213,7 @@ __Parameters__ |Param | Type | Description | |:--- |:--- |:--- | -| ``bucketName`` | _string_ | Name of the bucket | -| ``objectName`` | _string_ | Object name in the bucket | +| ``args`` | _RemoveIncompleteUploadArgs_ | RemoveIncompleteUploadArgs object encapsulating the bucket, object names | | ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | @@ -1167,7 +2232,10 @@ __Example__ try { // Removes partially uploaded objects from buckets. - await minioClient.RemoveIncompleteUploadAsync("mybucket", "myobject"); + RemoveIncompleteUploadArgs args = new RemoveIncompleteUploadArgs() + .WithBucket(bucketName) + .WithObject(objectName); + await minioClient.RemoveIncompleteUploadAsync(args); Console.WriteLine("successfully removed all incomplete upload session of my-bucketname/my-objectname"); } catch(MinioException e) @@ -1177,9 +2245,9 @@ catch(MinioException e) ``` -### SelectObjectContentAsync(string bucketName, string objectName, SelectObjectOptions opts) +### SelectObjectContentAsync(SelectObjectContentArgs args) -`Task SelectObjectContentAsync(string bucketName, string objectName, SelectObjectOptions opts, CancellationToken cancellationToken = default(CancellationToken))` +`Task SelectObjectContentAsync(SelectObjectContentArgs args, CancellationToken cancellationToken = default(CancellationToken))` Downloads an object as a stream. @@ -1189,9 +2257,7 @@ __Parameters__ |Param | Type | Description | |:--- |:--- |:--- | -| ``bucketName`` | _string_ | Name of the bucket | -| ``objectName`` | _string_ | Object name in the bucket | -| ``opts`` | SelectObjectOptions | options for SelectObjectContent async | Required parameter. | +| ``args`` | _SelectObjectContentArgs_ | options for SelectObjectContent async | Required parameter. | | ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | @@ -1235,7 +2301,11 @@ try } }; - var resp = await minio.SelectObjectContentAsync(bucketName, objectName, opts); + SelectObjectContentArgs args = SelectObjectContentArgs() + .WithBucket(bucketName) + .WithObject(objectName) + .WithSelectObjectOptions(opts); + var resp = await minio.SelectObjectContentAsync(args); resp.Payload.CopyTo(Console.OpenStandardOutput()); Console.WriteLine("Bytes scanned:" + resp.Stats.BytesScanned); Console.WriteLine("Bytes returned:" + resp.Stats.BytesReturned); @@ -1251,11 +2321,415 @@ catch (MinioException e) } ``` + + +### SetObjectLegalHoldAsync(SetObjectLegalHoldArgs args) + +`Task SetObjectLegalHoldAsync(SetObjectLegalHoldArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Sets the Legal Hold status of an object. + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _SetObjectLegalHoldArgs_ | SetObjectLegalHoldArgs Argument Object with bucket, object names, version id(optional) | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task`` | Listed Exceptions: | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``InvalidObjectNameException`` : upon invalid object name | +| | ``BucketNotFoundException`` : upon bucket with name not found | +| | ``ObjectNotFoundException`` : upon object with name not found | +| | ``MissingObjectLockConfigurationException`` : upon bucket created with object lock not enabled | +| | ``MalFormedXMLException`` : upon configuration XML in http request validation failure | + + + +__Example__ + + +```cs +try +{ + // Setting WithLegalHold true, sets Legal hold status to ON. + SetObjectLegalHoldArgs args = new SetObjectLegalHoldArgs() + .WithBucket(bucketName) + .WithObject(objectName) + .WithVersionId(versionId) + .WithLegalHold(true); + await minio.SetObjectLegalHoldAsync(args); +} +catch(MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + +### GetObjectLegalHoldAsync(GetObjectLegalHoldArgs args) + +`Task GetObjectLegalHoldAsync(GetObjectLegalHoldArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Gets the Legal Hold status of an object. + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _GetObjectLegalHoldArgs_ | GetObjectLegalHoldArgs Argument Object with bucket, object names, version id(optional) | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task``: True if LegalHold is enabled, false otherwise. | Listed Exceptions: | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``InvalidObjectNameException`` : upon invalid object name | +| | ``BucketNotFoundException`` : upon bucket with name not found | +| | ``ObjectNotFoundException`` : upon object with name not found | +| | ``MissingObjectLockConfigurationException`` : upon bucket created with object lock not enabled | +| | ``MalFormedXMLException`` : upon configuration XML in http request validation failure | + + +__Example__ + + +```cs +try +{ + // Get Legal Hold status a object + var args = new GetObjectLegalHoldArgs() + .WithBucket(bucketName) + .WithObject(objectName) + .WithVersionId(versionId); + bool enabled = await minio.GetObjectLegalHoldAsync(args); + Console.WriteLine("LegalHold Configuration STATUS for " + bucketName + "/" + objectName + + (!string.IsNullOrEmpty(versionId)?" with Version ID " + versionId: " ") + + " : " + (enabled?"ON":"OFF")); +} +catch(MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + +### SetObjectTagsAsync(SetObjectTagsArgs args) + +`Task SetObjectTagsAsync(SetObjectTagsArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Sets tags to a object. + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _SetObjectTagsArgs_ | SetObjectTagsArgs Argument Object with object, tags to set | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task`` | Listed Exceptions: | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``InvalidObjectNameException`` : upon invalid object name | +| | ``BucketNotFoundException`` : upon bucket with name not found | +| | ``ObjectNotFoundException`` : upon object with name not found | +| | ``MalFormedXMLException`` : upon configuration XML in http request validation failure | +| | ``UnexpectedMinioException`` : upon internal errors encountered during the operation | + + + +__Example__ + + +```cs +try +{ + // Set Tags for the object + SetObjectTagsArgs args = new new SetObjectTagsArgs() + .WithBucket(bucketName) + .WithObject(objectName) + .WithTagging(tags); + await minio.SetObjectTagsAsync(args); + Console.WriteLine($"Set tags for object {bucketName}/{objectName}."); +} +catch(MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + +### GetObjectTagsAsync(GetObjectTagsArgs args) + +`Task GetObjectTagsAsync(GetObjectTagsArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Gets tags of a object. + + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _GetObjectTagsArgs_ | GetObjectTagsArgs Argument Object with object name | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task``: Task object which containing tag-value pairs. | Listed Exceptions: | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``InvalidObjectNameException`` : upon invalid object name | +| | ``BucketNotFoundException`` : upon bucket with name not found | +| | ``ObjectNotFoundException`` : upon object with name not found | +| | ``MalFormedXMLException`` : upon configuration XML in http request validation failure | +| | ``UnexpectedMinioException`` : upon internal errors encountered during the operation | + + + +__Example__ + + +```cs +try +{ + // Get Object Tags for the object + var args = new GetObjectTagsArgs() + .WithBucket(bucketName) + .WithObject(objectName); + var tags = await minio.GetObjectTagsAsync(args); + Console.WriteLine($"Got tags for object {bucketName}/{objectName}."); +} +catch(MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + + +### RemoveObjectTagsAsync(RemoveObjectTagsArgs args) + +`Task RemoveObjectTagsAsync(RemoveObjectTagsArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Deletes tags of a object. + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _RemoveObjectTagsArgs_ | RemoveObjectTagsArgs Argument Object with object name | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task`` | Listed Exceptions: | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``InvalidObjectNameException`` : upon invalid object name | +| | ``BucketNotFoundException`` : upon bucket with name not found | +| | ``ObjectNotFoundException`` : upon object with name not found | +| | ``MalFormedXMLException`` : upon configuration XML in http request validation failure | +| | ``UnexpectedMinioException`` : upon internal errors encountered during the operation | + + + +__Example__ + + +```cs +try +{ + // Remove Tags for the object + var args = new RemoveObjectTagsArgs() + .WithBucket(bucketName) + .WithObject(objectName); + await minio.RemoveObjectTagsAsync(args); + Console.WriteLine($"Removed tags for object {bucketName}/{objectName}."); +} +catch(MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + + +### SetObjectRetentionAsync(SetObjectRetentionArgs args) + +`Task SetObjectRetentionAsync(SetObjectRetentionArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Sets retention configuration to an object. + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _SetObjectRetentionArgs_ | SetObjectRetentionArgs Argument Object with bucket, object names, version id(optional) | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task`` | Listed Exceptions: | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``InvalidObjectNameException`` : upon invalid object name | +| | ``BucketNotFoundException`` : upon bucket with name not found | +| | ``ObjectNotFoundException`` : upon object with name not found | +| | ``MissingObjectLockConfigurationException`` : upon bucket created with object lock not enabled | +| | ``MalFormedXMLException`` : upon configuration XML in http request validation failure | + + + +__Example__ + + +```cs +try +{ + // Setting Retention Configuration of the object. + SetObjectRetentionArgs args = new SetObjectRetentionArgs() + .WithBucket(bucketName) + .WithObject(objectName) + .WithRetentionValidDays(numOfDays); + await minio.SetObjectRetentionAsync(args); + Console.WriteLine($"Assigned retention configuration to object {bucketName}/{objectName}"); +} +catch(MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + + +### GetObjectRetentionAsync(GetObjectRetentionArgs args) + +`Task GetObjectRetentionAsync(GetObjectRetentionArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Gets retention configuration of an object. + + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _GetObjectRetentionArgs_ | GetObjectRetentionArgs Argument Object with bucket, object names, version id(optional) | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task``: ObjectRetentionConfiguration object with configuration data. | Listed Exceptions: | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``InvalidObjectNameException`` : upon invalid object name | +| | ``BucketNotFoundException`` : upon bucket with name not found | +| | ``ObjectNotFoundException`` : upon object with name not found | +| | ``MissingObjectLockConfigurationException`` : upon bucket created with object lock not enabled | +| | ``MalFormedXMLException`` : upon configuration XML in http request validation failure | + + +__Example__ + + +```cs +try +{ + // Get Retention configuration of an object + var args = new GetObjectRetentionArgs() + .WithBucket(bucketName) + .WithObject(objectName); + ObjectRetentionConfiguration config = await minio.GetObjectRetentionAsync(args); + Console.WriteLine($"Got retention configuration for object {bucketName}/{objectName}"); +} +catch(MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + + +### ClearObjectRetentionAsync(ClearObjectRetentionArgs args) + +`Task ClearObjectRetentionAsync(ClearObjectRetentionArgs args, CancellationToken cancellationToken = default(CancellationToken))` + +Clears retention configuration to an object. + + +__Parameters__ + + +|Param | Type | Description | +|:--- |:--- |:--- | +| ``args`` | _ClearObjectRetentionArgs_ | ClearObjectRetentionArgs Argument Object with bucket, object names, version id(optional) | +| ``cancellationToken``| _System.Threading.CancellationToken_ | Optional parameter. Defaults to default(CancellationToken) | + + +| Return Type | Exceptions | +|:--- |:--- | +| ``Task`` | Listed Exceptions: | +| | ``AuthorizationException`` : upon access or secret key wrong or not found | +| | ``InvalidBucketNameException`` : upon invalid bucket name | +| | ``InvalidObjectNameException`` : upon invalid object name | +| | ``BucketNotFoundException`` : upon bucket with name not found | +| | ``ObjectNotFoundException`` : upon object with name not found | +| | ``MissingObjectLockConfigurationException`` : upon bucket created with object lock not enabled | +| | ``MalFormedXMLException`` : upon configuration XML in http request validation failure | + + + +__Example__ + + +```cs +try +{ + // Clearing the Retention Configuration of the object. + ClearObjectRetentionArgs args = new ClearObjectRetentionArgs() + .WithBucket(bucketName) + .WithObject(objectName); + await minio.ClearObjectRetentionAsync(args); + Console.WriteLine($"Clears retention configuration to object {bucketName}/{objectName}"); +} +catch(MinioException e) +{ + Console.WriteLine("Error occurred: " + e); +} +``` + + + ## 4. Presigned operations -### PresignedGetObjectAsync(string bucketName, string objectName, int expiresInt, Dictionary reqParams = null, DateTime? reqDate = null); -`Task PresignedGetObjectAsync(string bucketName, string objectName, int expiresInt, Dictionary reqParams = null, DateTime? reqDate = null)` +### PresignedGetObjectAsync(PresignedGetObjectArgs args); +`Task PresignedGetObjectAsync(PresignedGetObjectArgs args)` Generates a presigned URL for HTTP GET operations. Browsers/Mobile clients may point to this URL to directly download objects even if the bucket is private. This presigned URL can have an associated expiration time in seconds after which it is no longer operational. The default expiry is set to 7 days. @@ -1264,11 +2738,7 @@ __Parameters__ |Param | Type | Description | |:--- |:--- |:--- | -| ``bucketName`` | _String_ | Name of the bucket | -| ``objectName`` | _String_ | Object name in the bucket | -| ``expiresInt`` | _Integer_ | Expiry in seconds. Default expiry is set to 7 days. | -| ``reqParams`` | _Dictionary_ | Additional response header overrides supports response-expires, response-content-type, response-cache-control, response-content-disposition.| -| ``reqDate`` | _DateTime?_ | Optional request date and time. Defaults to DateTime.UtcNow if unset.| +| ``args`` | _PresignedGetObjectArgs_ | PresignedGetObjectArgs encapsulating bucket, object names, expiry, response headers & request date | | Return Type | Exceptions | |:--- |:--- | @@ -1284,7 +2754,11 @@ __Example__ ```cs try { - String url = await minioClient.PresignedGetObjectAsync("mybucket", "myobject", 60 * 60 * 24); + PresignedGetObjectArgs args = new PresignedGetObjectArgs() + .WithBucket("mybucket") + .WithObject("myobject") + .WithExpiry(60 * 60 * 24); + String url = await minioClient.PresignedGetObjectAsync(args); Console.WriteLine(url); } catch(MinioException e) @@ -1294,9 +2768,9 @@ catch(MinioException e) ``` -### PresignedPutObjectAsync(string bucketName, string objectName, int expiresInt) +### PresignedPutObjectAsync(PresignedPutObjectArgs args) -`Task PresignedPutObjectAsync(string bucketName, string objectName, int expiresInt)` +`Task PresignedPutObjectAsync(PresignedPutObjectArgs args)` Generates a presigned URL for HTTP PUT operations. Browsers/Mobile clients may point to this URL to upload objects directly to a bucket even if it is private. This presigned URL can have an associated expiration time in seconds after which it is no longer operational. The default expiry is set to 7 days. @@ -1305,9 +2779,7 @@ __Parameters__ |Param | Type | Description | |:--- |:--- |:--- | -| ``bucketName`` | _string_ | Name of the bucket | -| ``objectName`` | _string_ | Object name in the bucket | -| ``expiresInt`` | _int_ | Expiry in seconds. Default expiry is set to 7 days. | +| ``args`` | _PresignedPutObjectArgs_ | PresignedPutObjectArgs arguments object with bucket, object names & expiry | | Return Type | Exceptions | |:--- |:--- | @@ -1323,7 +2795,11 @@ __Example__ ```cs try { - String url = await minioClient.PresignedPutObjectAsync("mybucket", "myobject", 60 * 60 * 24); + PresignedPutObjectArgs args = PresignedPutObjectArgs() + .WithBucket("mybucket") + .WithObject("myobject") + .WithExpiry(60 * 60 * 24); + String url = await minioClient.PresignedPutObjectAsync(args); Console.WriteLine(url); } catch(MinioException e) @@ -1333,9 +2809,9 @@ catch(MinioException e) ``` -### PresignedPostPolicy(PostPolicy policy) +### PresignedPostPolicy(PresignedPostPolicyArgs args) -`Task> PresignedPostPolicyAsync(PostPolicy policy)` +`Task> PresignedPostPolicyAsync(PresignedPostPolicyArgs args)` Allows setting policy conditions to a presigned URL for POST operations. Policies such as bucket name to receive object uploads, key name prefixes, expiry policy may be set. @@ -1344,7 +2820,7 @@ __Parameters__ |Param | Type | Description | |:--- |:--- |:--- | -| ``PostPolicy`` | _PostPolicy_ | Post policy of an object. | +| ``args`` | _PresignedPostPolicyArgs_ | PresignedPostPolicyArgs Arguments object includes bucket, object names & Post policy of an object. | | Return Type | Exceptions | @@ -1369,8 +2845,12 @@ try policy.SetExpires(expiration.AddDays(10)); policy.SetKey("my-objectname"); policy.SetBucket("my-bucketname"); + PresignedPostPolicyArgs args = PresignedPostPolicyArgs() + .WithBucket("my-bucketname") + .WithObject("my-objectname") + .WithPolicy(policy); - Dictionary formData = minioClient.Api.PresignedPostPolicy(policy); + Dictionary formData = minioClient.Api.PresignedPostPolicy(args); string curlCommand = "curl "; foreach (KeyValuePair pair in formData) { diff --git a/source/sdk/java/API.md b/source/sdk/java/API.md index de429753..48430adc 100644 --- a/source/sdk/java/API.md +++ b/source/sdk/java/API.md @@ -1037,7 +1037,11 @@ minioClient.copyObject( CopyObjectArgs.builder() .bucket("my-bucketname") .object("my-objectname") - .srcBucket("my-source-bucketname") + .source( + CopySource.builder() + .bucket("my-source-bucketname") + .object("my-objectname") + .build()) .build()); // Create object "my-objectname" in bucket "my-bucketname" by copying from object @@ -1046,18 +1050,53 @@ minioClient.copyObject( CopyObjectArgs.builder() .bucket("my-bucketname") .object("my-objectname") - .srcBucket("my-source-bucketname") - .srcObject("my-source-objectname") + .source( + CopySource.builder() + .bucket("my-source-bucketname") + .object("my-source-objectname") + .build()) .build()); -// Create object "my-objectname" in bucket "my-bucketname" with server-side encryption by -// copying from object "my-objectname" in bucket "my-source-bucketname". +// Create object "my-objectname" in bucket "my-bucketname" with SSE-KMS server-side +// encryption by copying from object "my-objectname" in bucket "my-source-bucketname". minioClient.copyObject( CopyObjectArgs.builder() .bucket("my-bucketname") .object("my-objectname") - .srcBucket("my-source-bucketname") - .sse(sse) + .source( + CopySource.builder() + .bucket("my-source-bucketname") + .object("my-objectname") + .build()) + .sse(sseKms) // Replace with actual key. + .build()); + +// Create object "my-objectname" in bucket "my-bucketname" with SSE-S3 server-side +// encryption by copying from object "my-objectname" in bucket "my-source-bucketname". +minioClient.copyObject( + CopyObjectArgs.builder() + .bucket("my-bucketname") + .object("my-objectname") + .source( + CopySource.builder() + .bucket("my-source-bucketname") + .object("my-objectname") + .build()) + .sse(sseS3) // Replace with actual key. + .build()); + +// Create object "my-objectname" in bucket "my-bucketname" with SSE-C server-side encryption +// by copying from object "my-objectname" in bucket "my-source-bucketname". +minioClient.copyObject( + CopyObjectArgs.builder() + .bucket("my-bucketname") + .object("my-objectname") + .source( + CopySource.builder() + .bucket("my-source-bucketname") + .object("my-objectname") + .build()) + .sse(ssec) // Replace with actual key. .build()); // Create object "my-objectname" in bucket "my-bucketname" by copying from SSE-C encrypted @@ -1066,20 +1105,27 @@ minioClient.copyObject( CopyObjectArgs.builder() .bucket("my-bucketname") .object("my-objectname") - .srcBucket("my-source-bucketname") - .srcObject("my-source-objectname") - .srcSsec(ssec) + .source( + CopySource.builder() + .bucket("my-source-bucketname") + .object("my-source-objectname") + .ssec(ssec) // Replace with actual key. + .build()) .build()); -// Create object "my-objectname" in bucket "my-bucketname" with custom headers by copying from -// object "my-objectname" in bucket "my-source-bucketname" using conditions. +// Create object "my-objectname" in bucket "my-bucketname" with custom headers conditionally +// by copying from object "my-objectname" in bucket "my-source-bucketname". minioClient.copyObject( CopyObjectArgs.builder() .bucket("my-bucketname") .object("my-objectname") - .srcBucket("my-source-bucketname") - .headers(headers) - .srcMatchETag(etag) + .source( + CopySource.builder() + .bucket("my-source-bucketname") + .object("my-objectname") + .matchETag(etag) // Replace with actual etag. + .build()) + .headers(headers) // Replace with actual headers. .build()); ``` @@ -1234,7 +1280,7 @@ minioClient.downloadObject( DownloadObjectArgs.builder() .bucket("my-bucketname") .object("my-objectname") - .fileName("my-object-file") + .filename("my-object-file") .build()); // Download server-side encrypted object in bucket to given file name @@ -1243,7 +1289,7 @@ minioClient.downloadObject( .bucket("my-bucketname") .object("my-objectname") .ssec(ssec) - .fileName("my-object-file") + .filename("my-object-file") .build()); ``` @@ -1765,7 +1811,7 @@ ObjectStat objectStat = StatObjectArgs.builder() .bucket("my-bucketname") .object("my-objectname") - .versionId(--version-id") + .versionId("version-id") .build()); // Get information of a SSE-C encrypted versioned object. @@ -1774,7 +1820,7 @@ ObjectStat objectStat = StatObjectArgs.builder() .bucket("my-bucketname") .object("my-objectname") - .versionId(--version-id") + .versionId("version-id") .ssec(ssec) .build()); ``` diff --git a/source/sdk/python/API.md b/source/sdk/python/API.md index dee24c9e..d85bbfe0 100644 --- a/source/sdk/python/API.md +++ b/source/sdk/python/API.md @@ -828,7 +828,7 @@ __Example__ ```py config = ObjectLockConfig(GOVERNANCE, 15, DAYS) -client.set_object_lock_condig("my-bucket", config) +client.set_object_lock_config("my-bucket", config) ``` ## 3. Object operations @@ -849,7 +849,7 @@ __Parameters__ | `length` | _int_ | Number of bytes of object data from offset. | | `request_headers` | _dict_ | Any additional headers to be added with GET request. | | `ssec` | _SseCustomerKey_ | Server-side encryption customer key. | -| `version_id` | _str_ |--version-id of the object. | +| `version_id` | _str_ | Version-ID of the object. | | `extra_query_params` | _dict_ | Extra query parameters for advanced usage. | __Return Value__ @@ -869,7 +869,7 @@ finally: response.close() response.release_conn() -# Get data of an object of --version-id. +# Get data of an object of version-ID. try: response = client.get_object( "my-bucket", "my-object", @@ -954,7 +954,7 @@ __Parameters__ | `file_path` | _str_ | Name of file to download. | | `request_headers` | _dict_ | Any additional headers to be added with GET request. | | `ssec` | _SseCustomerKey_ | Server-side encryption customer key. | -| `version_id` | _str_ |--version-id of the object. | +| `version_id` | _str_ | Version-ID of the object. | | `extra_query_params` | _dict_ | Extra query parameters for advanced usage. | | `tmp_file_path` | _str_ | Path to a temporary file. | @@ -970,7 +970,7 @@ __Example__ # Download data of an object. client.fget_object("my-bucket", "my-object", "my-filename") -# Download data of an object of --version-id. +# Download data of an object of version-ID. client.fget_object( "my-bucket", "my-object", "my-filename", version_id="dfbd25b3-abec-4184-a4e8-5a35a5c1174d", @@ -1144,7 +1144,7 @@ result = client.put_object( "my-bucket", "my-object", io.BytesIO(b"hello"), 5, ) print( - "created {0} object; etag: {1},--version-id: {2}".format( + "created {0} object; etag: {1}, version-id: {2}".format( result.object_name, result.etag, result.version_id, ), ) @@ -1157,7 +1157,7 @@ result = client.put_object( "my-bucket", "my-object", data, length=-1, part_size=10*1024*1024, ) print( - "created {0} object; etag: {1},--version-id: {2}".format( + "created {0} object; etag: {1}, version-id: {2}".format( result.object_name, result.etag, result.version_id, ), ) @@ -1168,7 +1168,7 @@ result = client.put_object( content_type="application/csv", ) print( - "created {0} object; etag: {1},--version-id: {2}".format( + "created {0} object; etag: {1}, version-id: {2}".format( result.object_name, result.etag, result.version_id, ), ) @@ -1179,7 +1179,7 @@ result = client.put_object( metadata={"My-Project": "one"}, ) print( - "created {0} object; etag: {1},--version-id: {2}".format( + "created {0} object; etag: {1}, version-id: {2}".format( result.object_name, result.etag, result.version_id, ), ) @@ -1190,7 +1190,7 @@ result = client.put_object( sse=SseCustomerKey(b"32byteslongsecretkeymustprovided"), ) print( - "created {0} object; etag: {1},--version-id: {2}".format( + "created {0} object; etag: {1}, version-id: {2}".format( result.object_name, result.etag, result.version_id, ), ) @@ -1201,7 +1201,7 @@ result = client.put_object( sse=SseKMS("KMS-KEY-ID", {"Key1": "Value1", "Key2": "Value2"}), ) print( - "created {0} object; etag: {1},--version-id: {2}".format( + "created {0} object; etag: {1}, version-id: {2}".format( result.object_name, result.etag, result.version_id, ), ) @@ -1212,7 +1212,7 @@ result = client.put_object( sse=SseS3(), ) print( - "created {0} object; etag: {1},--version-id: {2}".format( + "created {0} object; etag: {1}, version-id: {2}".format( result.object_name, result.etag, result.version_id, ), ) @@ -1230,7 +1230,7 @@ result = client.put_object( legal_hold=True, ) print( - "created {0} object; etag: {1},--version-id: {2}".format( + "created {0} object; etag: {1}, version-id: {2}".format( result.object_name, result.etag, result.version_id, ), ) @@ -1241,7 +1241,7 @@ result = client.put_object( progress=Progress(), ) print( - "created {0} object; etag: {1},--version-id: {2}".format( + "created {0} object; etag: {1}, version-id: {2}".format( result.object_name, result.etag, result.version_id, ), ) @@ -1281,7 +1281,7 @@ result = client.fput_object( "my-bucket", "my-object", "my-filename", ) print( - "created {0} object; etag: {1},--version-id: {2}".format( + "created {0} object; etag: {1}, version-id: {2}".format( result.object_name, result.etag, result.version_id, ), ) @@ -1292,7 +1292,7 @@ result = client.fput_object( content_type="application/csv", ) print( - "created {0} object; etag: {1},--version-id: {2}".format( + "created {0} object; etag: {1}, version-id: {2}".format( result.object_name, result.etag, result.version_id, ), ) @@ -1303,7 +1303,7 @@ result = client.fput_object( metadata={"My-Project": "one"}, ) print( - "created {0} object; etag: {1},--version-id: {2}".format( + "created {0} object; etag: {1}, version-id: {2}".format( result.object_name, result.etag, result.version_id, ), ) @@ -1314,7 +1314,7 @@ result = client.fput_object( sse=SseCustomerKey(b"32byteslongsecretkeymustprovided"), ) print( - "created {0} object; etag: {1},--version-id: {2}".format( + "created {0} object; etag: {1}, version-id: {2}".format( result.object_name, result.etag, result.version_id, ), ) @@ -1325,7 +1325,7 @@ result = client.fput_object( sse=SseKMS("KMS-KEY-ID", {"Key1": "Value1", "Key2": "Value2"}), ) print( - "created {0} object; etag: {1},--version-id: {2}".format( + "created {0} object; etag: {1}, version-id: {2}".format( result.object_name, result.etag, result.version_id, ), ) @@ -1336,7 +1336,7 @@ result = client.fput_object( sse=SseS3(), ) print( - "created {0} object; etag: {1},--version-id: {2}".format( + "created {0} object; etag: {1}, version-id: {2}".format( result.object_name, result.etag, result.version_id, ), ) @@ -1354,7 +1354,7 @@ result = client.fput_object( legal_hold=True, ) print( - "created {0} object; etag: {1},--version-id: {2}".format( + "created {0} object; etag: {1}, version-id: {2}".format( result.object_name, result.etag, result.version_id, ), ) @@ -1365,7 +1365,7 @@ result = client.fput_object( progress=Progress(), ) print( - "created {0} object; etag: {1},--version-id: {2}".format( + "created {0} object; etag: {1}, version-id: {2}".format( result.object_name, result.etag, result.version_id, ), ) @@ -1404,7 +1404,7 @@ print( ), ) -# Get object information of --version-id. +# Get object information of version-ID. result = client.stat_object( "my-bucket", "my-object", version_id="dfbd25b3-abec-4184-a4e8-5a35a5c1174d",