예제 #1
0
        // Get Tags assigned to the bucket
        public async static Task Run(MinioClient minio,
                                     string bucketName = "my-bucket-name")
        {
            try
            {
                Console.WriteLine("Running example for API: GetBucketTags");
                var tags = await minio.GetBucketTagsAsync(
                    new GetBucketTagsArgs()
                    .WithBucket(bucketName)
                    );

                if (tags != null && tags.GetTags() != null && tags.GetTags().Count > 0)
                {
                    Console.WriteLine($"Got Bucket Tags set for bucket {bucketName}.");
                    foreach (var tag in tags.GetTags())
                    {
                        Console.WriteLine(tag.Key + " : " + tag.Value);
                    }
                    Console.WriteLine();
                    return;
                }
                Console.WriteLine($"Bucket Tags not set for bucket {bucketName}.");
                Console.WriteLine();
            }
            catch (Exception e)
            {
                Console.WriteLine($"[Bucket]  Exception: {e}");
            }
        }