Class: Commands::AbstractListCommand
Direct Known Subclasses
Instance Attribute Summary collapse
-
#active ⇒ Object
Returns the value of attribute active.
-
#all ⇒ Object
Returns the value of attribute all.
-
#created_after ⇒ Object
Returns the value of attribute created_after.
-
#created_before ⇒ Object
Returns the value of attribute created_before.
-
#max_results ⇒ Object
Returns the value of attribute max_results.
-
#no_steps ⇒ Object
Returns the value of attribute no_steps.
-
#state ⇒ Object
Returns the value of attribute state.
Attributes inherited from Command
#arg, #commands, #description, #logger, #name
Instance Method Summary collapse
Methods inherited from Command
#get_field, #has_value, #have, #initialize, #option, #require, #require_single_jobflow, #resolve, #validate
Constructor Details
This class inherits a constructor from Commands::Command
Instance Attribute Details
#active ⇒ Object
Returns the value of attribute active.
970 971 972 |
# File 'lib/commands.rb', line 970 def active @active end |
#all ⇒ Object
Returns the value of attribute all.
970 971 972 |
# File 'lib/commands.rb', line 970 def all @all end |
#created_after ⇒ Object
Returns the value of attribute created_after.
970 971 972 |
# File 'lib/commands.rb', line 970 def created_after @created_after end |
#created_before ⇒ Object
Returns the value of attribute created_before.
970 971 972 |
# File 'lib/commands.rb', line 970 def created_before @created_before end |
#max_results ⇒ Object
Returns the value of attribute max_results.
970 971 972 |
# File 'lib/commands.rb', line 970 def max_results @max_results end |
#no_steps ⇒ Object
Returns the value of attribute no_steps.
970 971 972 |
# File 'lib/commands.rb', line 970 def no_steps @no_steps end |
#state ⇒ Object
Returns the value of attribute state.
970 971 972 |
# File 'lib/commands.rb', line 970 def state @state end |
Instance Method Details
#enact(client) ⇒ Object
972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 |
# File 'lib/commands.rb', line 972 def enact(client) = {} states = [] if get_field(:jobflow, []).size > 0 then = { 'JobFlowIds' => get_field(:jobflow) } else if get_field(:active) then states = %w(RUNNING SHUTTING_DOWN STARTING WAITING BOOTSTRAPPING) end if get_field(:state) then states << get_field(:state) end if get_field(:all) then = { 'CreatedAfter' => (Time.now - (58 * 24 * 3600)).xmlschema } else = {} ['CreatedAfter'] = get_field(:created_after) if get_field(:created_after) ['CreatedBefore'] = get_field(:created_before) if get_field(:created_before) ['JobFlowStates'] = states if states.size > 0 end end result = client.describe_jobflow() # add the described jobflow to the supplied jobflows commands.[:jobflow] += result['JobFlows'].map { |x| x['JobFlowId'] } commands.[:jobflow].uniq! return result end |