awful 0.0.99 → 0.0.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1935f189e3bb66a8e2d91d3eb0c517400ad25ab
4
- data.tar.gz: 093c657cd3dd61d75d61d5dc4db3351de8911d5f
3
+ metadata.gz: 50d02ca7f4785757f6395f57adfb6abc67ebe910
4
+ data.tar.gz: 94e397b20a81d50055b58fa59ed89b514df689a6
5
5
  SHA512:
6
- metadata.gz: bbf648caf7fc17846ad50e5b4237b8a640994f012a3bd89ee941a8f87e26436adb0fcb1f515ba750cee148a48f8f305b37b8f64719279e650631bbfc3453e1eb
7
- data.tar.gz: 9b28d690e769b5d681380997f7e8be742a7ceed7033e96368f6e9a1bc55e8d51723096447be35c49dc0ac8479707b67e33e11641c33212aeba328848821d9520
6
+ metadata.gz: 628f75c481ce62633bc10f651859938930529d68fcf98e81bc636a52b70eabd918a6f6458553f93e4d320d44460c634ad218495a1f3138ae369c99a52b812310
7
+ data.tar.gz: 5914cbd75df8144b5428772b83716a4b2192718bb48720fdca68f48335315f1d152721979984ab9ffcccb345c1f78a812607a168dc738bef1beb66ab2314441e
data/bin/elasticache ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/ruby
2
+ #-*- mode: ruby; -*-
3
+
4
+ require 'awful'
5
+ require 'awful/elasticache'
6
+
7
+ Awful::ElastiCache.start(ARGV)
@@ -0,0 +1,74 @@
1
+ require 'yaml'
2
+
3
+ module Awful
4
+ module Short
5
+ def elasticache(*args)
6
+ Awful::ElastiCache.new.invoke(*args)
7
+ end
8
+ end
9
+
10
+ class ElastiCache < Cli
11
+ COLORS = {
12
+ available: :green,
13
+ deleted: :red
14
+ }
15
+
16
+ no_commands do
17
+ def elasticache
18
+ @elasticache ||= Aws::ElastiCache::Client.new
19
+ end
20
+
21
+ def color(string)
22
+ set_color(string, COLORS.fetch(string.to_sym, :yellow))
23
+ end
24
+ end
25
+
26
+ desc 'ls [ID]', 'list clusters'
27
+ method_option :long, aliases: '-l', default: false, desc: 'Long listing'
28
+ def ls(id = nil)
29
+ elasticache.describe_cache_clusters(cache_cluster_id: id).cache_clusters.tap do |clusters|
30
+ if options[:long]
31
+ print_table clusters.map { |c|
32
+ [
33
+ c.cache_cluster_id,
34
+ c.engine,
35
+ c.engine_version,
36
+ c.num_cache_nodes,
37
+ c.cache_node_type,
38
+ c.preferred_availability_zone,
39
+ color(c.cache_cluster_status),
40
+ c.cache_cluster_create_time
41
+ ]
42
+ }
43
+ else
44
+ puts clusters.map(&:cache_cluster_id)
45
+ end
46
+ end
47
+ end
48
+
49
+ desc 'dump [ID]', 'get all details for given cluster'
50
+ method_option :nodes, aliases: '-n', type: :boolean, default: false, desc: 'show node info'
51
+ def dump(id = nil)
52
+ elasticache.describe_cache_clusters(
53
+ cache_cluster_id: id,
54
+ show_cache_node_info: options[:nodes]
55
+ ).cache_clusters.tap do |clusters|
56
+ clusters.each do |cluster|
57
+ puts YAML.dump(stringify_keys(cluster.to_hash))
58
+ end
59
+ end
60
+ end
61
+
62
+ ## as documented in this abomination:
63
+ ## https://s3.amazonaws.com/cloudformation-templates-us-east-1/ElastiCache_Redis.template
64
+ desc 'endpoint ID', 'get endpoint for given cluster'
65
+ def endpoint(id)
66
+ elasticache.describe_cache_clusters(
67
+ cache_cluster_id: id,
68
+ show_cache_node_info: true
69
+ ).cache_clusters.first.cache_nodes.first.endpoint.tap do |ep|
70
+ puts ep.address + ':' + ep.port.to_s
71
+ end
72
+ end
73
+ end
74
+ end
data/lib/awful/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Awful
2
- VERSION = '0.0.99'
2
+ VERSION = '0.0.100'
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.99
4
+ version: 0.0.100
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-04-11 00:00:00.000000000 Z
11
+ date: 2016-04-15 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
  - ec2
94
94
  - ecr
95
95
  - ecs
96
+ - elasticache
96
97
  - elb
97
98
  - iam
98
99
  - lambda
@@ -126,6 +127,7 @@ files:
126
127
  - bin/ec2
127
128
  - bin/ecr
128
129
  - bin/ecs
130
+ - bin/elasticache
129
131
  - bin/elb
130
132
  - bin/iam
131
133
  - bin/lambda
@@ -152,6 +154,7 @@ files:
152
154
  - lib/awful/ec2.rb
153
155
  - lib/awful/ecr.rb
154
156
  - lib/awful/ecs.rb
157
+ - lib/awful/elasticache.rb
155
158
  - lib/awful/elb.rb
156
159
  - lib/awful/iam.rb
157
160
  - lib/awful/lambda.rb