public override void Initialize(string name, NameValueCollection config) { if (config == null) { throw new ArgumentNullException("config"); } if (name == null || name.Length == 0) { name = "SDBProfileProvider"; } // Initialize the abstract base class. base.Initialize(name, config); accessKey = GetConfigValue(config["accessKey"], ""); secretKey = GetConfigValue(config["secretKey"], ""); domain = GetConfigValue(config["domain"], "Profiles"); client = new AmazonSimpleDBClient(accessKey, secretKey); // Make sure the domain for user profiles exists CreateDomainRequest cdRequest = new CreateDomainRequest(); cdRequest.DomainName = domain; client.CreateDomain(cdRequest); }
public override void CreateDomain(string Domain) { Domain = SetDomain(Domain); CreateDomainRequest request = new CreateDomainRequest().WithDomainName(Domain); client.CreateDomain(request); }
public void sendAmazonSimpleDbIndex(String XML) { AmazonSimpleDB sdb = AWSClientFactory.CreateAmazonSimpleDBClient(RegionEndpoint.USWest2); try { String domainName = ""; CreateDomainRequest createDomain2 = (new CreateDomainRequest()).WithDomainName("index"); sdb.CreateDomain(createDomain2); domainName = "index"; String itemNameTwo = "1"; PutAttributesRequest putAttributesActionTwo = new PutAttributesRequest().WithDomainName(domainName).WithItemName(itemNameTwo); List <ReplaceableAttribute> attributesTwo = putAttributesActionTwo.Attribute; attributesTwo.Add(new ReplaceableAttribute().WithName("indexID").WithValue(indexID)); attributesTwo.Add(new ReplaceableAttribute().WithName("compID").WithValue(machineName)); attributesTwo.Add(new ReplaceableAttribute().WithName("XML_Profile").WithValue(XML)); sdb.PutAttributes(putAttributesActionTwo); } catch (AmazonSimpleDBException ex) { failCount++; log("Caught Exception: " + ex.Message); log("Response Status Code: " + ex.StatusCode); log("Error Code: " + ex.ErrorCode); log("Error Type: " + ex.ErrorType); log("Request ID: " + ex.RequestId); log("XML: " + ex.XML); } //Console.WriteLine("Press Enter to continue..."); //Console.Read(); }
public override void Initialize(string name, NameValueCollection config) { base.Initialize(name, config); accessKey = config["accessKey"]; secretKey = config["secretKey"]; if (string.IsNullOrEmpty(accessKey)) { throw new ConfigurationErrorsException("AWS Access Key is required."); } if (string.IsNullOrEmpty(secretKey)) { throw new ConfigurationErrorsException("AWS Secret Key is required."); } // Set any domain prefix if (!string.IsNullOrEmpty(config["domainPrefix"])) { domainPrefix = config["domainPrefix"]; } client = new AmazonSimpleDBClient(accessKey, secretKey); if (config["domains"] != null) { // Make sure domains exist string[] domains = config["domains"].ToString().Split(new char[] { ',' }); foreach (string domain in domains) { string _domain = SetDomain(domain); CreateDomainRequest request = new CreateDomainRequest().WithDomainName(_domain); client.CreateDomain(request); } } }
//Amazon public void sendAmazonSimpleMachineName() { AmazonSimpleDB sdb = AWSClientFactory.CreateAmazonSimpleDBClient(RegionEndpoint.USWest2); try { String domainName = ""; CreateDomainRequest createDomain = (new CreateDomainRequest()).WithDomainName("Computer"); sdb.CreateDomain(createDomain); // Putting data into a domain domainName = "Computer"; String itemNameOne = "1"; PutAttributesRequest putAttributesActionOne = new PutAttributesRequest().WithDomainName(domainName).WithItemName(itemNameOne); List <ReplaceableAttribute> attributesOne = putAttributesActionOne.Attribute; attributesOne.Add(new ReplaceableAttribute().WithName("compID").WithValue(machineName)); attributesOne.Add(new ReplaceableAttribute().WithName("compName").WithValue(machineName)); sdb.PutAttributes(putAttributesActionOne); } catch (AmazonSimpleDBException ex) { log(".........AmazonSimpleDBException........."); log("Caught Exception: " + ex.Message); log("Response Status Code: " + ex.StatusCode); log("Error Code: " + ex.ErrorCode); log("Error Type: " + ex.ErrorType); log("Request ID: " + ex.RequestId); log("XML: " + ex.XML); } }
void Init() { client = new AmazonSimpleDBClient(accessKey, secretKey); foreach (string domain in domains) { string _domain = SetDomain(domain); CreateDomainRequest request = new CreateDomainRequest().WithDomainName(_domain); client.CreateDomain(request); } }
/// <summary> /// Creates the domain for the given type /// </summary> public void CreateDomain() { if (Logger.IsInfoEnabled) { Logger.Info("Sending request to create domain '{0}' to ensure it exists".StringFormat(_domainName)); } var request = _domainRequestFactory.Create(this.DomainName); _simpleDB.CreateDomain(request); }
public static void CheckForDomain(string domainName, AmazonSimpleDB sdbClient) { VerifyKeys(); ListDomainsRequest listDomainsRequest = new ListDomainsRequest(); ListDomainsResponse listDomainsResponse = sdbClient.ListDomains(listDomainsRequest); if (!listDomainsResponse.ListDomainsResult.DomainName.Contains(domainName)) { CreateDomainRequest createDomainRequest = new CreateDomainRequest().WithDomainName(domainName); sdbClient.CreateDomain(createDomainRequest); } }
public override void Initialize(string name, NameValueCollection config) { // // Initialize values from web.config. // if (config == null) { throw new ArgumentNullException("config"); } if (name == null || name.Length == 0) { name = "SDBRoleProvider"; } if (String.IsNullOrEmpty(config["description"])) { config.Remove("description"); config.Add("description", "Amazon Simple DB Role provider"); } // Initialize the abstract base class. base.Initialize(name, config); accessKey = GetConfigValue(config["accessKey"], ""); secretKey = GetConfigValue(config["secretKey"], ""); domain = GetConfigValue(config["domain"], "Roles"); if (config["writeExceptionsToEventLog"] != null) { if (config["writeExceptionsToEventLog"].ToUpper() == "TRUE") { pWriteExceptionsToEventLog = true; } } // // Initialize the SimpleDB Client. // client = new AmazonSimpleDBClient(accessKey, secretKey); // Make sure the domain for users exists CreateDomainRequest cdRequest = new CreateDomainRequest(); cdRequest.DomainName = domain; client.CreateDomain(cdRequest); }
private void EnsureDomain(string domain) { var listDomainsRequest = new ListDomainsRequest(); var listDomainsResponse = _client.ListDomains(listDomainsRequest); if (listDomainsResponse.ListDomainsResult.DomainName.Contains(domain)) { return; } var createDomainRequest = new CreateDomainRequest { DomainName = domain }; _client.CreateDomain(createDomainRequest); }
public bool sendAmazonSimpleDbImage(String filename, String partNo, String part) { AmazonSimpleDB sdb = AWSClientFactory.CreateAmazonSimpleDBClient(RegionEndpoint.USWest2); try { String domainName = ""; CreateDomainRequest createDomain3 = (new CreateDomainRequest()).WithDomainName("Images"); sdb.CreateDomain(createDomain3); domainName = "Images"; String itemNameThree = itemNo.ToString(); PutAttributesRequest putAttributesActionThree = new PutAttributesRequest().WithDomainName(domainName).WithItemName(itemNameThree); List <ReplaceableAttribute> attributesThree = putAttributesActionThree.Attribute; attributesThree.Add(new ReplaceableAttribute().WithName("ImgID").WithValue("TestImage01")); attributesThree.Add(new ReplaceableAttribute().WithName("indexID").WithValue("1")); attributesThree.Add(new ReplaceableAttribute().WithName("Extension").WithValue("jpg")); attributesThree.Add(new ReplaceableAttribute().WithName("location").WithValue(filename)); attributesThree.Add(new ReplaceableAttribute().WithName("imgPart").WithValue(partNo.ToString())); attributesThree.Add(new ReplaceableAttribute().WithName("raw").WithValue(part)); sdb.PutAttributes(putAttributesActionThree); } catch (AmazonSimpleDBException ex) { failCount++; log("Caught Exception: " + ex.Message); log("Response Status Code: " + ex.StatusCode); log("Error Code: " + ex.ErrorCode); log("Error Type: " + ex.ErrorType); log("Request ID: " + ex.RequestId); log("XML: " + ex.XML); return(false); } itemNo++; return(true); }
/// <summary> /// Put the user's reco into the ZigMeRecos domain in SimpleDB /// </summary> /// <returns></returns> private bool SaveRecoToSimpleDB(string myFBId) { AmazonSimpleDB sdb = GetSDB(); // Creating a domain String domainName = "ZigMeRecos"; CreateDomainRequest createDomain = (new CreateDomainRequest()).WithDomainName(domainName); sdb.CreateDomain(createDomain); // Check to see how many recos this FB user id has stored in our domain String selectExpression = "Select * From ZigMeRecos Where FBId = '" + myFBId + "'"; SelectRequest selectRequestAction = new SelectRequest().WithSelectExpression(selectExpression); SelectResponse selectResponse = sdb.Select(selectRequestAction); int cRecos = 0; // Now store the actual recommendation item if (selectResponse.IsSetSelectResult()) { SelectResult selectResult = selectResponse.SelectResult; cRecos = selectResult.Item.Count; } cRecos++; String recoItem = "Reco_" + myFBId + "_" + cRecos; PutAttributesRequest putAttributesRecoItem = new PutAttributesRequest().WithDomainName(domainName).WithItemName(recoItem); List <ReplaceableAttribute> attributesRecoItem = putAttributesRecoItem.Attribute; attributesRecoItem.Add(new ReplaceableAttribute().WithName("FBId").WithValue(myFBId)); attributesRecoItem.Add(new ReplaceableAttribute().WithName("Name").WithValue(RecoName.Text)); attributesRecoItem.Add(new ReplaceableAttribute().WithName("Email").WithValue(ContactEmail.Text)); attributesRecoItem.Add(new ReplaceableAttribute().WithName("City").WithValue(RecoCity.Text)); attributesRecoItem.Add(new ReplaceableAttribute().WithName("Service").WithValue(RecoService.SelectedValue)); PutAttributesResponse putAttributesResponse = sdb.PutAttributes(putAttributesRecoItem); return(putAttributesResponse.IsSetResponseMetadata()); }
public override void Initialize(string name, NameValueCollection config) { // // Initialize values from web.config. // if (config == null) throw new ArgumentNullException("config"); if (name == null || name.Length == 0) name = "SDBRoleProvider"; if (String.IsNullOrEmpty(config["description"])) { config.Remove("description"); config.Add("description", "Amazon Simple DB Role provider"); } // Initialize the abstract base class. base.Initialize(name, config); accessKey = GetConfigValue(config["accessKey"], ""); secretKey = GetConfigValue(config["secretKey"], ""); domain = GetConfigValue(config["domain"], "Roles"); if (config["writeExceptionsToEventLog"] != null) { if (config["writeExceptionsToEventLog"].ToUpper() == "TRUE") { pWriteExceptionsToEventLog = true; } } // // Initialize the SimpleDB Client. // client = new AmazonSimpleDBClient(accessKey, secretKey); // Make sure the domain for users exists CreateDomainRequest cdRequest = new CreateDomainRequest(); cdRequest.DomainName = domain; client.CreateDomain(cdRequest); }
private void EnsureDomain(string storeIdentifier) { var createDomainRequest = new CreateDomainRequest().WithDomainName(storeIdentifier); _simpleDb.CreateDomain(createDomainRequest); }
// // System.Configuration.Provider.ProviderBase.Initialize Method // public override void Initialize(string name, NameValueCollection config) { // // Initialize values from web.config. // if (config == null) { throw new ArgumentNullException("config"); } if (name == null || name.Length == 0) { name = "SDBMembershipProvider"; } // Initialize the abstract base class. base.Initialize(name, config); accessKey = GetConfigValue(config["accessKey"], ""); secretKey = GetConfigValue(config["secretKey"], ""); domain = GetConfigValue(config["domain"], "Users"); pWriteExceptionsToEventLog = Convert.ToBoolean(GetConfigValue(config["writeExceptionsToEventLog"], "true")); string temp_format = config["passwordFormat"]; if (temp_format == null) { temp_format = "Hashed"; } switch (temp_format) { case "Hashed": pPasswordFormat = MembershipPasswordFormat.Hashed; break; case "Encrypted": pPasswordFormat = MembershipPasswordFormat.Encrypted; break; case "Clear": pPasswordFormat = MembershipPasswordFormat.Clear; break; default: throw new ProviderException("Password format not supported."); } // // Initialize the SimpleDB Client. // client = new AmazonSimpleDBClient(accessKey, secretKey); // Make sure the domain for users exists CreateDomainRequest cdRequest = new CreateDomainRequest(); cdRequest.DomainName = domain; client.CreateDomain(cdRequest); // Get encryption and decryption key information from the configuration. Configuration cfg = WebConfigurationManager.OpenWebConfiguration(System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath); machineKey = (MachineKeySection)cfg.GetSection("system.web/machineKey"); if (machineKey.ValidationKey.Contains("AutoGenerate")) { if (PasswordFormat != MembershipPasswordFormat.Clear) { throw new ProviderException("Hashed or Encrypted passwords " + "are not supported with auto-generated keys."); } } }
public override void Initialize(string name, NameValueCollection config) { if (config == null) throw new ArgumentNullException("config"); if (name == null || name.Length == 0) name = "SDBProfileProvider"; // Initialize the abstract base class. base.Initialize(name, config); accessKey = GetConfigValue(config["accessKey"], ""); secretKey = GetConfigValue(config["secretKey"], ""); domain = GetConfigValue(config["domain"], "Profiles"); client = new AmazonSimpleDBClient(accessKey, secretKey); // Make sure the domain for user profiles exists CreateDomainRequest cdRequest = new CreateDomainRequest(); cdRequest.DomainName = domain; client.CreateDomain(cdRequest); }
public override void Initialize(string name, NameValueCollection config) { base.Initialize(name, config); accessKey = config["accessKey"]; secretKey = config["secretKey"]; if (string.IsNullOrEmpty(accessKey)) throw new ConfigurationErrorsException("AWS Access Key is required."); if (string.IsNullOrEmpty(secretKey)) throw new ConfigurationErrorsException("AWS Secret Key is required."); // Set any domain prefix if (!string.IsNullOrEmpty(config["domainPrefix"])) domainPrefix = config["domainPrefix"]; client = new AmazonSimpleDBClient(accessKey, secretKey); if (config["domains"] != null) { // Make sure domains exist string[] domains = config["domains"].ToString().Split(new char[] { ',' }); foreach (string domain in domains) { string _domain = SetDomain(domain); CreateDomainRequest request = new CreateDomainRequest().WithDomainName(_domain); client.CreateDomain(request); } } }
// // System.Configuration.Provider.ProviderBase.Initialize Method // public override void Initialize(string name, NameValueCollection config) { // // Initialize values from web.config. // if (config == null) throw new ArgumentNullException("config"); if (name == null || name.Length == 0) name = "SDBMembershipProvider"; // Initialize the abstract base class. base.Initialize(name, config); accessKey = GetConfigValue(config["accessKey"], ""); secretKey = GetConfigValue(config["secretKey"], ""); domain = GetConfigValue(config["domain"], "Users"); pWriteExceptionsToEventLog = Convert.ToBoolean(GetConfigValue(config["writeExceptionsToEventLog"], "true")); string temp_format = config["passwordFormat"]; if (temp_format == null) { temp_format = "Hashed"; } switch (temp_format) { case "Hashed": pPasswordFormat = MembershipPasswordFormat.Hashed; break; case "Encrypted": pPasswordFormat = MembershipPasswordFormat.Encrypted; break; case "Clear": pPasswordFormat = MembershipPasswordFormat.Clear; break; default: throw new ProviderException("Password format not supported."); } // // Initialize the SimpleDB Client. // client = new AmazonSimpleDBClient(accessKey, secretKey); // Make sure the domain for users exists CreateDomainRequest cdRequest = new CreateDomainRequest(); cdRequest.DomainName = domain; client.CreateDomain(cdRequest); // Get encryption and decryption key information from the configuration. Configuration cfg = WebConfigurationManager.OpenWebConfiguration(System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath); machineKey = (MachineKeySection)cfg.GetSection("system.web/machineKey"); if (machineKey.ValidationKey.Contains("AutoGenerate")) if (PasswordFormat != MembershipPasswordFormat.Clear) throw new ProviderException("Hashed or Encrypted passwords " + "are not supported with auto-generated keys."); }