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 :owner_id, 'ownerId'
|
||||
|
||||
def authorize(options = {})
|
||||
options = {
|
||||
def authorize_group_and_owner(group, owner)
|
||||
connection.authorize_security_group_ingress(
|
||||
'GroupName' => @group_name
|
||||
}.merge!(options)
|
||||
connection.authorize_security_group_ingress(options)
|
||||
'SourceSecurityGroupName' => group,
|
||||
'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
|
||||
|
||||
def destroy
|
||||
|
|
Loading…
Add table
Reference in a new issue