// Set Replication configuration for the bucket public async static Task Run(MinioClient minio, string bucketName = "my-bucket-name") { try { Console.WriteLine("Running example for API: SetBucketReplication"); Dictionary <string, string> tags = new Dictionary <string, string>() { { "key1", "value1" }, { "key2", "value2" }, { "key3", "value3" } }; ReplicationRule rule = new ReplicationRule( new DeleteMarkerReplication(DeleteMarkerReplication.StatusEnabled), new ReplicationDestination( null, null, "Bucket-ARN", null, null, null, null), null, new RuleFilter(new AndOperator("PREFIX", Tagging.GetBucketTags(tags)), null, null), new DeleteReplication(DeleteReplication.StatusDisabled), 1, "REPLICATION-ID", "PREFIX", null, ReplicationRule.StatusEnabled ); List <ReplicationRule> rules = new List <ReplicationRule>(); rules.Add(rule); ReplicationConfiguration repl = new ReplicationConfiguration("REPLICATION-ROLE", rules); await minio.SetBucketReplicationAsync( new SetBucketReplicationArgs() .WithBucket(bucketName) .WithConfiguration(repl) ); Console.WriteLine($"Bucket Replication set for bucket {bucketName}."); Console.WriteLine(); } catch (Exception e) { Console.WriteLine($"[Bucket] Exception: {e}"); } }
// Set Tags to the bucket public static async Task Run(MinioClient minio, string bucketName = "my-bucket-name", Dictionary <string, string> tags = null) { try { Console.WriteLine("Running example for API: SetBucketTags"); await minio.SetBucketTagsAsync( new SetBucketTagsArgs() .WithBucket(bucketName) .WithTagging(Tagging.GetBucketTags(tags)) ); Console.WriteLine($"Bucket Tags set for bucket {bucketName}."); Console.WriteLine(); } catch (Exception e) { Console.WriteLine($"[Bucket] Exception: {e}"); } }
public SetBucketTagsArgs WithTagKeyValuePairs(Dictionary <string, string> kv) { this.TagKeyValuePairs = new Dictionary <string, string>(kv); this.BucketTags = Tagging.GetBucketTags(kv); return(this); }