Class: Sfn::Collection

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/sfn/collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCollection

Returns a new instance of Collection.



11
12
13
14
15
# File 'lib/sfn/collection.rb', line 11

def initialize
  response = AwsCli.run('stepfunctions', 'list-state-machines', {})
  parsed_response = JSON.parse(response)
  @all = parsed_response['stateMachines'] || []
end

Instance Attribute Details

#allObject (readonly)

Returns the value of attribute all.



9
10
11
# File 'lib/sfn/collection.rb', line 9

def all
  @all
end

Instance Method Details

#add(state_machine) ⇒ Object



17
18
19
# File 'lib/sfn/collection.rb', line 17

def add(state_machine)
  @all.push(state_machine.slice('stateMachineArn', 'name'))
end

#delete_by_arn(state_machine_arn) ⇒ Object



21
22
23
# File 'lib/sfn/collection.rb', line 21

def delete_by_arn(state_machine_arn)
  @all.delete_if { |sf| sf['stateMachineArn'] == state_machine_arn }
end