2011-09-27 10:48:38 -04:00
|
|
|
module Fog
|
|
|
|
module AWS
|
2011-09-27 11:03:11 -04:00
|
|
|
class Elasticache
|
2011-09-27 10:48:38 -04:00
|
|
|
class Real
|
|
|
|
|
2011-09-27 11:03:11 -04:00
|
|
|
require 'fog/aws/parsers/elasticache/single_security_group'
|
2011-09-27 10:48:38 -04:00
|
|
|
|
|
|
|
# creates a cache security group
|
|
|
|
#
|
|
|
|
# === Parameters
|
|
|
|
# * name <~String> - The name for the Cache Security Group
|
|
|
|
# * description <~String> - The description for the Cache Security Group
|
|
|
|
# === Returns
|
|
|
|
# * response <~Excon::Response>:
|
|
|
|
# * body <~Hash>
|
|
|
|
def create_cache_security_group(name, description = name)
|
|
|
|
request({
|
|
|
|
'Action' => 'CreateCacheSecurityGroup',
|
|
|
|
'CacheSecurityGroupName' => name,
|
2011-09-02 11:59:50 -04:00
|
|
|
'Description' => description,
|
2011-09-27 11:03:11 -04:00
|
|
|
:parser => Fog::Parsers::AWS::Elasticache::SingleSecurityGroup.new
|
2011-09-27 10:48:38 -04:00
|
|
|
})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Mock
|
2013-08-19 18:02:43 -04:00
|
|
|
def create_cache_security_group(name, description = name)
|
2013-09-08 21:31:33 -04:00
|
|
|
|
2013-08-30 16:47:03 -04:00
|
|
|
if self.data[:security_groups][name]
|
2013-08-19 18:02:43 -04:00
|
|
|
raise Fog::AWS::Elasticache::IdentifierTaken.new("CacheClusterAlreadyExists => The security group '#{name}' already exists")
|
|
|
|
end
|
|
|
|
|
|
|
|
data = {
|
|
|
|
'CacheSecurityGroupName' => name,
|
|
|
|
'Description' => description,
|
|
|
|
'EC2SecurityGroups' => [],
|
|
|
|
'OwnerId' => '0123456789'
|
|
|
|
}
|
|
|
|
self.data[:security_groups][name] = data
|
2013-09-08 21:31:33 -04:00
|
|
|
|
|
|
|
Excon::Response.new(
|
|
|
|
{
|
|
|
|
:body => {
|
|
|
|
'ResponseMetadata'=>{ 'RequestId'=> Fog::AWS::Mock.request_id },
|
|
|
|
'CacheSecurityGroup' => data
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
2013-08-19 18:02:43 -04:00
|
|
|
|
2011-09-27 10:48:38 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|