Class: Dev::Aws::Cloudformation::Parameters

Inherits:
Object
  • Object
show all
Defined in:
lib/firespring_dev_commands/aws/cloudformation/parameters.rb

Overview

Class which contains Parameters for a Aws cloudformation stack

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parameters = {}) ⇒ Parameters

Returns a new instance of Parameters.



8
9
10
11
12
# File 'lib/firespring_dev_commands/aws/cloudformation/parameters.rb', line 8

def initialize(parameters = {})
  raise 'parameters should be a hash' unless parameters.is_a?(Hash)

  @parameters = parameters
end

Instance Attribute Details

#parametersObject

Returns the value of attribute parameters.



6
7
8
# File 'lib/firespring_dev_commands/aws/cloudformation/parameters.rb', line 6

def parameters
  @parameters
end

Instance Method Details

#defaultObject

Returns the given parameters in their default format. Can be passed to a create or update command



15
16
17
# File 'lib/firespring_dev_commands/aws/cloudformation/parameters.rb', line 15

def default
  parameters.map { |k, v| {parameter_key: k, parameter_value: v} }
end

#preserveObject

Returns the given parameters all set to use the previous values specified in their templates



20
21
22
# File 'lib/firespring_dev_commands/aws/cloudformation/parameters.rb', line 20

def preserve
  parameters.map { |k, _| {parameter_key: k, use_previous_value: true} }
end