Exemplo n.º 1
0
        // Get Lifecycle configuration assigned to the bucket
        public async static Task Run(MinioClient minio,
                                     string bucketName = "my-bucket-name")
        {
            try
            {
                Console.WriteLine("Running example for API: GetBucketLifecycle");
                var lfc = await minio.GetBucketLifecycleAsync(
                    new GetBucketLifecycleArgs()
                    .WithBucket(bucketName)
                    );

                if (lfc != null && lfc.Rules != null && lfc.Rules.Count > 0)
                {
                    Console.WriteLine($"Got Bucket Lifecycle set for bucket {bucketName}.");
                    Console.WriteLine(lfc.MarshalXML());
                    Console.WriteLine();
                    return;
                }
                Console.WriteLine($"Bucket Lifecycle not set for bucket {bucketName}.");
                Console.WriteLine();
            }
            catch (Exception e)
            {
                Console.WriteLine($"[Bucket]  Exception: {e}");
            }
        }