1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Adding describe_reserved_cache_nodes.rb

'
'
This commit is contained in:
Sean Hart 2013-01-16 16:41:15 -08:00
parent a2255c7a66
commit b492f64769
3 changed files with 82 additions and 1 deletions

View file

@ -24,6 +24,7 @@ module Fog
request :reset_cache_parameter_group
request :describe_engine_default_parameters
request :describe_cache_parameters
request :describe_reserved_cache_nodes
request :create_cache_security_group
request :delete_cache_security_group
@ -87,7 +88,8 @@ module Fog
:host => @host,
:path => @path,
:port => @port,
:version => '2011-07-15'
#:version => '2011-07-15'
:version => '2012-11-15'
}
)

View file

@ -0,0 +1,37 @@
module Fog
module Parsers
module AWS
module Elasticache
class DescribeReservedCacheNodes < Fog::Parsers::Base
def reset
@reserved_node = {}
@response = { 'ReservedCacheNodes' => [] }
end
def end_element(name)
case name
when 'ReservedCacheNodeId', 'ReservedCacheNodesOfferingId', 'CacheNodeType', 'ProductDescription', 'State'
@reserved_node[name] = @value
when 'Duration', 'CacheNodeCount'
@reserved_node[name] = @value.to_i
when 'FixedPrice', 'UsagePrice'
@reserved_node[name] = @value.to_f
when 'ReservedCacheNode'
@response['ReservedCacheNodes'] << @reserved_node
@reserved_node = {}
when 'Marker'
@response[name] = @value
when 'StartTime'
@reserved_node[name] = Time.parse(@value)
end
end
end
end
end
end
end

View file

@ -0,0 +1,42 @@
module Fog
module AWS
class Elasticache
class Real
require 'fog/aws/parsers/elasticache/describe_reserved_cache_nodes'
# Describe all or specified reserved Elasticache nodes
# http://docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_DescribeReservedCacheNodes.html
# ==== Parameters
# * ReservedCacheNodeId <~String> - ID of node to retrieve information for. If absent, information for all nodes is returned.
# ==== Returns
# * response<~Excon::Response>:
# * body<~Hash>:
def describe_reserved_cache_nodes(identifier=nil, opts={})
params = {}
params['ReservedCacheNodeId'] = identifier if identifier
if opts[:marker]
params['Marker'] = opts[:marker]
end
if opts[:max_records]
params['MaxRecords'] = opts[:max_records]
end
request({
'Action' => 'DescribeReservedCacheNodes',
:parser => Fog::Parsers::AWS::Elasticache::DescribeReservedCacheNodes.new
}.merge(params))
end
end
class Mock
def describe_db_reserved_instances(identifier=nil, opts={})
Fog::Mock.not_implemented
end
end
end
end
end