mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws|elasticache] change parameters for describe_cache_security_groups to ruby-friendly values
This commit is contained in:
parent
99d95262a7
commit
b539bf9f85
4 changed files with 17 additions and 21 deletions
|
@ -17,7 +17,7 @@ module Fog
|
||||||
def get(identity)
|
def get(identity)
|
||||||
new(
|
new(
|
||||||
connection.describe_cache_security_groups(
|
connection.describe_cache_security_groups(
|
||||||
'CacheSecurityGroupName' => identity
|
identity
|
||||||
).body['CacheSecurityGroups'].first
|
).body['CacheSecurityGroups'].first
|
||||||
)
|
)
|
||||||
rescue Fog::AWS::Elasticache::NotFound
|
rescue Fog::AWS::Elasticache::NotFound
|
||||||
|
|
|
@ -8,8 +8,8 @@ module Fog
|
||||||
#
|
#
|
||||||
# === Required Parameters
|
# === Required Parameters
|
||||||
# * id <~String> - A unique cluster ID - 20 characters max.
|
# * id <~String> - A unique cluster ID - 20 characters max.
|
||||||
# === Optional Parameters (passed into the options hash)
|
# === Optional Parameters
|
||||||
# * options <~Hash> - The all parameters should be set in this Hash:
|
# * options <~Hash> - All optional parameters should be set in this Hash:
|
||||||
# * :node_type <~String> - The size (flavor) of the cache Nodes
|
# * :node_type <~String> - The size (flavor) of the cache Nodes
|
||||||
# * :security_group_names <~Array> - Array of Elasticache::SecurityGroup names
|
# * :security_group_names <~Array> - Array of Elasticache::SecurityGroup names
|
||||||
# * :num_nodes <~Integer> - The number of nodes in the Cluster
|
# * :num_nodes <~Integer> - The number of nodes in the Cluster
|
||||||
|
|
|
@ -7,17 +7,17 @@ module Fog
|
||||||
|
|
||||||
# Returns a list of CacheSecurityGroup descriptions
|
# Returns a list of CacheSecurityGroup descriptions
|
||||||
#
|
#
|
||||||
# === Parameters
|
# === Parameters (optional)
|
||||||
|
# * name <~String> - The name of an existing cache security group
|
||||||
# * options <~Hash> (optional):
|
# * options <~Hash> (optional):
|
||||||
# * CacheSecurityGroupName<~String> - The name of the cache security group
|
# * :marker <~String> - marker provided in the previous request
|
||||||
# * Marker <~String> - marker provided in the previous request
|
# * :max_records <~Integer> - the maximum number of records to include
|
||||||
# * MaxRecords <~String> - the maximum number of records to include
|
def describe_cache_security_groups(name = nil, options = {})
|
||||||
# === Returns
|
|
||||||
# * response <~Excon::Response>:
|
|
||||||
# * body <~Hash>
|
|
||||||
def describe_cache_security_groups(options = {})
|
|
||||||
request({
|
request({
|
||||||
'Action' => 'DescribeCacheSecurityGroups',
|
'Action' => 'DescribeCacheSecurityGroups',
|
||||||
|
'CacheSecurityGroupName' => name,
|
||||||
|
'Marker' => options[:marker],
|
||||||
|
'MaxRecords' => options[:max_records],
|
||||||
:parser => Fog::Parsers::AWS::Elasticache::DescribeSecurityGroups.new
|
:parser => Fog::Parsers::AWS::Elasticache::DescribeSecurityGroups.new
|
||||||
}.merge(options))
|
}.merge(options))
|
||||||
end
|
end
|
||||||
|
@ -25,7 +25,7 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
class Mock
|
class Mock
|
||||||
def describe_cache_security_groups
|
def describe_cache_security_groups(name = nil, options = {})
|
||||||
Fog::Mock.not_implemented
|
Fog::Mock.not_implemented
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -32,9 +32,7 @@ Shindo.tests('AWS::Elasticache | security group requests', ['aws', 'elasticache'
|
||||||
tests(
|
tests(
|
||||||
'#describe_cache_security_groups with name'
|
'#describe_cache_security_groups with name'
|
||||||
).formats(AWS::Elasticache::Formats::DESCRIBE_SECURITY_GROUPS) do
|
).formats(AWS::Elasticache::Formats::DESCRIBE_SECURITY_GROUPS) do
|
||||||
body = AWS[:elasticache].describe_cache_security_groups(
|
body = AWS[:elasticache].describe_cache_security_groups(name).body
|
||||||
'CacheSecurityGroupName' => name
|
|
||||||
).body
|
|
||||||
returns(1, "size of 1") { body['CacheSecurityGroups'].size }
|
returns(1, "size of 1") { body['CacheSecurityGroups'].size }
|
||||||
returns(name, "has #{name}") do
|
returns(name, "has #{name}") do
|
||||||
body['CacheSecurityGroups'].first['CacheSecurityGroupName']
|
body['CacheSecurityGroups'].first['CacheSecurityGroupName']
|
||||||
|
@ -68,9 +66,8 @@ Shindo.tests('AWS::Elasticache | security group requests', ['aws', 'elasticache'
|
||||||
|
|
||||||
# Wait for the state to be active
|
# Wait for the state to be active
|
||||||
Fog.wait_for do
|
Fog.wait_for do
|
||||||
group = AWS[:elasticache].describe_cache_security_groups(
|
response = AWS[:elasticache].describe_cache_security_groups(name)
|
||||||
'CacheSecurityGroupName' => name
|
group = response.body['CacheSecurityGroups'].first
|
||||||
).body['CacheSecurityGroups'].first
|
|
||||||
group['EC2SecurityGroups'].all? {|ec2| ec2['Status'] == 'authorized'}
|
group['EC2SecurityGroups'].all? {|ec2| ec2['Status'] == 'authorized'}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -91,7 +88,6 @@ Shindo.tests('AWS::Elasticache | security group requests', ['aws', 'elasticache'
|
||||||
body
|
body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
ec2_group.destroy
|
ec2_group.destroy
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue