mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Fix Fog::AWS::Elasticache::Mock#authorize_cache_security_group_ingress
This commit is contained in:
parent
826d3bb361
commit
e8956b8d38
2 changed files with 11 additions and 10 deletions
|
@ -5,6 +5,7 @@ module Fog
|
||||||
|
|
||||||
class IdentifierTaken < Fog::Errors::Error; end
|
class IdentifierTaken < Fog::Errors::Error; end
|
||||||
class InvalidInstance < Fog::Errors::Error; end
|
class InvalidInstance < Fog::Errors::Error; end
|
||||||
|
class AuthorizationAlreadyExists < Fog::Errors::Error; end
|
||||||
|
|
||||||
requires :aws_access_key_id, :aws_secret_access_key
|
requires :aws_access_key_id, :aws_secret_access_key
|
||||||
recognizes :region, :host, :path, :port, :scheme, :persistent, :use_iam_profile, :aws_session_token, :aws_credentials_expire_at
|
recognizes :region, :host, :path, :port, :scheme, :persistent, :use_iam_profile, :aws_session_token, :aws_credentials_expire_at
|
||||||
|
|
|
@ -28,10 +28,11 @@ module Fog
|
||||||
|
|
||||||
class Mock
|
class Mock
|
||||||
|
|
||||||
def authorize_cache_security_group_ingress(name, opts = {})
|
def authorize_cache_security_group_ingress(name, ec2_name, ec2_owner_id)
|
||||||
unless (opts.key?('EC2SecurityGroupName') && opts.key?('EC2SecurityGroupOwnerId'))
|
opts = {
|
||||||
raise ArgumentError, 'Must specify and EC2SecurityGroupName and EC2SecurityGroupOwnerId'
|
'EC2SecurityGroupName' => ec2_name,
|
||||||
end
|
'EC2SecurityGroupOwnerId' => ec2_owner_id
|
||||||
|
}
|
||||||
|
|
||||||
response = Excon::Response.new
|
response = Excon::Response.new
|
||||||
|
|
||||||
|
@ -40,18 +41,17 @@ module Fog
|
||||||
if sec_group['EC2SecurityGroups'].detect{|h| h['EC2SecurityGroupName'] == opts['EC2SecurityGroupName']}
|
if sec_group['EC2SecurityGroups'].detect{|h| h['EC2SecurityGroupName'] == opts['EC2SecurityGroupName']}
|
||||||
raise Fog::AWS::Elasticache::AuthorizationAlreadyExists.new("AuthorizationAlreadyExists => #{opts['EC2SecurityGroupName']} is alreay defined")
|
raise Fog::AWS::Elasticache::AuthorizationAlreadyExists.new("AuthorizationAlreadyExists => #{opts['EC2SecurityGroupName']} is alreay defined")
|
||||||
end
|
end
|
||||||
sec_group['EC2SecurityGroups'] << opts.merge({"Status" => 'authorizing'})
|
sec_group['EC2SecurityGroups'] << opts.merge({'Status' => 'authorizing'})
|
||||||
|
|
||||||
response.status = 200
|
response.status = 200
|
||||||
response.body = {
|
response.body = {
|
||||||
"ResponseMetadata"=>{ "RequestId"=> Fog::AWS::Mock.request_id },
|
'ResponseMetadata'=>{ 'RequestId'=> Fog::AWS::Mock.request_id },
|
||||||
'AuthorizeDBSecurityGroupIngressResult' => {
|
'CacheSecurityGroup' => sec_group
|
||||||
'DBSecurityGroup' => sec_group
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
response
|
response
|
||||||
else
|
else
|
||||||
raise Fog::AWS::Elasticache::NotFound.new("DBSecurityGroupNotFound => #{name} not found")
|
raise Fog::AWS::Elasticache::NotFound.new("CacheSecurityGroupNotFound => #{name} not found")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue