Class: AWS::SimpleWorkflow::DomainCollection
- Inherits:
-
Object
- Object
- AWS::SimpleWorkflow::DomainCollection
- Includes:
- Core::Collection::Limitable, OptionFormatters
- Defined in:
- lib/aws/simple_workflow/domain_collection.rb
Overview
The primary interface for registerign, listing and deprecating domains.
Creating a Domain
To create a domain you need to pass a unique name to #create.
domain = simple_workflow.domains.create('my-domain', :none)
#=> #<AWS::SimpleWorkflow::Domain name:my-domain>
Gettin a Domain
Domains are indexed by their name.
domain = simple_workflow.domains['my-domain']
Enumerating Domains
You can call Enumerable methods on a domain collection to iterate the domains controlled by your account.
simple_workflow.domains.each {|domain| ... }
By default only registered domains are enumerated. If you would like to enumerate deprecated (deleted) domains you need to pass the :deprecated
option.
# returns an array of names for all deprecated domains
simple_workflow.domains.deprecated.map(&:name)
See Core::Collection to see other useful methods you can call against a domain collection (e.g. #enum, #page, #each_batch).
Instance Attribute Summary
Attributes included from Core::Model
Instance Method Summary collapse
-
#[](name) ⇒ Domain
Returns the domain with the given name.
-
#deprecated ⇒ DomainCollection
Returns a domain collection that will only enumerate deprecated (deleted) domains.
-
#initialize(options = {}) ⇒ DomainCollection
constructor
A new instance of DomainCollection.
-
#register(name, retention_period, options = {}) ⇒ Domain
(also: #create)
Registers a new domain.
-
#registered ⇒ DomainCollection
Returns a domain collection that will only enumerate registered domains.
-
#reverse_order ⇒ DomainCollection
Returns a domain collection that enumerates domains in reverse alphabetical order.
Methods included from Core::Collection::Limitable
Methods included from Core::Collection
#each, #each_batch, #enum, #first, #in_groups_of, #page
Methods included from Core::Model
#client, #config_prefix, #inspect
Constructor Details
#initialize(options = {}) ⇒ DomainCollection
Returns a new instance of DomainCollection.
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/aws/simple_workflow/domain_collection.rb', line 55 def initialize = {} @registration_status = [:registration_status] ? [:registration_status].to_s.upcase : 'REGISTERED' @reverse_order = .key?(:reverse_order) ? !![:reverse_order] : false super() end |
Instance Method Details
#[](name) ⇒ Domain
Returns the domain with the given name.
111 112 113 |
# File 'lib/aws/simple_workflow/domain_collection.rb', line 111 def [] name Domain.new(name, :config => config) end |
#deprecated ⇒ DomainCollection
Returns a domain collection that will only enumerate deprecated (deleted) domains.
123 124 125 |
# File 'lib/aws/simple_workflow/domain_collection.rb', line 123 def deprecated collection_with(:registration_status => 'DEPRECATED') end |
#register(name, retention_period, options = {}) ⇒ Domain Also known as: create
Registers a new domain.
# register a domain named 'domain' that has no expiry on workflow
# execution history
domain = AWS::SimpleWorkflow.new.domains.register('domain', :none)
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/aws/simple_workflow/domain_collection.rb', line 92 def register name, retention_period, = {} client_opts = {} client_opts[:name] = name client_opts[:workflow_execution_retention_period_in_days] = retention_period client_opts[:description] = [:description] if [:description] duration_opts(client_opts, :workflow_execution_retention_period_in_days) client.register_domain(client_opts) client_opts[:retention_period] = retention_period.to_s =~ /^\d+$/ ? retention_period.to_i : retention_period.to_s.downcase.to_sym Domain.new(name, client_opts.merge(:config => config)) end |
#registered ⇒ DomainCollection
Returns a domain collection that will only enumerate registered domains.
117 118 119 |
# File 'lib/aws/simple_workflow/domain_collection.rb', line 117 def registered collection_with(:registration_status => 'REGISTERED') end |
#reverse_order ⇒ DomainCollection
Returns a domain collection that enumerates domains in reverse alphabetical order. Default ordering is ascending alphabetical.
130 131 132 |
# File 'lib/aws/simple_workflow/domain_collection.rb', line 130 def reverse_order collection_with(:reverse_order => true) end |