コード例 #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
ファイル: Ds3Builder.cs プロジェクト: GtJosh/ds3_net_sdk
        /// <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
ファイル: Ds3Builder.cs プロジェクト: GtJosh/ds3_net_sdk
 /// <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
ファイル: Ds3Builder.cs プロジェクト: GtJosh/ds3_net_sdk
 /// <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);
 }
コード例 #5
0
        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();
        }
コード例 #6
0
        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());
        }