Class: Awful::Param
Instance Method Summary
collapse
Methods inherited from Cli
#initialize
Constructor Details
This class inherits a constructor from Awful::Cli
Instance Method Details
#delete(name) ⇒ Object
94
95
96
97
98
|
# File 'lib/awful/param.rb', line 94
def delete(name)
if options[:yes] || yes?("Really delete parameter #{name}?", :yellow)
ssm.delete_parameter(name: name)
end
end
|
#get(*names) ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/awful/param.rb', line 40
def get(*names)
names.each_slice(10).map do |batch| ssm.get_parameters(names: batch, with_decryption: options[:decrypt]).parameters
end.flatten.output do |params|
if options[:long]
print_table params.map { |p|
[p.name, p.value]
}
else
puts params.map(&:value)
end
end
end
|
#history(name) ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/awful/param.rb', line 56
def history(name)
paginate(:parameters) do |token|
ssm.get_parameter_history(
name: name,
with_decryption: options[:decrypt],
next_token: token,
)
end.output do |params|
if options[:long]
print_table params.map { |p|
[p.name, p.value, p.last_modified_date, p.last_modified_user]
}
else
puts params.map(&:value)
end
end
end
|
#ls(*names) ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/awful/param.rb', line 19
def ls(*names)
filters = []
filters += [{key: 'Name', values: names}] unless names.empty?
filters += [{key: 'Type', values: options[:type]}] if options[:type]
filters += [{key: 'KeyId', values: options[:key_id]}] if options[:key_id]
paginate(:parameters) do |token|
ssm.describe_parameters(filters: filters, next_token: token)
end.output do |params|
if options[:long]
print_table params.map { |p|
[p.name, p.type, p.description, p.key_id, p.last_modified_date, p.last_modified_user.split('/').last]
}
else
puts params.map(&:name)
end
end
end
|
#put(name = nil, value = nil) ⇒ Object
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/awful/param.rb', line 81
def put(name = nil, value = nil)
ssm.put_parameter(
name: options[:name] || name,
value: options[:value] || value,
description: options[:description],
type: options[:type],
key_id: options[:key_id],
overwrite: options[:overwrite],
)
end
|