Class: AwsAuditor::CacheInstance
- Inherits:
-
Object
- Object
- AwsAuditor::CacheInstance
- Extended by:
- CacheWrapper, InstanceHelper
- Defined in:
- lib/aws_auditor/cache_instance.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
Returns the value of attribute count.
-
#engine ⇒ Object
Returns the value of attribute engine.
-
#id ⇒ Object
Returns the value of attribute id.
-
#instance_type ⇒ Object
Returns the value of attribute instance_type.
-
#name ⇒ Object
Returns the value of attribute name.
Attributes included from CacheWrapper
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(cache_instance) ⇒ CacheInstance
constructor
A new instance of CacheInstance.
- #to_s ⇒ Object
Methods included from InstanceHelper
compare, instance_count_hash, instance_hash
Constructor Details
#initialize(cache_instance) ⇒ CacheInstance
Returns a new instance of CacheInstance.
9 10 11 12 13 14 15 |
# File 'lib/aws_auditor/cache_instance.rb', line 9 def initialize(cache_instance) @id = cache_instance[:cache_cluster_id] || cache_instance[:reserved_cache_node_id] @name = cache_instance[:cache_cluster_id] || cache_instance[:reserved_cache_node_id] @instance_type = cache_instance[:cache_node_type] @engine = cache_instance[:engine] || cache_instance[:product_description] @count = cache_instance[:cache_node_count] || 1 end |
Instance Attribute Details
#count ⇒ Object
Returns the value of attribute count.
8 9 10 |
# File 'lib/aws_auditor/cache_instance.rb', line 8 def count @count end |
#engine ⇒ Object
Returns the value of attribute engine.
8 9 10 |
# File 'lib/aws_auditor/cache_instance.rb', line 8 def engine @engine end |
#id ⇒ Object
Returns the value of attribute id.
8 9 10 |
# File 'lib/aws_auditor/cache_instance.rb', line 8 def id @id end |
#instance_type ⇒ Object
Returns the value of attribute instance_type.
8 9 10 |
# File 'lib/aws_auditor/cache_instance.rb', line 8 def instance_type @instance_type end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/aws_auditor/cache_instance.rb', line 8 def name @name end |
Class Method Details
.get_instances ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/aws_auditor/cache_instance.rb', line 21 def self.get_instances instances = cache.describe_cache_clusters[:cache_clusters] instances.map do |instance| next unless instance[:cache_cluster_status].to_s == 'available' new(instance) end if instances end |
.get_reserved_instances ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/aws_auditor/cache_instance.rb', line 29 def self.get_reserved_instances instances = cache.describe_reserved_cache_nodes[:reserved_db_instances] instances.map do |instance| next unless instance[:state].to_s == 'active' new(instance) end if instances end |
Instance Method Details
#to_s ⇒ Object
17 18 19 |
# File 'lib/aws_auditor/cache_instance.rb', line 17 def to_s "#{engine} #{instance_type}" end |