Class: JFlow::Domain
- Inherits:
-
Object
- Object
- JFlow::Domain
- Defined in:
- lib/jflow/domain.rb
Instance Attribute Summary collapse
-
#domain_name ⇒ Object
readonly
Returns the value of attribute domain_name.
Instance Method Summary collapse
- #create ⇒ Object
- #exists? ⇒ Boolean
-
#initialize(domain_name) ⇒ Domain
constructor
A new instance of Domain.
Constructor Details
#initialize(domain_name) ⇒ Domain
Returns a new instance of Domain.
6 7 8 9 |
# File 'lib/jflow/domain.rb', line 6 def initialize(domain_name) @domain_name = domain_name create unless exists? end |
Instance Attribute Details
#domain_name ⇒ Object (readonly)
Returns the value of attribute domain_name.
4 5 6 |
# File 'lib/jflow/domain.rb', line 4 def domain_name @domain_name end |
Instance Method Details
#create ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/jflow/domain.rb', line 11 def create JFlow.configuration.logger.debug "Registering domain #{domain_name}" JFlow.configuration.swf_client.register_domain({ name: domain_name, description: domain_name, workflow_execution_retention_period_in_days: "90" }) end |
#exists? ⇒ Boolean
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/jflow/domain.rb', line 20 def exists? domains = JFlow.configuration.swf_client.list_domains({ registration_status: "REGISTERED" }) exists = domains.domain_infos .map{|a| a.name} .include?(domain_name) JFlow.configuration.logger.debug "#{domain_name} found: #{exists}" exists end |