Skip to content

Instantly share code, notes, and snippets.

@xandout
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xandout/aa8a39b0fdf6deffcb80 to your computer and use it in GitHub Desktop.
Save xandout/aa8a39b0fdf6deffcb80 to your computer and use it in GitHub Desktop.
Mothership1 Storage Deck C#
using Amazon.S3; // Add reference to C:\Program Files (x86)\AWS SDK for .NET\bin\Net35\AWSSDK.dll
using Amazon.S3.Model;
using System;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
String accessKey = "KEY";
String accessSecret = "SECRET";
AmazonS3Config config = new AmazonS3Config();
config.ServiceURL = "https://s3-ca1.mothership1.com";
// Allow connections to non-trusted entity http://stackoverflow.com/a/15101129/1009816
System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };
// Create a client
AmazonS3Client client = new AmazonS3Client(accessKey, accessSecret, config);
// Issue call
ListBucketsResponse response = client.ListBuckets();
// View response data
Console.WriteLine("Buckets owner - {0}", response.Owner.DisplayName);
foreach (S3Bucket bucket in response.Buckets)
{
Console.WriteLine("Bucket {0}, Created on {1}", bucket.BucketName, bucket.CreationDate);
}
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment