Class: SsmUtils::GetParamsCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/ssm_utils/get_params_command.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ GetParamsCommand

Returns a new instance of GetParamsCommand.

Raises:

  • (ArgumentError)


6
7
8
9
10
11
12
13
14
15
16
# File 'lib/ssm_utils/get_params_command.rb', line 6

def initialize(options)
  opt = {
    decrypt: true,
    ssm_root: '/',
  }.merge(options)

  raise ArgumentError.new("No file path specified") if !opt.key?(:file_out)
  @file_out = opt[:file_out]
  @decrypt = opt[:decrypt]
  @ssm_root = opt[:ssm_root]
end

Instance Method Details

#executeObject



18
19
20
21
22
23
24
25
# File 'lib/ssm_utils/get_params_command.rb', line 18

def execute
  ssm = SsmUtils::SsmReaderDriver.new(decrypt: @decrypt, ssm_root: @ssm_root)
  params = ssm.

  File.open(@file_out, 'w') do |f|
    YAML.dump(params, f, line_width: -1)
  end
end