Exemplo n.º 1
0
        // Get Tags set for the object
        public async static Task Run(MinioClient minio,
                                     string bucketName = "my-bucket-name",
                                     string objectName = "my-object-name",
                                     string versionId  = null)
        {
            try
            {
                Console.WriteLine("Running example for API: GetObjectTags");
                var tags = await minio.GetObjectTagsAsync(
                    new GetObjectTagsArgs()
                    .WithBucket(bucketName)
                    .WithObject(objectName)
                    .WithVersionId(versionId)
                    );

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