protected override void OnSetup() { var settings = (IDictionary<string, object>) Settings; object providedClient; if (settings.TryGetValue("Client", out providedClient)) { this.client = (AmazonSimpleDB) providedClient; return; } object accessKey; object secret; if (!settings.TryGetValue("AccessKey", out accessKey) || !settings.TryGetValue("Secret", out secret)) { throw new InvalidOperationException( "The SimpleDB adapter requires the AccessKey and Secret properties to be set."); } var config = new AmazonSimpleDBConfig(); object serviceUrl; if (settings.TryGetValue("ServiceUrl", out serviceUrl)) { config.WithServiceURL(serviceUrl.ToString()); } client = Amazon.AWSClientFactory.CreateAmazonSimpleDBClient(accessKey.ToString(), secret.ToString(), config); }
/** * Configure HttpClient with set of defaults as well as configuration * from AmazonSimpleDBConfig instance */ private static HttpWebRequest ConfigureWebRequest(int contentLength, AmazonSimpleDBConfig 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 AmazonSimpleDBClient with AWS Access Key ID, AWS Secret Key and an /// AmazonSimpleDB 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 AmazonSimpleDB Configuration Object</param> public AmazonSimpleDBClient(string awsAccessKeyId, SecureString awsSecretAccessKey, AmazonSimpleDBConfig config) { this.awsAccessKeyId = awsAccessKeyId; this.awsSecretAccessKey = awsSecretAccessKey; this.config = config; ServicePointManager.Expect100Continue = false; ServicePointManager.UseNagleAlgorithm = false; }
public SimpleDbConfiguration() { NameValueCollection appConfig = ConfigurationManager.AppSettings; this.SimpleDbAccessKey = appConfig[Constants.SimpleDbAccessKey]; this.SimpleDbSecretKey = appConfig[Constants.SimpleDbSecretKey]; this.SimpleDbApplicationName = appConfig[Constants.SimpleDbApplicationName]; this.SimpleDbEnvironment = appConfig[Constants.SimpleDbEnvironment]; this.AmazonSimpleDbConfig = new AmazonSimpleDBConfig().WithServiceURL(appConfig[Constants.SimpleDbRegion]); }
/// <summary> /// Constructs AmazonSimpleDBClient with AWS Access Key ID, AWS Secret Key and an /// AmazonSimpleDB 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 AmazonSimpleDB Configuration Object</param> public AmazonSimpleDBClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonSimpleDBConfig config) { if (!String.IsNullOrEmpty(awsSecretAccessKey)) { clearAwsSecretAccessKey = awsSecretAccessKey; } this.awsAccessKeyId = awsAccessKeyId; this.config = config; }
public SimpleDBStorage () { var credentials = new CognitoAWSCredentials ( Constants.CognitoIdentityPoolId, RegionEndpoint.USEast1); var config = new AmazonSimpleDBConfig (); config.RegionEndpoint = RegionEndpoint.USWest2; client = new AmazonSimpleDBClient (credentials, config); Items = new List<TodoItem> (); SetupDomain (); }
public SimpleDBAdapter() { // initialize Amazon SimpleDBClient AmazonSimpleDBConfig simpleDBConfig = new AmazonSimpleDBConfig(); simpleDBConfig.ServiceURL = ConfigurationManager.AppSettings["SimpleDBServiceURL"]; m_simpleDBClient = AWSClientFactory.CreateAmazonSimpleDBClient(simpleDBConfig); m_BroadcastMessagesDomain = ConfigurationManager.AppSettings["BroadcastMessagesSDBDomain"]; m_GroupMessagesDomain = ConfigurationManager.AppSettings["GroupMessagesSDBDomain"]; m_PrivateMessagesDomain = ConfigurationManager.AppSettings["PrivateMessagesSDBDomain"]; m_UserStateDomain = ConfigurationManager.AppSettings["UserStateSDBDomain"]; }
/** * Configure HttpClient with set of defaults as well as configuration * from AmazonSimpleDBConfig instance */ private static HttpWebRequest configureWebRequest(AmazonSimpleDBConfig config) { //Create the header and assign it to the HttpWebRequest WebHeaderCollection header = new WebHeaderCollection(); header[HttpRequestHeader.Expires] = "50000"; HttpWebRequest request = WebRequest.Create(config.ServiceURL) as HttpWebRequest; request.Headers = header; if (request != null) { request.UserAgent = config.UserAgent; request.Method = "POST"; request.ContentType = AWSSDKUtils.UrlEncodedContent; } return(request); }
private static HttpWebRequest ConfigureWebRequest(int contentLength, AmazonSimpleDBConfig 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 AmazonSimpleDBClient with AWS Access Key ID, AWS Secret Key and an /// AmazonSimpleDB 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 AmazonSimpleDB Configuration Object</param> public AmazonSimpleDBClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonSimpleDBConfig 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 SimpleDB 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 SimpleDB client</returns> public static AmazonSimpleDB CreateAmazonSimpleDBClient(AmazonSimpleDBConfig config) { return new AmazonSimpleDBClient(config); }
/// <summary> /// Constructs AmazonSimpleDBClient with AWS Credentials and an /// AmazonSimpleDBClient Configuration object. /// </summary> /// <param name="credentials">AWS Credentials</param> /// <param name="clientConfig">The AmazonSimpleDBClient Configuration Object</param> public AmazonSimpleDBClient(AWSCredentials credentials, AmazonSimpleDBConfig clientConfig) : base(credentials, clientConfig, AuthenticationTypes.User | AuthenticationTypes.Session) { }
/// <summary> /// Constructs AmazonSimpleDBClient with AWS Access Key ID, AWS Secret Key and an /// AmazonSimpleDBClient 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 AmazonSimpleDBClient Configuration Object</param> public AmazonSimpleDBClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonSimpleDBConfig clientConfig) : base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig, AuthenticationTypes.User | AuthenticationTypes.Session) { }
/// <summary> /// Constructs AmazonSimpleDBClient with AWS Access Key ID, AWS Secret Key and an /// AmazonSimpleDBClient 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 AmazonSimpleDBClient Configuration Object</param> public AmazonSimpleDBClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonSimpleDBConfig clientConfig) : base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig) { }
/// <summary> /// Constructs AmazonSimpleDBClient with AWS Credentials and an /// AmazonSimpleDBClient Configuration object. /// </summary> /// <param name="credentials">AWS Credentials</param> /// <param name="clientConfig">The AmazonSimpleDBClient Configuration Object</param> public AmazonSimpleDBClient(AWSCredentials credentials, AmazonSimpleDBConfig clientConfig) : base(credentials, clientConfig) { }
/// <summary> /// Constructs AmazonSimpleDBClient 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 AmazonSimpleDBClient Configuration Object</param> public AmazonSimpleDBClient(AmazonSimpleDBConfig config) : base(FallbackCredentialsFactory.GetCredentials(), config) { }
/// <summary> /// Constructs AmazonSimpleDBClient 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 AmazonSimpleDB Configuration Object</param> public AmazonSimpleDBClient(AmazonSimpleDBConfig config) : base(FallbackCredentialsFactory.GetCredentials(), config, AuthenticationTypes.User | AuthenticationTypes.Session) { }
private AmazonSimpleDBClient(AWSCredentials credentials, AmazonSimpleDBConfig config) { this.config = config; this.awsAccessKeyId = credentials.GetCredentials().AccessKey; this.clearAwsSecretAccessKey = credentials.GetCredentials().SecretKey; }
/// <summary> /// Constructs AmazonSimpleDBClient 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 AmazonSimpleDB Configuration Object</param> public AmazonSimpleDBClient(AmazonSimpleDBConfig config) : base(FallbackCredentialsFactory.GetCredentials(), config, AuthenticationTypes.User | AuthenticationTypes.Session) { }
/// <summary> /// Constructs AmazonSimpleDBClient with AWS Access Key ID, AWS Secret Key and an /// AmazonSimpleDBClient 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 AmazonSimpleDBClient Configuration Object</param> public AmazonSimpleDBClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonSimpleDBConfig clientConfig) : base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig, AuthenticationTypes.User | AuthenticationTypes.Session) { }
/// <summary> /// Create a client for the Amazon SimpleDB 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 SimpleDB client</returns> /// <remarks> /// </remarks> public static IAmazonSimpleDB CreateAmazonSimpleDBClient( string awsAccessKey, string awsSecretAccessKey, AmazonSimpleDBConfig config ) { return new AmazonSimpleDBClient(awsAccessKey, awsSecretAccessKey, config); }
/// <summary> /// Create a client for the Amazon SimpleDB Service with AWSCredentials and an AmazonSimpleDB 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 SimpleDB client</returns> /// <remarks> /// </remarks> public static IAmazonSimpleDB CreateAmazonSimpleDBClient(AWSCredentials credentials, AmazonSimpleDBConfig config) { return new AmazonSimpleDBClient(credentials, config); }
/// <summary> /// Constructs AmazonSimpleDBClient with AWS Access Key ID and AWS Secret Key /// </summary> /// <param name="awsAccessKeyId">AWS Access Key ID</param> /// <param name="awsSecretAccessKey">AWS Secret Access Key</param> /// <param name="config">configuration</param> public AmazonSimpleDBClient(String awsAccessKeyId, String awsSecretAccessKey, AmazonSimpleDBConfig config) { this.awsAccessKeyId = awsAccessKeyId; this.awsSecretAccessKey = awsSecretAccessKey; this.config = config; }