Class: Awful::CloudWatchEvents
- Inherits:
-
Cli
show all
- Defined in:
- lib/awful/cloudwatch_events.rb
Constant Summary
collapse
- COLORS =
{
ENABLED: :green,
DISABLED: :yellow,
}
Instance Method Summary
collapse
Methods inherited from Cli
#initialize, #ll, #version
Constructor Details
This class inherits a constructor from Awful::Cli
Instance Method Details
#dump(name) ⇒ Object
49
50
51
52
53
|
# File 'lib/awful/cloudwatch_events.rb', line 49
def dump(name)
events.describe_rule(name: name).tap do |rule|
puts YAML.dump(stringify_keys(rule.to_hash))
end
end
|
#ls(prefix = nil) ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/awful/cloudwatch_events.rb', line 22
def ls(prefix = nil)
next_token = nil
rules = []
loop do
response = events.list_rules(name_prefix: prefix, next_token: next_token)
rules = rules + response.rules
next_token = response.next_token
break if next_token.nil?
end
rules.tap do |list|
if options[:long]
print_table list.map { |r|
[
r.name,
color(r.state),
r.schedule_expression,
r.description,
]
}
else
puts list.map(&:name)
end
end
end
|
#targets(name) ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/awful/cloudwatch_events.rb', line 57
def targets(name)
next_token = nil
targets = []
loop do
response = events.list_targets_by_rule(rule: name)
targets = targets + response.targets
next_token = response.next_token
break if next_token.nil?
end
targets.tap do |list|
if options[:long]
print_table list.map { |t| [t.id, t.arn, t.input, t.input_path] }
else
puts list.map(&:arn)
end
end
end
|