Sha256: cfca8af548d4bb562336601f165b82c5fc3d7821dee2635b64ea3af59e57250f

Contents?: true

Size: 977 Bytes

Versions: 3

Compression:

Stored size: 977 Bytes

Contents

module Awspec::Type
  class Elasticache < ResourceBase
    def initialize(name)
      super
      @display_name = name
    end

    def resource_via_client
      @resource_via_client ||= find_cache_cluster(@display_name)
    end

    def id
      @id ||= resource_via_client.cache_cluster_id if resource_via_client
    end

    STATES = %w(
      available creating deleted deleting
      incompatible-network modifying
      rebooting-cache-cluster-nodes restore-failed
      snapshotting
    )

    STATES.each do |state|
      define_method state.tr('-', '_') + '?' do
        resource_via_client.cache_cluster_status == state
      end
    end

    def has_cache_parameter_group?(group_name)
      resource_via_client.cache_parameter_group.cache_parameter_group_name == group_name
    end

    def vpc_id
      cache_subnet_group = find_cache_subnet_group(resource_via_client.cache_subnet_group_name)
      cache_subnet_group.vpc_id if cache_subnet_group
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
awspec-0.72.0 lib/awspec/type/elasticache.rb
awspec-0.71.0 lib/awspec/type/elasticache.rb
awspec-0.70.0 lib/awspec/type/elasticache.rb