Class: Awful::Config
Constant Summary
collapse
- COLORS =
{
ACTIVE: :green,
DELETING: :red,
DELETING_RESULTS: :red,
EVALUATING: :yellow,
COMPLIANT: :green,
NON_COMPLIANT: :red,
NOT_APPLICABLE: :yellow,
INSUFFICIENT_DATA: :yellow,
}
Instance Method Summary
collapse
Methods inherited from Cli
#initialize
Constructor Details
This class inherits a constructor from Awful::Cli
Instance Method Details
39
40
41
42
43
44
|
# File 'lib/awful/config.rb', line 39
def channels
config.describe_delivery_channels.delivery_channels.output do |list|
puts YAML.dump(list.map{ |channel| stringify_keys(channel.to_hash) })
end
end
|
#compliance(rule) ⇒ Object
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/awful/config.rb', line 71
def compliance(rule)
paginate(:evaluation_results) do |next_token|
config.get_compliance_details_by_config_rule(config_rule_name: rule, next_token: next_token)
end.output do |results|
print_table results.map { |r|
q = r.evaluation_result_identifier.evaluation_result_qualifier
[q.resource_type, q.resource_id, color(r.compliance_type), r.result_recorded_time]
}
end
end
|
#dump(*names) ⇒ Object
64
65
66
67
68
|
# File 'lib/awful/config.rb', line 64
def dump(*names)
config.describe_config_rules(config_rule_names: names).config_rules.output do |list|
puts YAML.dump(list.map{ |rule| stringify_keys(rule.to_hash) })
end
end
|
#evaluate(*names) ⇒ Object
83
84
85
|
# File 'lib/awful/config.rb', line 83
def evaluate(*names)
config.start_config_rules_evaluation(config_rule_names: names)
end
|
#recorders ⇒ Object
31
32
33
34
35
36
|
# File 'lib/awful/config.rb', line 31
def recorders
config.describe_configuration_recorders.configuration_recorders.output do |list|
puts YAML.dump(list.map{ |recorder| stringify_keys(recorder.to_hash) })
end
end
|
#rules(*names) ⇒ Object
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/awful/config.rb', line 48
def rules(*names)
paginate(:config_rules) do |next_token|
config.describe_config_rules(config_rule_names: names)
end.output do |rules|
if options[:long]
print_table rules.map { |r|
s = r.source
[r.config_rule_name, r.config_rule_id, color(r.config_rule_state), r.maximum_execution_frequency, s.owner, s.source_identifier]
}
else
puts rules.map(&:config_rule_name)
end
end
end
|