Class: RubyTerraform::Models::Plan
- Inherits:
-
Object
- Object
- RubyTerraform::Models::Plan
- Includes:
- ValueEquality
- Defined in:
- lib/ruby_terraform/models/plan.rb
Instance Method Summary collapse
- #format_version ⇒ Object
-
#initialize(content) ⇒ Plan
constructor
A new instance of Plan.
- #inspect ⇒ Object
- #output_changes ⇒ Object
- #output_changes_matching(definition) ⇒ Object
- #resource_changes ⇒ Object
- #resource_changes_matching(definition) ⇒ Object
- #state ⇒ Object
- #terraform_version ⇒ Object
- #to_h ⇒ Object
- #variable_values ⇒ Object
- #variables ⇒ Object
Methods included from ValueEquality
Constructor Details
#initialize(content) ⇒ Plan
Returns a new instance of Plan.
12 13 14 |
# File 'lib/ruby_terraform/models/plan.rb', line 12 def initialize(content) @content = symbolise_keys(content) end |
Instance Method Details
#format_version ⇒ Object
16 17 18 |
# File 'lib/ruby_terraform/models/plan.rb', line 16 def format_version @content[:format_version] end |
#inspect ⇒ Object
62 63 64 |
# File 'lib/ruby_terraform/models/plan.rb', line 62 def inspect @content.inspect end |
#output_changes ⇒ Object
47 48 49 50 51 52 |
# File 'lib/ruby_terraform/models/plan.rb', line 47 def output_changes (@content[:output_changes] || []) .map do |output_name, output_change| OutputChange.new(output_name, output_change) end end |
#output_changes_matching(definition) ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/ruby_terraform/models/plan.rb', line 54 def output_changes_matching(definition) output_changes.filter do |output_change| definition.all? do |method, value| output_change.send(method) == value end end end |
#resource_changes ⇒ Object
32 33 34 35 36 37 |
# File 'lib/ruby_terraform/models/plan.rb', line 32 def resource_changes (@content[:resource_changes] || []) .map do |resource_change| ResourceChange.new(resource_change) end end |
#resource_changes_matching(definition) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/ruby_terraform/models/plan.rb', line 39 def resource_changes_matching(definition) resource_changes.filter do |resource_change| definition.all? do |method, value| resource_change.send(method) == value end end end |
#state ⇒ Object
70 71 72 |
# File 'lib/ruby_terraform/models/plan.rb', line 70 def state [@content] end |
#terraform_version ⇒ Object
20 21 22 |
# File 'lib/ruby_terraform/models/plan.rb', line 20 def terraform_version @content[:terraform_version] end |
#to_h ⇒ Object
66 67 68 |
# File 'lib/ruby_terraform/models/plan.rb', line 66 def to_h @content end |
#variable_values ⇒ Object
28 29 30 |
# File 'lib/ruby_terraform/models/plan.rb', line 28 def variable_values variables.transform_values { |value| value[:value] } end |
#variables ⇒ Object
24 25 26 |
# File 'lib/ruby_terraform/models/plan.rb', line 24 def variables @content[:variables] || {} end |