Example #1
0
        public IRdfeIaasClustersRestClient Create(
            HttpMessageHandler defaultHttpClientHandler,
            IHDInsightSubscriptionCredentials credentials,
            IAbstractionContext context,
            bool ignoreSslErrors)
        {
            HttpRestClientRetryPolicy retryPolicy = null;
            var tokenCreds = credentials as IHDInsightAccessTokenCredential;

            var customHandlers = new List <DelegatingHandler>();

            if (context != null && context.Logger != null)
            {
                customHandlers.Add(new HttpLoggingHandler(context.Logger));
                retryPolicy = new HttpRestClientRetryPolicy(context.RetryPolicy);
            }
            else
            {
                retryPolicy = new HttpRestClientRetryPolicy(RetryPolicyFactory.CreateExponentialRetryPolicy());
                customHandlers.Add(new HttpLoggingHandler(new Logger()));
            }

            if (tokenCreds != null)
            {
                customHandlers.Add(new BearerTokenMessageHandler(tokenCreds.AccessToken));
            }

            var httpConfiguration = new HttpRestClientConfiguration(defaultHttpClientHandler, customHandlers, retryPolicy);
            var client            = new RdfeIaasClustersRestClient(credentials.Endpoint, httpConfiguration);

            return(client);
        }
 public RdfeIaasClustersRestClient(System.Uri baseUri, HttpRestClientConfiguration configuration) :
     base(baseUri, configuration)
 {
 }
 public HadoopApplicationHistoryRestReadClient(Uri baseUri, HttpRestClientConfiguration configuration) :
     base(baseUri, configuration)
 {
 }