/** * Configure HttpClient with set of defaults as well as configuration * from AmazonElasticMapReduceConfig instance */ private static HttpWebRequest ConfigureWebRequest(int contentLength, AmazonElasticMapReduceConfig config) { HttpWebRequest request = WebRequest.Create(config.ServiceURL) as HttpWebRequest; if (request != null) { if (config.IsSetProxyHost() && config.IsSetProxyPort()) { WebProxy proxy = new WebProxy(config.ProxyHost, config.ProxyPort); if (config.IsSetProxyUsername()) { proxy.Credentials = new NetworkCredential( config.ProxyUsername, config.ProxyPassword ?? String.Empty ); } request.Proxy = proxy; } request.UserAgent = config.UserAgent; request.Method = "POST"; request.Timeout = 50000; request.ContentType = AWSSDKUtils.UrlEncodedContent; request.ContentLength = contentLength; } return(request); }
/// <summary> /// Constructs an AmazonElasticMapReduceClient with AWS Access Key ID, AWS Secret Key and an /// AmazonElasticMapReduce Configuration object /// </summary> /// <param name="awsAccessKeyId">AWS Access Key ID</param> /// <param name="awsSecretAccessKey">AWS Secret Access Key as a SecureString</param> /// <param name="config">The AmazonElasticMapReduce Configuration Object</param> public AmazonElasticMapReduceClient(string awsAccessKeyId, SecureString awsSecretAccessKey, AmazonElasticMapReduceConfig config) { this.awsAccessKeyId = awsAccessKeyId; this.awsSecretAccessKey = awsSecretAccessKey; this.config = config; ServicePointManager.Expect100Continue = false; ServicePointManager.UseNagleAlgorithm = false; }
private static HttpWebRequest ConfigureWebRequest(int contentLength, AmazonElasticMapReduceConfig config) { HttpWebRequest request = WebRequest.Create(config.ServiceURL) as HttpWebRequest; if (request != null) { if (config.IsSetProxyHost() && config.IsSetProxyPort()) { WebProxy proxy = new WebProxy(config.ProxyHost, config.ProxyPort); if (config.IsSetProxyUsername()) { proxy.Credentials = new NetworkCredential(config.ProxyUsername, config.ProxyPassword ?? string.Empty); } request.Proxy = proxy; } request.UserAgent = config.UserAgent; request.Method = "POST"; request.Timeout = 0xc350; request.ContentType = "application/x-www-form-urlencoded; charset=utf-8"; request.ContentLength = contentLength; } return(request); }
/// <summary> /// Constructs AmazonElasticMapReduceClient with AWS Access Key ID, AWS Secret Key and an /// AmazonElasticMapReduce Configuration object. If the config object's /// UseSecureStringForAwsSecretKey is false, the AWS Secret Key /// is stored as a clear-text string. Please use this option only /// if the application environment doesn't allow the use of SecureStrings. /// </summary> /// <param name="awsAccessKeyId">AWS Access Key ID</param> /// <param name="awsSecretAccessKey">AWS Secret Access Key</param> /// <param name="config">The AmazonElasticMapReduce Configuration Object</param> public AmazonElasticMapReduceClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonElasticMapReduceConfig config) { if (!String.IsNullOrEmpty(awsSecretAccessKey)) { if (config.UseSecureStringForAwsSecretKey) { this.awsSecretAccessKey = new SecureString(); foreach (char ch in awsSecretAccessKey.ToCharArray()) { this.awsSecretAccessKey.AppendChar(ch); } this.awsSecretAccessKey.MakeReadOnly(); } else { clearAwsSecretAccessKey = awsSecretAccessKey; } } this.awsAccessKeyId = awsAccessKeyId; this.config = config; ServicePointManager.Expect100Continue = false; ServicePointManager.UseNagleAlgorithm = false; }
/// <summary> /// Create a client for the Amazon ElasticMapReduce service with the specified configuration /// </summary> /// <param name="awsAccessKey">The AWS Access Key associated with the account</param> /// <param name="awsSecretAccessKey">The AWS Secret Access Key associated with the account</param> /// <param name="config">Configuration options for the service like HTTP Proxy, # of connections, etc /// </param> /// <returns>An Amazon ElasticMapReduce client</returns> /// <remarks> /// </remarks> public static AmazonElasticMapReduce CreateAmazonElasticMapReduceClient( string awsAccessKey, string awsSecretAccessKey, AmazonElasticMapReduceConfig config ) { return new AmazonElasticMapReduceClient(awsAccessKey, awsSecretAccessKey, config); }
/// <summary> /// Create a client for the Amazon ElasticMapReduce Service with the credentials loaded from the application's /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. /// /// Example App.config with credentials set. /// <code> /// <?xml version="1.0" encoding="utf-8" ?> /// <configuration> /// <appSettings> /// <add key="AWSAccessKey" value="********************"/> /// <add key="AWSSecretKey" value="****************************************"/> /// </appSettings> /// </configuration> /// </code> /// </summary> /// <param name="config">Configuration options for the service like HTTP Proxy, # of connections, etc</param> /// <returns>An Amazon ElasticMapReduce client</returns> public static AmazonElasticMapReduce CreateAmazonElasticMapReduceClient(AmazonElasticMapReduceConfig config) { return new AmazonElasticMapReduceClient(config); }
/// <summary> /// Constructs AmazonElasticMapReduceClient with AWS Credentials and an /// AmazonElasticMapReduceClient Configuration object. /// </summary> /// <param name="credentials">AWS Credentials</param> /// <param name="clientConfig">The AmazonElasticMapReduceClient Configuration Object</param> public AmazonElasticMapReduceClient(AWSCredentials credentials, AmazonElasticMapReduceConfig clientConfig) : base(credentials, clientConfig) { }
/// <summary> /// Constructs AmazonElasticMapReduceClient with AWS Access Key ID, AWS Secret Key and an /// AmazonElasticMapReduceClient Configuration object. /// </summary> /// <param name="awsAccessKeyId">AWS Access Key ID</param> /// <param name="awsSecretAccessKey">AWS Secret Access Key</param> /// <param name="awsSessionToken">AWS Session Token</param> /// <param name="clientConfig">The AmazonElasticMapReduceClient Configuration Object</param> public AmazonElasticMapReduceClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonElasticMapReduceConfig clientConfig) : base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig) { }
/// <summary> /// Constructs AmazonElasticMapReduceClient with AWS Access Key ID, AWS Secret Key and an /// AmazonElasticMapReduceClient Configuration object. /// </summary> /// <param name="awsAccessKeyId">AWS Access Key ID</param> /// <param name="awsSecretAccessKey">AWS Secret Access Key</param> /// <param name="awsSessionToken">AWS Session Token</param> /// <param name="clientConfig">The AmazonElasticMapReduceClient Configuration Object</param> public AmazonElasticMapReduceClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonElasticMapReduceConfig clientConfig) : base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig, AuthenticationTypes.User | AuthenticationTypes.Session) { }
/// <summary> /// Constructs AmazonElasticMapReduceClient with the credentials loaded from the application's /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. /// /// Example App.config with credentials set. /// <code> /// <?xml version="1.0" encoding="utf-8" ?> /// <configuration> /// <appSettings> /// <add key="AWSAccessKey" value="********************"/> /// <add key="AWSSecretKey" value="****************************************"/> /// </appSettings> /// </configuration> /// </code> /// /// </summary> /// <param name="config">The AmazonElasticMapReduce Configuration Object</param> public AmazonElasticMapReduceClient(AmazonElasticMapReduceConfig config) : base(FallbackCredentialsFactory.GetCredentials(), config, true, AuthenticationTypes.User | AuthenticationTypes.Session) { }
/// <summary> /// Constructs AmazonElasticMapReduceClient with AWS Credentials and an /// AmazonElasticMapReduceClient Configuration object. /// </summary> /// <param name="credentials">AWS Credentials</param> /// <param name="clientConfig">The AmazonElasticMapReduceClient Configuration Object</param> public AmazonElasticMapReduceClient(AWSCredentials credentials, AmazonElasticMapReduceConfig clientConfig) : base(credentials, clientConfig, AuthenticationTypes.User | AuthenticationTypes.Session) { }
/// <summary> /// Constructs AmazonElasticMapReduceClient with the credentials defined in the App.config. /// /// Example App.config with credentials set. /// <code> /// <?xml version="1.0" encoding="utf-8" ?> /// <configuration> /// <appSettings> /// <add key="AWSAccessKey" value="********************"/> /// <add key="AWSSecretKey" value="****************************************"/> /// </appSettings> /// </configuration> /// </code> /// /// </summary> /// <param name="config">The AmazonElasticMapReduce Configuration Object</param> public AmazonElasticMapReduceClient(AmazonElasticMapReduceConfig config) : base(new EnvironmentAWSCredentials(), config, true, AuthenticationTypes.User) { }
/// <summary> /// Create a client for the Amazon ElasticMapReduce Service with AWSCredentials and an AmazonElasticMapReduce Configuration object. /// </summary> /// <param name="credentials">AWS Credentials</param> /// <param name="config">Configuration options for the service like HTTP Proxy, # of connections, etc</param> /// <returns>An Amazon ElasticMapReduce client</returns> /// <remarks> /// </remarks> public static AmazonElasticMapReduce CreateAmazonElasticMapReduceClient(AWSCredentials credentials, AmazonElasticMapReduceConfig config) { return new AmazonElasticMapReduceClient(credentials, config); }
/// <summary> /// Constructs AmazonElasticMapReduceClient with the credentials loaded from the application's /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. /// /// Example App.config with credentials set. /// <code> /// <?xml version="1.0" encoding="utf-8" ?> /// <configuration> /// <appSettings> /// <add key="AWSProfileName" value="AWS Default"/> /// </appSettings> /// </configuration> /// </code> /// /// </summary> /// <param name="config">The AmazonElasticMapReduceClient Configuration Object</param> public AmazonElasticMapReduceClient(AmazonElasticMapReduceConfig config) : base(FallbackCredentialsFactory.GetCredentials(), config, AuthenticationTypes.User | AuthenticationTypes.Session) { }
/// <summary> /// Constructs AmazonElasticMapReduceClient with the credentials loaded from the application's /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. /// /// Example App.config with credentials set. /// <code> /// <?xml version="1.0" encoding="utf-8" ?> /// <configuration> /// <appSettings> /// <add key="AWSProfileName" value="AWS Default"/> /// </appSettings> /// </configuration> /// </code> /// /// </summary> /// <param name="config">The AmazonElasticMapReduceClient Configuration Object</param> public AmazonElasticMapReduceClient(AmazonElasticMapReduceConfig config) : base(FallbackCredentialsFactory.GetCredentials(), config) { }