static void Main(string[] args) { // Configure and build the core client. IDs3Client client = new Ds3Builder( ConfigurationManager.AppSettings["Ds3Endpoint"], new Credentials( ConfigurationManager.AppSettings["Ds3AccessKey"], ConfigurationManager.AppSettings["Ds3SecretKey"] ) ).Build(); // Set up the high-level abstractions. IDs3ClientHelpers helpers = new Ds3ClientHelpers(client); string bucket = "bucket-name"; string directory = "DataFromBucket"; // Creates a bulk job with all of the objects in the bucket. IJob job = helpers.StartReadAllJob(bucket); // Same as: IJob job = helpers.StartReadJob(bucket, helpers.ListObjects(bucket)); // Keep the job id around. This is useful for job recovery in the case of a failure. Console.WriteLine("Job id {0} started.", job.JobId); // Transfer all of the files. job.Transfer(FileHelpers.BuildFileGetter(directory)); // Wait for user input. Console.WriteLine("Press enter to continue."); Console.ReadLine(); }
static void Main(string[] args) { // Configure and build the core client. IDs3Client client = new Ds3Builder( ConfigurationManager.AppSettings["Ds3Endpoint"], new Credentials( ConfigurationManager.AppSettings["Ds3AccessKey"], ConfigurationManager.AppSettings["Ds3SecretKey"] ) ).Build(); // Set up the high-level abstractions. IDs3ClientHelpers helpers = new Ds3ClientHelpers(client); string bucket = "bucket-name"; string directory = "TestData"; // Creates a bucket if it does not already exist. helpers.EnsureBucketExists(bucket); // Creates a bulk job with the server based on the files in a directory (recursively). IJob job = helpers.StartWriteJob(bucket, FileHelpers.ListObjectsForDirectory(directory)); // Keep the job id around. This is useful for job recovery in the case of a failure. Console.WriteLine("Job id {0} started.", job.JobId); // Transfer all of the files. job.Transfer(FileHelpers.BuildFilePutter(directory)); // Wait for user input. Console.WriteLine("Press enter to continue."); Console.ReadLine(); }
static void Main(string[] args) { // Configure and build the core client. IDs3Client client = new Ds3Builder( ConfigurationManager.AppSettings["Ds3Endpoint"], new Credentials( ConfigurationManager.AppSettings["Ds3AccessKey"], ConfigurationManager.AppSettings["Ds3SecretKey"] ) ).Build(); // Loop through all of the objects in the bucket. foreach (var bucket in client.GetService(new GetServiceRequest()).Buckets) { Console.WriteLine("Bucket '{0}'.", bucket.Name); } // Wait for user input. Console.WriteLine("Press enter to continue."); Console.ReadLine(); }
static void Main(string[] args) { // Configure and build the core client. IDs3Client client = new Ds3Builder( ConfigurationManager.AppSettings["Ds3Endpoint"], new Credentials( ConfigurationManager.AppSettings["Ds3AccessKey"], ConfigurationManager.AppSettings["Ds3SecretKey"] ) ).Build(); // Set up the high-level abstractions. IDs3ClientHelpers helpers = new Ds3ClientHelpers(client); // Loop through all of the objects in the bucket. foreach (var obj in helpers.ListObjects("bucket-name")) { Console.WriteLine("Object '{0}' of size {1}.", obj.Name, obj.Size); } // Wait for user input. Console.WriteLine("Press enter to continue."); Console.ReadLine(); }