mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
nicer model interface to authorizing security group ingresses
This commit is contained in:
parent
45ef403102
commit
5aaf86defa
1 changed files with 16 additions and 5 deletions
|
@ -10,11 +10,22 @@ module Fog
|
||||||
attribute :ip_permissions, 'ipPermissions'
|
attribute :ip_permissions, 'ipPermissions'
|
||||||
attribute :owner_id, 'ownerId'
|
attribute :owner_id, 'ownerId'
|
||||||
|
|
||||||
def authorize(options = {})
|
def authorize_group_and_owner(group, owner)
|
||||||
options = {
|
connection.authorize_security_group_ingress(
|
||||||
'GroupName' => @group_name
|
'GroupName' => @group_name
|
||||||
}.merge!(options)
|
'SourceSecurityGroupName' => group,
|
||||||
connection.authorize_security_group_ingress(options)
|
'SourceSecurityGroupOwnerId' => owner
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def authorize_port_range(range, options = {})
|
||||||
|
connection.authorize_security_group_ingress(
|
||||||
|
'CidrIp' => options[:cidr_ip] || '0.0.0.0/0',
|
||||||
|
'FromPort' => range.min,
|
||||||
|
'GroupName' => @group_name,
|
||||||
|
'ToPort' => range.max,
|
||||||
|
'IpProtocol' => options[:ip_protocol] || 'tcp'
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
|
Loading…
Add table
Reference in a new issue