Ejemplo n.º 1
0
        // Get Object Retention Configuration for the bucket
        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: GetObjectRetentionAsync");
                ObjectRetentionConfiguration config = await minio.GetObjectRetentionAsync(
                    new GetObjectRetentionArgs()
                    .WithBucket(bucketName)
                    .WithObject(objectName)
                    .WithVersionId(versionId)
                    );

                string versionInfo      = (string.IsNullOrEmpty(versionId))?"":(" Version ID: " + versionId);
                string retentionModeStr = (config.Mode == RetentionMode.GOVERNANCE)?"GOVERNANCE":"COMPLIANCE";
                Console.WriteLine($"Retention configuration to object {bucketName}/{objectName} " +
                                  versionInfo +
                                  " Retention Mode: " + retentionModeStr +
                                  " Retention Date: " + config.RetainUntilDate);
                Console.WriteLine();
            }
            catch (Exception e)
            {
                Console.WriteLine($"[Object]  Exception: {e}");
            }
        }