class AWS::EC2::SecurityGroup::IpPermission
def authorize
-
(IpPermission)
- Returns self
def authorize update_sg(egress? ? :authorize_egress : :authorize_ingress) end
def egress?
-
(Boolean)
- Returns true if this is an egress permission.
def egress? @egress ? true : false end
def eql? other
-
(Boolean)
- Returns true if the other IpPermission matches
def eql? other other.is_a?(IpPermission) and other.security_group == security_group and other.protocol == protocol and other.port_range == port_range and other.ip_ranges == ip_ranges and other.groups == groups and other.egress == egress? end
def initialize security_group, protocol, ports, options = {}
(**options)
-
:egress
(Boolean
) -- When true this IpPermission -
:groups
(Array
) -- An array of SecurityGroup objects to -
:ip_ranges
(Array
) -- An array of CIDR ip address
Parameters:
-
options
(Hash
) -- -
port
(Range, Integer
) -- An integer or a range of integers -
protocol
(:tcp, :udp, :icmp
) --
def initialize security_group, protocol, ports, options = {} @security_group = security_group @protocol = protocol == '-1' ? :any : protocol.to_s.downcase.to_sym @ip_ranges = Array(options[:ip_ranges]) @groups = Array(options[:groups]) @egress = options[:egress] # not all egress permissions require port ranges, depends on the # protocol if ports @port_range = Array(ports).first.to_i..Array(ports).last.to_i end super end
def revoke
-
(IpPermission)
- Returns self
def revoke update_sg(egress? ? :revoke_egress : :revoke_ingress) end
def update_sg method
def update_sg method sources = [] sources += ip_ranges sources += groups if egress? opts = {} opts[:protocol] = protocol opts[:ports] = port_range if port_range sources << opts security_group.send(method, *sources) else security_group.send(method, protocol, port_range, *sources) end self end