2011-09-06 15:51:30 -04:00
|
|
|
module Fog
|
|
|
|
module AWS
|
|
|
|
class Elasticache
|
|
|
|
class Real
|
|
|
|
|
|
|
|
require 'fog/aws/parsers/elasticache/describe_cache_clusters'
|
|
|
|
|
2011-09-06 16:46:12 -04:00
|
|
|
# Returns a list of Cache Cluster descriptions
|
2011-09-06 15:51:30 -04:00
|
|
|
#
|
2011-09-09 10:52:40 -04:00
|
|
|
# === Parameters (optional)
|
|
|
|
# * id - The ID of an existing cache cluster
|
2011-09-06 15:51:30 -04:00
|
|
|
# * options <~Hash> (optional):
|
2011-09-09 10:52:40 -04:00
|
|
|
# * :marker <~String> - marker provided in the previous request
|
|
|
|
# * :max_records <~Integer> - the maximum number of records to include
|
|
|
|
# * :show_node_info <~Boolean> - whether to show node info
|
2011-09-06 15:51:30 -04:00
|
|
|
# === Returns
|
|
|
|
# * response <~Excon::Response>:
|
|
|
|
# * body <~Hash>
|
2011-09-09 10:52:40 -04:00
|
|
|
def describe_cache_clusters(id = nil, options = {})
|
2011-09-06 15:51:30 -04:00
|
|
|
request({
|
2011-09-09 10:52:40 -04:00
|
|
|
'Action' => 'DescribeCacheClusters',
|
|
|
|
'CacheClusterId' => id,
|
|
|
|
'Marker' => options[:marker],
|
|
|
|
'MaxRecords' => options[:max_records],
|
|
|
|
'ShowCacheNodeInfo' => options[:show_node_info],
|
2011-09-06 15:51:30 -04:00
|
|
|
:parser => Fog::Parsers::AWS::Elasticache::DescribeCacheClusters.new
|
2011-09-09 10:52:40 -04:00
|
|
|
})
|
2011-09-06 15:51:30 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
class Mock
|
2011-09-09 10:52:40 -04:00
|
|
|
def describe_cache_clusters(id = nil, options = {})
|
2012-07-26 20:09:12 -04:00
|
|
|
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
|
2012-07-27 11:45:56 -04:00
|
|
|
if (id != nil) && (all_clusters.empty?)
|
|
|
|
raise Fog::AWS::Elasticache::NotFound
|
|
|
|
end
|
2012-07-26 20:09:12 -04:00
|
|
|
response.body = {
|
|
|
|
'CacheClusters' => all_clusters,
|
|
|
|
'ResponseMetadata' => { 'RequestId' => Fog::AWS::Mock.request_id }
|
|
|
|
}
|
|
|
|
response
|
2011-09-06 15:51:30 -04:00
|
|
|
end
|
|
|
|
end
|
2012-07-26 20:09:12 -04:00
|
|
|
|
2011-09-06 15:51:30 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|