awful 0.0.179 → 0.0.180

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d9607be5b39743ff7c28a366716d8b07827db9a3
4
- data.tar.gz: a131e49f01bd4e1061e5c307cf754609e69ae05a
3
+ metadata.gz: 8e11f3359fe4adb56535cfd09a2baea8eca683d4
4
+ data.tar.gz: 7d18da124bd687439a1b9dc01f6c5be1b35d59d9
5
5
  SHA512:
6
- metadata.gz: 1b4ac18c28b9f0a62f3d56536de65e3f8a2db24ceb3c19f56f8ef7a289f68b05e69304064a6920e4a67dc99baba8cff9a2dff5402f55489ce3f76d3eb7e8e62c
7
- data.tar.gz: c63cb7263cb7e71e0c8cc2ebc0bfb0de3b6e6b7a8f9ae34a29bdce66b5fd2c444296680521733234f2577662e90754ce45b9a498ca6a61bd7df96568c8764013
6
+ metadata.gz: 7cd7d321f9dbd8aa02d8b696fc7a2baecec2dab180b32a4f458c777754361418af7b0a474bc64f1eff1688da1fcc9ee339e13ea8e33e6aea0c5db383a1381625
7
+ data.tar.gz: f23c217fc9e4e08a206f487e02bd5fd49b9916729cc883580f3f70be62781260a70e43943fb64a6309127254f3b4a69b5850771011e66a1ac91cca009065d24c
data/bin/config ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ #-*- mode: ruby; -*-
3
+
4
+ require 'awful'
5
+ require 'awful/config'
6
+
7
+ Awful::Config.start(ARGV)
@@ -0,0 +1,88 @@
1
+ module Awful
2
+ module Short
3
+ def config(*args)
4
+ Awful::Config.new.invoke(*args)
5
+ end
6
+ end
7
+
8
+ class Config < Cli
9
+ COLORS = {
10
+ ACTIVE: :green,
11
+ DELETING: :red,
12
+ DELETING_RESULTS: :red,
13
+ EVALUATING: :yellow,
14
+ COMPLIANT: :green,
15
+ NON_COMPLIANT: :red,
16
+ NOT_APPLICABLE: :yellow,
17
+ INSUFFICIENT_DATA: :yellow,
18
+ }
19
+
20
+ no_commands do
21
+ def config
22
+ @_config ||= Aws::ConfigService::Client.new
23
+ end
24
+
25
+ def color(string)
26
+ set_color(string, COLORS.fetch(string.to_sym, :yellow))
27
+ end
28
+ end
29
+
30
+ desc 'recorders', 'show delivery recorders'
31
+ def recorders
32
+ config.describe_configuration_recorders.configuration_recorders.output do |list|
33
+ ## there is likely only one, so dump it
34
+ puts YAML.dump(list.map{ |recorder| stringify_keys(recorder.to_hash) })
35
+ end
36
+ end
37
+
38
+ desc 'channels', 'list delivery channels'
39
+ def channels
40
+ config.describe_delivery_channels.delivery_channels.output do |list|
41
+ ## there is likely only one, so dump it
42
+ puts YAML.dump(list.map{ |channel| stringify_keys(channel.to_hash) })
43
+ end
44
+ end
45
+
46
+ desc 'rules [NAMES]', 'list config rules'
47
+ method_option :long, aliases: '-l', type: :boolean, default: false, desc: 'long listing'
48
+ def rules(*names)
49
+ paginate(:config_rules) do |next_token|
50
+ config.describe_config_rules(config_rule_names: names)
51
+ end.output do |rules|
52
+ if options[:long]
53
+ print_table rules.map { |r|
54
+ s = r.source
55
+ [r.config_rule_name, r.config_rule_id, color(r.config_rule_state), r.maximum_execution_frequency, s.owner, s.source_identifier]
56
+ }
57
+ else
58
+ puts rules.map(&:config_rule_name)
59
+ end
60
+ end
61
+ end
62
+
63
+ desc 'dump NAMES', 'get configuration for rules'
64
+ def dump(*names)
65
+ config.describe_config_rules(config_rule_names: names).config_rules.output do |list|
66
+ puts YAML.dump(list.map{ |rule| stringify_keys(rule.to_hash) })
67
+ end
68
+ end
69
+
70
+ desc 'compliance RULE', 'get compliance status for rule'
71
+ def compliance(rule)
72
+ paginate(:evaluation_results) do |next_token|
73
+ config.get_compliance_details_by_config_rule(config_rule_name: rule, next_token: next_token)
74
+ end.output do |results|
75
+ print_table results.map { |r|
76
+ q = r.evaluation_result_identifier.evaluation_result_qualifier
77
+ [q.resource_type, q.resource_id, color(r.compliance_type), r.result_recorded_time]
78
+ }
79
+ end
80
+ end
81
+
82
+ desc 'evaluate NAMES', 'run on-demand evaluation for rules'
83
+ def evaluate(*names)
84
+ config.start_config_rules_evaluation(config_rule_names: names)
85
+ end
86
+
87
+ end
88
+ end
data/lib/awful/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Awful
2
- VERSION = '0.0.179'
2
+ VERSION = '0.0.180'
3
3
  end
data/lib/awful/vpce.rb CHANGED
@@ -27,9 +27,9 @@ module Awful
27
27
  def ls(*ids)
28
28
  filters = [
29
29
  { name: 'vpc-endpoint-id', values: ids },
30
- { name: 'vpc-id', values: options[:vpc] },
31
- { name: 'service-name', values: options[:service].map { |s| "com.amazonaws.#{ENV['AWS_REGION']}.#{s.downcase}" } },
32
- { name: 'vpc-endpoint-state', values: options[:state] },
30
+ { name: 'vpc-id', values: Array(options[:vpc]) },
31
+ { name: 'service-name', values: Array(options[:service]).map { |s| "com.amazonaws.#{ENV['AWS_REGION']}.#{s.downcase}" } },
32
+ { name: 'vpc-endpoint-state', values: Array(options[:state]) },
33
33
  ].reject { |f| f[:values].empty? }
34
34
  filters = nil if filters.empty?
35
35
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awful
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.179
4
+ version: 0.0.180
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ric Lister
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-11 00:00:00.000000000 Z
11
+ date: 2017-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -93,6 +93,7 @@ executables:
93
93
  - certs
94
94
  - cf
95
95
  - cloudfront
96
+ - config
96
97
  - cwevents
97
98
  - cwlogs
98
99
  - dp
@@ -140,6 +141,7 @@ files:
140
141
  - bin/certs
141
142
  - bin/cf
142
143
  - bin/cloudfront
144
+ - bin/config
143
145
  - bin/cwevents
144
146
  - bin/cwlogs
145
147
  - bin/dp
@@ -186,6 +188,7 @@ files:
186
188
  - lib/awful/cloudfront.rb
187
189
  - lib/awful/cloudwatch_events.rb
188
190
  - lib/awful/cloudwatch_logs.rb
191
+ - lib/awful/config.rb
189
192
  - lib/awful/datapipeline.rb
190
193
  - lib/awful/dynamodb.rb
191
194
  - lib/awful/dynamodb_streams.rb