Class: Stax::Cmd::Ssm
Constant Summary
collapse
- COLORS =
{
Online: :green,
ConnectionLost: :red,
}
Instance Method Summary
collapse
Methods inherited from SubCommand
#info, stax_info, stax_info_tasks
Instance Method Details
#commands ⇒ Object
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/stax/mixin/ssm.rb', line 81
def commands
print_table Aws::Ssm.commands.map { |c|
[
c.command_id,
c.document_name,
color(c.status, COLORS),
c.requested_date_time,
c.
]
}
end
|
#delete(*names) ⇒ Object
130
131
132
|
# File 'lib/stax/mixin/ssm.rb', line 130
def delete(*names)
puts my.ssm_parameter_delete(*names)
end
|
#get(name) ⇒ Object
115
116
117
|
# File 'lib/stax/mixin/ssm.rb', line 115
def get(name)
puts my.ssm_parameter_get(name)
end
|
#instances ⇒ Object
68
69
70
71
72
73
|
# File 'lib/stax/mixin/ssm.rb', line 68
def instances
print_table Aws::Ssm.instances(my.stack_name).map { |i|
agent = set_color(i.agent_version, i.is_latest_version ? :green : :yellow)
[i.instance_id, color(i.ping_status, COLORS), i.last_ping_date_time, agent]
}
end
|
#invocation(id = nil) ⇒ Object
94
95
96
97
98
99
|
# File 'lib/stax/mixin/ssm.rb', line 94
def invocation(id = nil)
id ||= Aws::Ssm.commands.first.command_id
Aws::Ssm.invocation(id).each do |i|
puts YAML.dump(stringify_keys(i.to_hash))
end
end
|
#parameters(path = my.ssm_parameter_path) ⇒ Object
104
105
106
107
108
109
110
111
112
|
# File 'lib/stax/mixin/ssm.rb', line 104
def parameters(path = my.ssm_parameter_path)
fields = %i[name type]
fields << :value if options[:decrypt]
print_table Aws::Ssm.parameters(
path: path,
with_decryption: options[:decrypt],
recursive: options[:recurse],
).map { |p| fields.map{ |f| p.send(f) } }
end
|
#put(name, value) ⇒ Object
123
124
125
126
127
|
# File 'lib/stax/mixin/ssm.rb', line 123
def put(name, value)
my.ssm_parameter_put(name, value, type: options[:type], key_id: options[:key], overwrite: options[:overwrite])
rescue ::Aws::SSM::Errors::ParameterAlreadyExists => e
warn(e.message)
end
|
#shellscript(*cmd) ⇒ Object
76
77
78
|
# File 'lib/stax/mixin/ssm.rb', line 76
def shellscript(*cmd)
my.ssm_run_shellscript(*cmd)
end
|