Class: Awful::ElastiCache
- Inherits:
-
Cli
show all
- Defined in:
- lib/awful/elasticache.rb
Constant Summary
collapse
- COLORS =
{
available: :green,
deleted: :red
}
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(id = nil) ⇒ Object
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/awful/elasticache.rb', line 47
def dump(id = nil)
elasticache.describe_cache_clusters(
cache_cluster_id: id,
show_cache_node_info: options[:nodes]
).cache_clusters.tap do |clusters|
clusters.each do |cluster|
puts YAML.dump(stringify_keys(cluster.to_hash))
end
end
end
|
#endpoint(id) ⇒ Object
61
62
63
64
65
66
67
68
|
# File 'lib/awful/elasticache.rb', line 61
def endpoint(id)
elasticache.describe_cache_clusters(
cache_cluster_id: id,
show_cache_node_info: true
).cache_clusters.first.cache_nodes.first.endpoint.tap do |ep|
puts ep.address + ':' + ep.port.to_s
end
end
|
#ls(id = nil) ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/awful/elasticache.rb', line 24
def ls(id = nil)
elasticache.describe_cache_clusters(cache_cluster_id: id).cache_clusters.tap do |clusters|
if options[:long]
print_table clusters.map { |c|
[
c.cache_cluster_id,
c.engine,
c.engine_version,
c.num_cache_nodes,
c.cache_node_type,
c.preferred_availability_zone,
color(c.cache_cluster_status),
c.cache_cluster_create_time
]
}
else
puts clusters.map(&:cache_cluster_id)
end
end
end
|