protected override BatchRestClient CreateBatchRestClient(string url, string accountName, string key)
        {
            BatchRestClient restClient = base.CreateBatchRestClient(url, accountName, key);

            // Add HTTP recorder to the BatchRestClient
            HttpMockServer mockServer = HttpMockServer.CreateInstance();

            mockServer.InnerHandler = new HttpClientHandler();
            restClient.AddHandlerToPipeline(mockServer);

            return(restClient);
        }
Exemple #2
0
        protected virtual BatchRestClient CreateBatchRestClient(string url, string accountName, string key)
        {
            Microsoft.Azure.Batch.Protocol.BatchSharedKeyCredential credentials = new Microsoft.Azure.Batch.Protocol.BatchSharedKeyCredential(accountName, key);
            BatchRestClient restClient = new BatchRestClient(credentials, new Uri(url));

            restClient.HttpClient.DefaultRequestHeaders.UserAgent.Add(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.UserAgentValue);

            restClient.SetRetryPolicy(Hyak.Common.TransientFaultHandling.RetryPolicy.NoRetry); //Force there to be no retries
            restClient.HttpClient.Timeout = Timeout.InfiniteTimeSpan;                          //Client side timeout will be set per-request

            return(restClient);
        }
        protected virtual BatchRestClient CreateBatchRestClient(string url, string accountName, string key)
        {
            Microsoft.Azure.Batch.Protocol.BatchSharedKeyCredential credentials = new Microsoft.Azure.Batch.Protocol.BatchSharedKeyCredential(accountName, key);
            BatchRestClient restClient = new BatchRestClient(credentials, new Uri(url));
            restClient.HttpClient.DefaultRequestHeaders.UserAgent.Add(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.UserAgentValue);

            restClient.SetRetryPolicy(Hyak.Common.TransientFaultHandling.RetryPolicy.NoRetry); //Force there to be no retries
            restClient.HttpClient.Timeout = Timeout.InfiniteTimeSpan; //Client side timeout will be set per-request

            return restClient;
        }