public AmazonRDSClient(string awsAccessKeyId, SecureString awsSecretAccessKey, AmazonRDSConfig config) { this.awsAccessKeyId = awsAccessKeyId; this.awsSecretAccessKey = awsSecretAccessKey; this.config = config; ServicePointManager.Expect100Continue = false; ServicePointManager.UseNagleAlgorithm = false; }
private static HttpWebRequest ConfigureWebRequest(int contentLength, AmazonRDSConfig 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); }
public AmazonRDSClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonRDSConfig 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 { this.clearAwsSecretAccessKey = awsSecretAccessKey; } } this.awsAccessKeyId = awsAccessKeyId; this.config = config; ServicePointManager.Expect100Continue = false; ServicePointManager.UseNagleAlgorithm = false; }
/// <summary> /// Constructs AmazonRDSClient with AWS Access Key ID, AWS Secret Key and an /// AmazonRDSClient 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="awsSessionToken">AWS Session Token</param> /// <param name="clientConfig">The AmazonRDSClient Configuration Object</param> public AmazonRDSClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonRDSConfig clientConfig) : base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig, AuthenticationTypes.User | AuthenticationTypes.Session) { }
/// <summary> /// Constructs AmazonRDSClient with AWS Credentials and an /// AmazonRDSClient Configuration object. /// </summary> /// <param name="credentials">AWS Credentials</param> /// <param name="clientConfig">The AmazonRDSClient Configuration Object</param> public AmazonRDSClient(AWSCredentials credentials, AmazonRDSConfig clientConfig) : base(credentials, clientConfig, false, AuthenticationTypes.User | AuthenticationTypes.Session) { }
/// <summary> /// Constructs AmazonRDSClient 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 AmazonRDS Configuration Object</param> public AmazonRDSClient(AmazonRDSConfig config) : base(FallbackCredentialsFactory.GetCredentials(), config, true, AuthenticationTypes.User | AuthenticationTypes.Session) { }
/// <summary> /// Create a client for the Amazon RDS Service with AWSCredentials and an AmazonRDS 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 RDS client</returns> /// <remarks> /// </remarks> public static AmazonRDS CreateAmazonRDSClient(AWSCredentials credentials, AmazonRDSConfig config) { return new AmazonRDSClient(credentials, config); }
/// <summary> /// Create a client for the Amazon RDS 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 RDS client</returns> /// <remarks> /// </remarks> public static AmazonRDS CreateAmazonRDSClient( string awsAccessKey, string awsSecretAccessKey, AmazonRDSConfig config ) { return new AmazonRDSClient(awsAccessKey, awsSecretAccessKey, config); }
/// <summary> /// Create a client for the Amazon RDS 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 RDS client</returns> public static AmazonRDS CreateAmazonRDSClient(AmazonRDSConfig config) { return new AmazonRDSClient(config); }
/// <summary> /// Constructs AmazonRDSClient with AWS Access Key ID, AWS Secret Key and an /// AmazonRDSClient 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 AmazonRDSClient Configuration Object</param> public AmazonRDSClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonRDSConfig clientConfig) : base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig) { }
/// <summary> /// Constructs AmazonRDSClient with AWS Credentials and an /// AmazonRDSClient Configuration object. /// </summary> /// <param name="credentials">AWS Credentials</param> /// <param name="clientConfig">The AmazonRDSClient Configuration Object</param> public AmazonRDSClient(AWSCredentials credentials, AmazonRDSConfig clientConfig) : base(credentials, clientConfig) { }
/// <summary> /// Constructs AmazonRDSClient 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 AmazonRDSClient Configuration Object</param> public AmazonRDSClient(AmazonRDSConfig config) : base(FallbackCredentialsFactory.GetCredentials(), config) { }
/// <summary> /// Constructs AmazonRDSClient 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 AmazonRDS Configuration Object</param> public AmazonRDSClient(AmazonRDSConfig config) : base(new EnvironmentAWSCredentials(), config, true, AuthenticationTypes.User) { }
private OperationResult EstablishClient(AddonManifest manifest, DeveloperOptions devOptions, out AmazonRDSClient client) { OperationResult result; bool requireCreds; var manifestProps = manifest.GetProperties().ToDictionary(x => x.Key, x => x.Value); var accessKey = manifestProps["AWSClientKey"]; var secretAccessKey = manifestProps["AWSSecretKey"]; var regionEndpoint = manifestProps["AWSRegionEndpoint"]; var prop = manifest.Properties.First( p => p.Key.Equals("requireDevCredentials", StringComparison.InvariantCultureIgnoreCase)); if (bool.TryParse(prop.Value, out requireCreds) && requireCreds) { if (!ValidateDevCreds(devOptions)) { client = null; result = new OperationResult() { IsSuccess = false, EndUserMessage = "The add on requires that developer credentials are specified but none were provided." }; return result; } accessKey = devOptions.AccessKey; secretAccessKey = devOptions.SecretAccessKey; } AmazonRDSConfig config = new AmazonRDSConfig() { RegionEndpoint = RegionEndpoint.USEast1 }; client = new AmazonRDSClient(accessKey, secretAccessKey, config); result = new OperationResult { IsSuccess = true }; return result; }
/// <summary> /// Constructs AmazonRDSClient with AWS Access Key ID, AWS Secret Key and an /// AmazonRDSClient 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="clientConfig">The AmazonRDSClient Configuration Object</param> public AmazonRDSClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonRDSConfig clientConfig) : base(awsAccessKeyId, awsSecretAccessKey, clientConfig) { }