Module: CfnCli::CfnStates

Included in:
Event, Stack
Defined in:
lib/cfncli/states.rb

Instance Method Summary collapse

Instance Method Details

#failed?Boolean

Indicates if the state is failed

Returns:

  • (Boolean)


19
20
21
# File 'lib/cfncli/states.rb', line 19

def failed?
  !succeeded? && !in_progress?
end

#failed_statesObject

List of failed or unknown states



69
70
71
# File 'lib/cfncli/states.rb', line 69

def failed_states
  states - success_states - transitive_states
end

#finished?Boolean

Indicates if the state is finished

Returns:

  • (Boolean)


4
5
6
# File 'lib/cfncli/states.rb', line 4

def finished?
  finished_states.include? status
end

#finished_statesObject

List of finished states



64
65
66
# File 'lib/cfncli/states.rb', line 64

def finished_states
  states - transitive_states
end

#in_progress?Boolean

Indicates if the state is a transition

Returns:

  • (Boolean)


14
15
16
# File 'lib/cfncli/states.rb', line 14

def in_progress?
  transitive_states.include? status
end

#statesObject

List of possible states



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/cfncli/states.rb', line 24

def states
  [
    'CREATE_IN_PROGRESS',
    'CREATE_IN_PROGRESS',
    'CREATE_FAILED',
    'CREATE_COMPLETE',
    'ROLLBACK_IN_PROGRESS',
    'ROLLBACK_FAILED',
    'ROLLBACK_COMPLETE',
    'DELETE_IN_PROGRESS',
    'DELETE_FAILED',
    'DELETE_COMPLETE',
    'UPDATE_IN_PROGRESS',
    'UPDATE_COMPLETE_CLEANUP_IN_PROGRESS',
    'UPDATE_COMPLETE',
    'UPDATE_ROLLBACK_IN_PROGRESS',
    'UPDATE_ROLLBACK_FAILED',
    'UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS',
    'UPDATE_ROLLBACK_COMPLETE',
    'REVIEW_IN_PROGRESS'
  ]
end

#succeeded?Boolean

Indicates if the state is successful

Returns:

  • (Boolean)


9
10
11
# File 'lib/cfncli/states.rb', line 9

def succeeded?
  success_states.include? status
end

#success_statesObject

List of successful states



48
49
50
51
52
53
54
# File 'lib/cfncli/states.rb', line 48

def success_states
  [
    'CREATE_COMPLETE',
    'DELETE_COMPLETE',
    'UPDATE_COMPLETE'
  ]
end

#transitive_statesObject

List of transitive states



57
58
59
60
61
# File 'lib/cfncli/states.rb', line 57

def transitive_states
  states.select do |state|
    state.end_with? 'IN_PROGRESS'
  end
end