Exemplo n.º 1
0
        public static EcsApiClient SetUp(string endpoint, string key, string pwd)
        {
            var client = new EcsApiClient(endpoint);

            client.LocalHttpWebRequestFilter += (req) => {
                string time = DateTime.UtcNow.ToString("s");
                string authorization_header = CalculateSignature(req, key, pwd, time);
                req.Headers.Add(ApiAuthorizationHeader, authorization_header);
                req.Headers.Add(ApiKeyHeader, key);
                req.Headers.Add(ApiRequestTimeHeader, time);
                req.Headers.Add("Path", req.RequestUri.AbsolutePath);
            };
            return(client);
        }
Exemplo n.º 2
0
        public static EcsApiClient SetUp(string endpoint, string key, string pwd)
        {
            var client = new EcsApiClient(endpoint);

            client.LocalHttpWebRequestFilter += (req) => {
                string time = DateTime.UtcNow.ToString("s");
                string authorization_header = CalculateSignature(req, key, pwd, time);
                req.Headers.Add(ApiAuthorizationHeader, authorization_header);
                req.Headers.Add(ApiKeyHeader, key);
                req.Headers.Add(ApiRequestTimeHeader, time);
                req.Headers.Add("Path", req.RequestUri.AbsolutePath);
            };
            return client;
        }