class AWS::SimpleDB::DomainCollection
end
puts domain.name
sdb.domains.each do |domain|
@example Enumerating domains
domain = sdb.domains[‘mydomain’]
domain = sdb.domains[:mydomain]
@example Getting a domain with indifferent access
domain = sdb.domains.create(‘mydomain’)
sdb = SimpleDB.new
@example Creating a domain in SimpleDB
Use a DomainCollection to create, get and list domains.
An Enumerable collection representing all your domains in SimpleDB.
def [] domain_name
-
(Domain)
- Returns the domain with the given name.
Parameters:
-
domain_name
(String
) -- The name of the domain to return.
Other tags:
- Note: - This does not attempt to create the domain if it does not
def [] domain_name domain_named(domain_name) end
def create(domain_name)
-
(Domain)
- Returns a new domain with the given name.
Parameters:
-
domain_name
(String
) --
Other tags:
- Note: - You can create up to 100 domains per account.
Note: - Creating a domain in SimpleDB is an idempotent operation;
Note: - This operation might take 10 or more seconds to complete.
def create(domain_name) client.create_domain(:domain_name => domain_name) domain_named(domain_name) end
def domain_named name
def domain_named name Domain.new(name.to_s, :config => config) end
def each options = {}, &block
-
(nil)
-
Options Hash:
(**options)
-
:batch_size
(Integer
) -- The number of domains to -
:limit
(Integer
) -- The maximum number of
Parameters:
-
options
(Hash
) --
Other tags:
- Yieldparam: domain -
Other tags:
- Yield: - Yields once for every domain in your account.
Other tags:
- Note: - Normally your account has a limit of 100 SimpleDB domains. You can {request more here}[http://aws.amazon.com/contact-us/simpledb-limit-request/]
def each options = {}, &block total_limit = options[:limit] batch_size = options[:batch_size] || 100 received = 0 next_token = nil begin limit = total_limit ? [total_limit - received, batch_size].min : batch_size list_options = { :max_number_of_domains => limit } list_options[:next_token] = next_token if next_token list = client.list_domains(list_options) next_token = list[:next_token] received += list[:domain_names].size list[:domain_names].each do |name| yield(domain_named(name)) end end while next_token and (total_limit.nil? or received < total_limit) nil end