예제 #1
0
        public Ds3ExampleClient(string endpoint, Credentials credentials, string proxy)
        {
            Ds3Builder builder = new Ds3Builder(endpoint, credentials);
            if (!string.IsNullOrEmpty(proxy))
            {
                builder.WithProxy(new Uri(proxy));
            }
            _client = builder.Build();

            // Set up the high-level abstractions.
            _helpers = new Ds3ClientHelpers(_client);
        }
예제 #2
0
        /// <summary>
        /// Creates a Ds3Builder with the endpoint, credentials, and proxy all populated from
        /// environment variables.
        /// </summary>
        public static Ds3Builder FromEnv()
        {
            string _endpoint = Environment.GetEnvironmentVariable("DS3_ENDPOINT");
            string accesskey = Environment.GetEnvironmentVariable("DS3_ACCESS_KEY");
            string secretkey = Environment.GetEnvironmentVariable("DS3_SECRET_KEY");
            string _proxy = Environment.GetEnvironmentVariable("http_proxy");

            var _credentials = new Credentials(accesskey, secretkey);
            Ds3Builder builder = new Ds3Builder(_endpoint, _credentials);
            if (!string.IsNullOrEmpty(_proxy))
            {
                builder.WithProxy(new Uri(_proxy));
            }

            return builder;
        }
예제 #3
0
 /// <summary>
 /// </summary>
 /// <param name="endpoint">The http or https location at which your DS3 server is listening.</param>
 /// <param name="creds">Credentials with which to specify identity and sign requests.</param>
 public Ds3Builder(Uri endpoint, Credentials creds)
 {
     this._creds = creds;
     this._endpoint = endpoint;
 }
예제 #4
0
 /// <summary>
 /// </summary>
 /// <param name="endpoint">The http or https location at which your DS3 server is listening.</param>
 /// <param name="creds">Credentials with which to specify identity and sign requests.</param>
 public Ds3Builder(string endpoint, Credentials creds) {
     this._creds = creds;
     this._endpoint = new Uri(endpoint);
 }
        public void startup()
        {
            _endpoint = Environment.GetEnvironmentVariable("DS3_ENDPOINT");
            string accesskey = Environment.GetEnvironmentVariable("DS3_ACCESS_KEY");
            string secretkey = Environment.GetEnvironmentVariable("DS3_SECRET_KEY");
            _proxy = Environment.GetEnvironmentVariable("http_proxy");
            _credentials = new Credentials(accesskey, secretkey);
            Ds3Builder builder = new Ds3Builder(_endpoint, _credentials);
            if (!string.IsNullOrEmpty(_proxy))
            {
                builder.WithProxy(new Uri(_proxy));
            }
            _client = builder.Build();
            _helpers = new Ds3ClientHelpers(_client);

            setupTestData();
        }
        public void TestHttpsClient()
        {
            if (RuntimeUtils.IsRunningOnMono()) Assert.Ignore();

            var endpoint = Environment.GetEnvironmentVariable("DS3_ENDPOINT");
            endpoint = endpoint.ToLower().Replace("http://", "https://");
            var accesskey = Environment.GetEnvironmentVariable("DS3_ACCESS_KEY");
            var secretkey = Environment.GetEnvironmentVariable("DS3_SECRET_KEY");
            var proxy = Environment.GetEnvironmentVariable("http_proxy");

            var credentials = new Credentials(accesskey, secretkey);
            var builder = new Ds3Builder(endpoint, credentials);
            if (!string.IsNullOrEmpty(proxy))
            {
                builder.WithProxy(new Uri(proxy));
            }

            var client = builder.Build();

            client.GetService(new GetServiceRequest());
        }