2009-09-18 11:56:42 -04:00
|
|
|
module Fog
|
|
|
|
module AWS
|
|
|
|
class EC2
|
|
|
|
|
|
|
|
class SecurityGroup < Fog::Model
|
|
|
|
|
|
|
|
attribute :group_description, 'groupDescription'
|
|
|
|
attribute :group_name, 'groupName'
|
|
|
|
attribute :ip_permissions, 'ipPermissions'
|
|
|
|
attribute :owner_id, 'ownerId'
|
|
|
|
|
2009-09-20 12:21:03 -04:00
|
|
|
def destroy
|
2009-09-18 11:56:42 -04:00
|
|
|
connection.delete_security_group(@group_name)
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
2009-09-19 15:31:15 -04:00
|
|
|
def reload
|
|
|
|
new_attributes = security_groups.all(@public_ip).first.attributes
|
|
|
|
merge_attributes(new_attributes)
|
|
|
|
end
|
|
|
|
|
2009-09-18 11:56:42 -04:00
|
|
|
def save
|
|
|
|
data = connection.create_create_security_group(@group_name, @group_description).body
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def security_groups
|
2009-09-19 15:31:15 -04:00
|
|
|
@security_groups
|
2009-09-18 11:56:42 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def security_groups=(new_security_groups)
|
|
|
|
@security_groups = new_security_groups
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|