2009-08-17 12:45:00 -04:00
|
|
|
unless Fog.mocking?
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module AWS
|
|
|
|
class EC2
|
|
|
|
|
|
|
|
# Create a new security group
|
|
|
|
#
|
|
|
|
# ==== Parameters
|
|
|
|
# * group_name<~String> - Name of the security group.
|
|
|
|
# * group_description<~String> - Description of group.
|
|
|
|
#
|
|
|
|
# ==== Returns
|
|
|
|
# * response<~Fog::AWS::Response>:
|
|
|
|
# * body<~Hash>:
|
|
|
|
# * 'requestId'<~String> - Id of request
|
|
|
|
# * 'return'<~Boolean> - success?
|
|
|
|
def create_security_group(name, description)
|
|
|
|
request({
|
|
|
|
'Action' => 'CreateSecurityGroup',
|
|
|
|
'GroupName' => name,
|
|
|
|
'GroupDescription' => CGI.escape(description)
|
|
|
|
}, Fog::Parsers::AWS::EC2::Basic.new)
|
|
|
|
end
|
|
|
|
|
2009-07-13 22:14:59 -04:00
|
|
|
end
|
2009-08-17 12:45:00 -04:00
|
|
|
end
|
|
|
|
end
|
2009-07-13 22:14:59 -04:00
|
|
|
|
2009-08-17 12:45:00 -04:00
|
|
|
else
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module AWS
|
|
|
|
class EC2
|
|
|
|
|
|
|
|
def create_security_group(name, description)
|
|
|
|
response = Fog::Response.new
|
|
|
|
unless @data[:security_groups][name]
|
|
|
|
data = {
|
|
|
|
'GroupDescription' => description,
|
|
|
|
'GroupName' => name,
|
|
|
|
'ipPermissions' => [],
|
|
|
|
'OwnerId' => Fog::AWS::Mock.owner_id
|
|
|
|
}
|
|
|
|
@data[:security_groups][name] = data
|
|
|
|
response.body = {
|
|
|
|
'requestId' => Fog::AWS::Mock.request_id,
|
|
|
|
'return' => true
|
|
|
|
}
|
|
|
|
else
|
|
|
|
response.status = 400
|
|
|
|
raise(Fog::Errors.status_error(200, 400, response))
|
|
|
|
end
|
|
|
|
response
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2009-07-13 22:14:59 -04:00
|
|
|
end
|
|
|
|
end
|
2009-08-17 12:45:00 -04:00
|
|
|
|
2009-07-13 22:14:59 -04:00
|
|
|
end
|