awful 0.0.112 → 0.0.113

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: 1c361bdaf2fea980f983affc7368405006220ae3
4
- data.tar.gz: 218c517bebaf8a49a58c55b507a530d420cb101f
3
+ metadata.gz: 740abcafb75013a9f6426c4b927e082a144b7ca1
4
+ data.tar.gz: a2306eacc1a7a13375770ef30a4840faf6a54b59
5
5
  SHA512:
6
- metadata.gz: 22c796a23b6c751eb65a417ebfb2e6c758d9a2a288d3f25344fa9eb52655633bbde5ac93319cae0977f1db30beb7f455155260cf4bc4ce11afb4f423fa83f4ab
7
- data.tar.gz: ad3708ae9e78454866f17a184d6f76fcb4ec9bfb3dced83a48835d52c866b3549b4a933608b654e2e4b71144924107d80ef37194c0273a6da30cb551a63c8391
6
+ metadata.gz: 284b0c13c2c2827966d18ef8fb3642dfccd6344d3bbe48b1001748c0bab536717fac9a62d48ba125b9403b6ebab2edc5b03a7cbfa7c6a1c9984dff8e0aa2ad00
7
+ data.tar.gz: 96bbd4ad0579e7a064ffba2135d2f7d671a468f4339bdb3726d2847294283960d4fbee5d5014edfb6046029480758be43c387c7126025e8b864fcf8d54103e00
data/bin/cwevents ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/ruby
2
+ #-*- mode: ruby; -*-
3
+
4
+ require 'awful'
5
+ require 'awful/cloudwatch_events'
6
+
7
+ Awful::CloudWatchEvents.start(ARGV)
@@ -0,0 +1,80 @@
1
+ module Awful
2
+ module Short
3
+ def cwevents(*args)
4
+ Awful::CloudWatchEvents.new.invoke(*args)
5
+ end
6
+ end
7
+
8
+ class CloudWatchEvents < Cli
9
+ COLORS = {
10
+ ENABLED: :green,
11
+ DISABLED: :yellow,
12
+ }
13
+
14
+ no_commands do
15
+ def events
16
+ @events ||= Aws::CloudWatchEvents::Client.new
17
+ end
18
+
19
+ def color(string)
20
+ set_color(string, COLORS.fetch(string.to_sym, :yellow))
21
+ end
22
+ end
23
+
24
+ desc 'ls [PREFIX]', 'list events'
25
+ method_option :long, aliases: '-l', default: false, desc: 'Long listing'
26
+ def ls(prefix = nil)
27
+ next_token = nil
28
+ rules = []
29
+ loop do
30
+ response = events.list_rules(name_prefix: prefix, next_token: next_token)
31
+ rules = rules + response.rules
32
+ next_token = response.next_token
33
+ break if next_token.nil?
34
+ end
35
+
36
+ rules.tap do |list|
37
+ if options[:long]
38
+ print_table list.map { |r|
39
+ [
40
+ r.name,
41
+ color(r.state),
42
+ r.schedule_expression,
43
+ r.description,
44
+ ]
45
+ }
46
+ else
47
+ puts list.map(&:name)
48
+ end
49
+ end
50
+ end
51
+
52
+ desc 'dump NAME', 'describe named rule'
53
+ def dump(name)
54
+ events.describe_rule(name: name).tap do |rule|
55
+ puts YAML.dump(stringify_keys(rule.to_hash))
56
+ end
57
+ end
58
+
59
+ desc 'targets NAME', 'list targets for named rule'
60
+ method_option :long, aliases: '-l', default: false, desc: 'Long listing'
61
+ def targets(name)
62
+ next_token = nil
63
+ targets = []
64
+ loop do
65
+ response = events.list_targets_by_rule(rule: name)
66
+ targets = targets + response.targets
67
+ next_token = response.next_token
68
+ break if next_token.nil?
69
+ end
70
+ targets.tap do |list|
71
+ if options[:long]
72
+ print_table list.map { |t| [t.id, t.arn, t.input, t.input_path] }
73
+ else
74
+ puts list.map(&:arn)
75
+ end
76
+ end
77
+ end
78
+
79
+ end
80
+ end
@@ -16,25 +16,29 @@ module Awful
16
16
  method_option :long, aliases: '-l', default: false, desc: 'Long listing'
17
17
  def ls(prefix = nil)
18
18
  next_token = nil
19
+ log_groups = []
19
20
  loop do
20
21
  response = logs.describe_log_groups(log_group_name_prefix: prefix, next_token: next_token)
21
- response.log_groups.tap do |groups|
22
- if options[:long]
23
- print_table groups.map { |group|
24
- [
25
- group.log_group_name,
26
- group.retention_in_days,
27
- Time.at(group.creation_time.to_i/1000),
28
- group.stored_bytes,
29
- ]
30
- }
31
- else
32
- puts groups.map(&:log_group_name)
33
- end
34
- end
22
+ log_groups = log_groups + response.log_groups
35
23
  next_token = response.next_token
36
24
  break if next_token.nil?
37
25
  end
26
+
27
+ ## return and output groups
28
+ log_groups.tap do |groups|
29
+ if options[:long]
30
+ print_table groups.map { |group|
31
+ [
32
+ group.log_group_name,
33
+ group.retention_in_days,
34
+ Time.at(group.creation_time.to_i/1000),
35
+ group.stored_bytes,
36
+ ]
37
+ }
38
+ else
39
+ puts groups.map(&:log_group_name)
40
+ end
41
+ end
38
42
  end
39
43
 
40
44
  desc 'create NAME', 'create log group'
data/lib/awful/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Awful
2
- VERSION = '0.0.112'
2
+ VERSION = '0.0.113'
3
3
  end
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.112
4
+ version: 0.0.113
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ric Lister
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-06 00:00:00.000000000 Z
11
+ date: 2016-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -88,6 +88,7 @@ executables:
88
88
  - asg
89
89
  - asgn
90
90
  - cf
91
+ - cwevents
91
92
  - cwlogs
92
93
  - dp
93
94
  - dyn
@@ -123,6 +124,7 @@ files:
123
124
  - bin/asg
124
125
  - bin/asgn
125
126
  - bin/cf
127
+ - bin/cwevents
126
128
  - bin/cwlogs
127
129
  - bin/dp
128
130
  - bin/dyn
@@ -151,6 +153,7 @@ files:
151
153
  - lib/awful/auto_scaling_notifications.rb
152
154
  - lib/awful/changesets.rb
153
155
  - lib/awful/cloudformation.rb
156
+ - lib/awful/cloudwatch_events.rb
154
157
  - lib/awful/cloudwatch_logs.rb
155
158
  - lib/awful/datapipeline.rb
156
159
  - lib/awful/dynamodb.rb