Class: AWS::SimpleDB::DomainCollection

Inherits:
Object
  • Object
show all
Includes:
Core::Collection::WithLimitAndNextToken
Defined in:
lib/aws/simple_db/domain_collection.rb

Overview

An Enumerable collection representing all your domains in SimpleDB.

Use a DomainCollection to create, get and list domains.

Examples:

Creating a domain in SimpleDB


sdb = SimpleDB.new
domain = sdb.domains.create('mydomain')

Getting a domain with indifferent access


domain = sdb.domains[:mydomain]
domain = sdb.domains['mydomain']

Enumerating domains


sdb.domains.each do |domain|
  puts domain.name
end

See Also:

Instance Method Summary collapse

Methods included from Core::Collection

#each, #each_batch, #enum, #first, #in_groups_of, #page

Instance Method Details

#[](domain_name) ⇒ Domain

Note:

This does not attempt to create the domain if it does not already exist in SimpleDB. Use #create to add a domain to SDB.

Returns a domain object with the given name.

Parameters:

  • domain_name (String)

    The name of the domain to return.

Returns:

  • (Domain)

    Returns the domain with the given name.



64
65
66
# File 'lib/aws/simple_db/domain_collection.rb', line 64

def [] domain_name
  Domain.new(domain_name.to_s, :config => config)
end

#create(domain_name) ⇒ Domain

Note:

This operation might take 10 or more seconds to complete.

Note:

Creating a domain in SimpleDB is an idempotent operation; running it multiple times using the same domain name will not result in an error.

Note:

You can create up to 250 domains per account.

Creates a domain in SimpleDB and returns a domain object.

Parameters:

  • domain_name (String)

Returns:

  • (Domain)

    Returns a new domain with the given name.



52
53
54
55
# File 'lib/aws/simple_db/domain_collection.rb', line 52

def create(domain_name)
  client.create_domain(:domain_name => domain_name)
  self[domain_name]
end