Container for the parameters to the CreateDomain operation.

The CreateDomain operation creates a new domain. The domain name should be unique among the domains associated with the Access Key ID provided in the request. The CreateDomain operation may take 10 or more seconds to complete.

NOTE: CreateDomain is an idempotent operation; running it multiple times using the same domain name will not result in an error response.

The client can create up to 100 domains per account.

If the client requires additional domains, go to http://aws.amazon.com/contact-us/simpledb-limit-request/ .

Inheritance: Amazon.Runtime.AmazonWebServiceRequest
 protected override void ProcessRecord()
 {
     AmazonSimpleDB client = base.GetClient();
     Amazon.SimpleDB.Model.CreateDomainRequest request = new Amazon.SimpleDB.Model.CreateDomainRequest();
     request.DomainName = this._DomainName;
     Amazon.SimpleDB.Model.CreateDomainResponse response = client.CreateDomain(request);
 }
 public void CreateDomain(string domainName)
 {
     var createDomainRequest = new CreateDomainRequest
                                   {
                                       DomainName = domainName
                                   };
     _simpleDbClient.CreateDomain(createDomainRequest);
 }
        public virtual void CreateDomain(string domainName)
        {
            var client = this.GetClient();
            var request = new CreateDomainRequest
                              {
                                  DomainName = domainName
                              };

            var response = client.CreateDomain(request);
        }
示例#4
0
        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);
            }
        }
        static void WriteToSimpleDb(AWSCredentials credentials)
        {
            var client = new AmazonSimpleDBClient(credentials, RegionEndpoint.USEast1);

            var request = new CreateDomainRequest("aws-talk");
            var response = client.CreateDomain(request);

            var putData = new PutAttributesRequest("aws-talk", "products/" + Guid.NewGuid().ToString(),
                new List<ReplaceableAttribute>()
                {
                    new ReplaceableAttribute("Name", "Couch", true),
                    new ReplaceableAttribute("Price", "20", true)
                });
            client.PutAttributes(putData);
        }
示例#6
0
 public SimpleDBAppender()
 {
     var client = new AmazonSimpleDBClient();
     ListDomainsRequest request=new ListDomainsRequest();
     var response = client.ListDomains(request);
     bool found = response.ListDomainsResult.DomainName.Any(d => d == DBName);
     if (!found)
     {
         CreateDomainRequest createDomainRequest =
             new CreateDomainRequest
                 {
                     DomainName = DBName
                 };
         client.CreateDomain(createDomainRequest);
     }
 }
示例#7
0
        public override void ActivateOptions()
        {
            base.ActivateOptions();

            var client   = new AmazonSimpleDBClient(Utility.GetRegionEndpoint());
            var request  = new ListDomainsRequest();
            var response = client.ListDomains(request);
            bool found   = response.ListDomainsResult.DomainNames.Any(d => d == DBName);
            if (!found)
            {
                var createDomainRequest =
                    new CreateDomainRequest
                    {
                        DomainName = DBName
                    };
                client.CreateDomain(createDomainRequest);
            }
        }
示例#8
0
        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);
        }
        /// <summary>
        /// Creates the SimpleDB Domain
        /// </summary>
        /// <param name="domainName"></param>
        public void CreateDomain(string domainName)
        {
            var request = new CreateDomainRequest { DomainName = domainName };

            Client.CreateDomain(request);
        }
 IAsyncResult invokeCreateDomain(CreateDomainRequest createDomainRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new CreateDomainRequestMarshaller().Marshall(createDomainRequest);
     var unmarshaller = CreateDomainResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
 public void CreateDomain(string name)
 {
     var request = new CreateDomainRequest().WithDomainName(name);
     client.CreateDomain(request);
 }
	    IAsyncResult AmazonSimpleDB.BeginCreateDomain(CreateDomainRequest request, AsyncCallback callback, object state)
	    {
	        throw new NotImplementedException();
	    }
 public void AddDomain(string domainName)
 {
     CreateDomainRequest myCreateDomainRequest = new CreateDomainRequest {DomainName = domainName};
     CreateDomainResponse response = Service.CreateDomain(myCreateDomainRequest);
 }
示例#14
0
 public override void CreateDomain(string Domain)
 {
     Domain = SetDomain(Domain);
     CreateDomainRequest request = new CreateDomainRequest().WithDomainName(Domain);
     client.CreateDomain(request);
 }
示例#15
0
        //
        // 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.");
        }
示例#16
0
        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);
                }
            }
        }
示例#17
0
        /// <summary>
        /// Initiates the asynchronous execution of the CreateDomain operation.
        /// <seealso cref="Amazon.SimpleDB.IAmazonSimpleDB.CreateDomain"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateDomain operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
		public Task<CreateDomainResponse> CreateDomainAsync(CreateDomainRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateDomainRequestMarshaller();
            var unmarshaller = CreateDomainResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, CreateDomainRequest, CreateDomainResponse>(request, marshaller, unmarshaller, signer, cancellationToken);
        }
示例#18
0
        /// <summary>
        /// <para> The <c>CreateDomain</c> operation creates a new domain. The domain name should be unique among the domains associated with the Access
        /// Key ID provided in the request. The <c>CreateDomain</c> operation may take 10 or more seconds to complete. </para> <para><b>NOTE:</b>
        /// CreateDomain is an idempotent operation; running it multiple times using the same domain name will not result in an error response. </para>
        /// <para> The client can create up to 100 domains per account. </para> <para> If the client requires additional domains, go to <a href="http://aws.amazon.com/contact-us/simpledb-limit-request/"> http://aws.amazon.com/contact-us/simpledb-limit-request/</a> .
        /// </para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateDomain service method on
        /// AmazonSimpleDB.</param>
        /// 
        /// <exception cref="T:Amazon.SimpleDB.Model.InvalidParameterValueException" />
        /// <exception cref="T:Amazon.SimpleDB.Model.NumberDomainsExceededException" />
        /// <exception cref="T:Amazon.SimpleDB.Model.MissingParameterException" />
		public CreateDomainResponse CreateDomain(CreateDomainRequest request)
        {
            var task = CreateDomainAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
        /// <summary>
        /// The <code>CreateDomain</code> operation creates a new domain. The domain name should
        /// be unique among the domains associated with the Access Key ID provided in the request.
        /// The <code>CreateDomain</code> operation may take 10 or more seconds to complete. 
        /// 
        ///  
        /// <para>
        ///  The client can create up to 100 domains per account. 
        /// </para>
        ///  
        /// <para>
        ///  If the client requires additional domains, go to <a href="http://aws.amazon.com/contact-us/simpledb-limit-request/">
        /// http://aws.amazon.com/contact-us/simpledb-limit-request/</a>. 
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the CreateDomain service method.</param>
        /// 
        /// <returns>The response from the CreateDomain service method, as returned by SimpleDB.</returns>
        /// <exception cref="InvalidParameterValueException">
        /// The value for a parameter is invalid.
        /// </exception>
        /// <exception cref="MissingParameterException">
        /// The request must contain the specified missing parameter.
        /// </exception>
        /// <exception cref="NumberDomainsExceededException">
        /// Too many domains exist per this account.
        /// </exception>
        public CreateDomainResponse CreateDomain(CreateDomainRequest request)
        {
            var marshaller = new CreateDomainRequestMarshaller();
            var unmarshaller = CreateDomainResponseUnmarshaller.Instance;

            return Invoke<CreateDomainRequest,CreateDomainResponse>(request, marshaller, unmarshaller);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the CreateDomain operation.
        /// <seealso cref="Amazon.SimpleDB.IAmazonSimpleDB"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateDomain operation on AmazonSimpleDBClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateDomain
        ///         operation.</returns>
        public IAsyncResult BeginCreateDomain(CreateDomainRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new CreateDomainRequestMarshaller();
            var unmarshaller = CreateDomainResponseUnmarshaller.Instance;

            return BeginInvoke<CreateDomainRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the CreateDomain operation.
        /// <seealso cref="Amazon.SimpleDB.IAmazonSimpleDB"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateDomain operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task<CreateDomainResponse> CreateDomainAsync(CreateDomainRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateDomainRequestMarshaller();
            var unmarshaller = CreateDomainResponseUnmarshaller.Instance;

            return InvokeAsync<CreateDomainRequest,CreateDomainResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
		internal CreateDomainResponse CreateDomain(CreateDomainRequest request)
        {
            var task = CreateDomainAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
	    CreateDomainResponse AmazonSimpleDB.CreateDomain(CreateDomainRequest request)
	    {
	        throw new NotImplementedException();
	    }
示例#24
0
 private void EnsureDomain(string storeIdentifier)
 {
     var createDomainRequest = new CreateDomainRequest().WithDomainName(storeIdentifier);
     _simpleDb.CreateDomain(createDomainRequest);
 }
 public void CreateDomain(string domainName)
 {
     var createDomain = new CreateDomainRequest().WithDomainName(domainName);
     var response = _service.CreateDomain(createDomain);
 }
        /// <summary>
        /// Creates the given domain
        /// </summary>
        /// <param name="domain"></param>
        private void CreateDomain(string domain)
        {
            if (!_isDomainCreated)
            {
                var request = new CreateDomainRequest()
                    .WithDomainName(domain);
                _simpleDbClient.CreateDomain(request);

                _isDomainCreated = true;
            }
        }
        public override void Initialize(string name, NameValueCollection config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (String.IsNullOrEmpty(name))
            {
                name = "SimpleDbMembershipProvider";
            }

            base.Initialize(name, config);
            string tempFormat = config["passwordFormat"];
            if (tempFormat == null)
            {
                tempFormat = "Hashed";
            }

            switch (tempFormat)
            {
                case "Hashed":
                {
                    this._passwordFormat = MembershipPasswordFormat.Hashed;
                    break;
                }
                case "Encrypted":
                {
                    this._passwordFormat = MembershipPasswordFormat.Encrypted;
                    break;
                }
                case "Clear":
                {
                    this._passwordFormat = MembershipPasswordFormat.Clear;
                    break;
                }
            }

            this._simpleDBClient = new AmazonSimpleDBClient(
                Settings.Default.AWSAccessKey.Trim(),
                Settings.Default.AWSSecretAccessKey.Trim()
                );

            CreateDomainRequest cdRequest = new CreateDomainRequest()
                .WithDomainName(Settings.Default.AWSMembershipDomain);
            try
            {
                this._simpleDBClient.CreateDomain(cdRequest);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.Write(String.Concat(e.Message, "\r\n", e.StackTrace));
                this.VerifyKeys();
            }
            Configuration cfg = WebConfigurationManager.OpenWebConfiguration(HostingEnvironment.ApplicationVirtualPath);
            this._machineKey = (MachineKeySection)cfg.GetSection("system.web/machineKey");
        }
 /// <summary>
 /// <para> The <c>CreateDomain</c> operation creates a new domain. The domain name should be unique among the domains associated with the Access
 /// Key ID provided in the request. The <c>CreateDomain</c> operation may take 10 or more seconds to complete. </para> <para><b>NOTE:</b>
 /// CreateDomain is an idempotent operation; running it multiple times using the same domain name will not result in an error response. </para>
 /// <para> The client can create up to 100 domains per account. </para> <para> If the client requires additional domains, go to <a
 /// href="http://aws.amazon.com/contact-us/simpledb-limit-request/" > http://aws.amazon.com/contact-us/simpledb-limit-request/</a> .
 /// </para>
 /// </summary>
 /// 
 /// <param name="createDomainRequest">Container for the necessary parameters to execute the CreateDomain service method on
 ///          AmazonSimpleDB.</param>
 /// 
 /// <exception cref="InvalidParameterValueException"/>
 /// <exception cref="NumberDomainsExceededException"/>
 /// <exception cref="MissingParameterException"/>
 public CreateDomainResponse CreateDomain(CreateDomainRequest createDomainRequest)
 {
     IAsyncResult asyncResult = invokeCreateDomain(createDomainRequest, null, null, true);
     return EndCreateDomain(asyncResult);
 }
        /// <summary>
        /// <para> The <c>CreateDomain</c> operation creates a new domain. The domain name should be unique among the domains associated with the Access
        /// Key ID provided in the request. The <c>CreateDomain</c> operation may take 10 or more seconds to complete. </para> <para><b>NOTE:</b>
        /// CreateDomain is an idempotent operation; running it multiple times using the same domain name will not result in an error response. </para>
        /// <para> The client can create up to 100 domains per account. </para> <para> If the client requires additional domains, go to <a href="http://aws.amazon.com/contact-us/simpledb-limit-request/"> http://aws.amazon.com/contact-us/simpledb-limit-request/</a> .
        /// </para>
        /// </summary>
        /// 
        /// <param name="createDomainRequest">Container for the necessary parameters to execute the CreateDomain service method on
        /// AmazonSimpleDB.</param>
        /// 
        /// <exception cref="T:Amazon.SimpleDB.Model.InvalidParameterValueException" />
        /// <exception cref="T:Amazon.SimpleDB.Model.NumberDomainsExceededException" />
        /// <exception cref="T:Amazon.SimpleDB.Model.MissingParameterException" />
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public async Task<CreateDomainResponse> CreateDomainAsync(CreateDomainRequest createDomainRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateDomainRequestMarshaller();
            var unmarshaller = CreateDomainResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, CreateDomainRequest, CreateDomainResponse>(createDomainRequest, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
 /// <summary>
 /// Initiates the asynchronous execution of the CreateDomain operation.
 /// <seealso cref="Amazon.SimpleDB.IAmazonSimpleDB.CreateDomain"/>
 /// </summary>
 /// 
 /// <param name="createDomainRequest">Container for the necessary parameters to execute the CreateDomain operation on AmazonSimpleDB.</param>
 /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
 /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 public IAsyncResult BeginCreateDomain(CreateDomainRequest createDomainRequest, AsyncCallback callback, object state)
 {
     return invokeCreateDomain(createDomainRequest, callback, state, false);
 }