[aws|elasticache] change parameters for describe_cache_security_groups to ruby-friendly values

This commit is contained in:
Benton Roberts 2011-09-09 11:21:56 -04:00 committed by geemus
parent 99d95262a7
commit b539bf9f85
4 changed files with 17 additions and 21 deletions

View File

@ -17,7 +17,7 @@ module Fog
def get(identity)
new(
connection.describe_cache_security_groups(
'CacheSecurityGroupName' => identity
identity
).body['CacheSecurityGroups'].first
)
rescue Fog::AWS::Elasticache::NotFound

View File

@ -8,8 +8,8 @@ module Fog
#
# === Required Parameters
# * id <~String> - A unique cluster ID - 20 characters max.
# === Optional Parameters (passed into the options hash)
# * options <~Hash> - The all parameters should be set in this Hash:
# === Optional Parameters
# * options <~Hash> - All optional parameters should be set in this Hash:
# * :node_type <~String> - The size (flavor) of the cache Nodes
# * :security_group_names <~Array> - Array of Elasticache::SecurityGroup names
# * :num_nodes <~Integer> - The number of nodes in the Cluster
@ -39,7 +39,7 @@ module Fog
'CacheClusterId' => id,
'CacheNodeType' => options[:node_type] || 'cache.m1.large',
'Engine' => options[:engine] || 'memcached',
'NumCacheNodes' => options[:num_nodes] || 1 ,
'NumCacheNodes' => options[:num_nodes] || 1,
'AutoMinorVersionUpgrade' => options[:auto_minor_version_upgrade],
'CacheParameterGroupName' => options[:parameter_group_name],
'EngineVersion' => options[:engine_version],

View File

@ -7,17 +7,17 @@ module Fog
# Returns a list of CacheSecurityGroup descriptions
#
# === Parameters
# === Parameters (optional)
# * name <~String> - The name of an existing cache security group
# * options <~Hash> (optional):
# * CacheSecurityGroupName<~String> - The name of the cache security group
# * Marker <~String> - marker provided in the previous request
# * MaxRecords <~String> - the maximum number of records to include
# === Returns
# * response <~Excon::Response>:
# * body <~Hash>
def describe_cache_security_groups(options = {})
# * :marker <~String> - marker provided in the previous request
# * :max_records <~Integer> - the maximum number of records to include
def describe_cache_security_groups(name = nil, options = {})
request({
'Action' => 'DescribeCacheSecurityGroups',
'Action' => 'DescribeCacheSecurityGroups',
'CacheSecurityGroupName' => name,
'Marker' => options[:marker],
'MaxRecords' => options[:max_records],
:parser => Fog::Parsers::AWS::Elasticache::DescribeSecurityGroups.new
}.merge(options))
end
@ -25,7 +25,7 @@ module Fog
end
class Mock
def describe_cache_security_groups
def describe_cache_security_groups(name = nil, options = {})
Fog::Mock.not_implemented
end
end

View File

@ -32,9 +32,7 @@ Shindo.tests('AWS::Elasticache | security group requests', ['aws', 'elasticache'
tests(
'#describe_cache_security_groups with name'
).formats(AWS::Elasticache::Formats::DESCRIBE_SECURITY_GROUPS) do
body = AWS[:elasticache].describe_cache_security_groups(
'CacheSecurityGroupName' => name
).body
body = AWS[:elasticache].describe_cache_security_groups(name).body
returns(1, "size of 1") { body['CacheSecurityGroups'].size }
returns(name, "has #{name}") do
body['CacheSecurityGroups'].first['CacheSecurityGroupName']
@ -68,9 +66,8 @@ Shindo.tests('AWS::Elasticache | security group requests', ['aws', 'elasticache'
# Wait for the state to be active
Fog.wait_for do
group = AWS[:elasticache].describe_cache_security_groups(
'CacheSecurityGroupName' => name
).body['CacheSecurityGroups'].first
response = AWS[:elasticache].describe_cache_security_groups(name)
group = response.body['CacheSecurityGroups'].first
group['EC2SecurityGroups'].all? {|ec2| ec2['Status'] == 'authorized'}
end
@ -91,7 +88,6 @@ Shindo.tests('AWS::Elasticache | security group requests', ['aws', 'elasticache'
body
end
ec2_group.destroy
end