Method: Fog::AWS::Elasticache::Mock#describe_cache_clusters

Defined in:
lib/fog/aws/requests/elasticache/describe_cache_clusters.rb

#describe_cache_clusters(id = nil, options = {}) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/fog/aws/requests/elasticache/describe_cache_clusters.rb', line 33

def describe_cache_clusters(id = nil, options = {})
  response        = Excon::Response.new
  all_clusters    = self.data[:clusters].values.map do |cluster|
    cluster.merge!(options[:show_node_info] ? {
      'CacheClusterCreateTime'    => DateTime.now - 60,
      'PreferredAvailabilityZone' => 'us-east-1a'
    } : {})
  end
  if (id != nil) && (all_clusters.empty?)
    raise Fog::AWS::Elasticache::NotFound
  end
  response.body = {
    'CacheClusters'     => all_clusters,
    'ResponseMetadata'  => { 'RequestId' => Fog::AWS::Mock.request_id }
  }
  response
end