Class: AWS::EC2::SecurityGroup::IpPermission
- Inherits:
-
Object
- Object
- AWS::EC2::SecurityGroup::IpPermission
- Defined in:
- lib/aws/ec2/security_group/ip_permission.rb
Instance Attribute Summary collapse
-
#groups ⇒ Array
readonly
granted access with this permission.
-
#ip_ranges ⇒ Array
readonly
An array if string CIDR ip addresses.
-
#port_range ⇒ Range
readonly
The port range (e.g. 80..80, 4000..4010, etc).
-
#protocol ⇒ Symbol
readonly
The protocol (:tcp, :udp, :icmp).
-
#security_group ⇒ SecurityGroup
readonly
The security group this permission is authorized for.
Instance Method Summary collapse
- #authorize ⇒ Object
-
#initialize(security_group, protocol, ports, options = {}) ⇒ IpPermission
constructor
A new instance of IpPermission.
- #revoke ⇒ Object
Constructor Details
#initialize(security_group, protocol, ports, options = {}) ⇒ IpPermission
Returns a new instance of IpPermission.
31 32 33 34 35 36 37 38 |
# File 'lib/aws/ec2/security_group/ip_permission.rb', line 31 def initialize security_group, protocol, ports, = {} @security_group = security_group @protocol = protocol.to_s.downcase.to_sym @port_range = (Array(ports).first..Array(ports).last) @ip_ranges = Array([:ip_ranges]) @groups = Array([:groups]) super end |
Instance Attribute Details
#groups ⇒ Array (readonly)
granted access with this permission.
55 56 57 |
# File 'lib/aws/ec2/security_group/ip_permission.rb', line 55 def groups @groups end |
#ip_ranges ⇒ Array (readonly)
Returns An array if string CIDR ip addresses.
51 52 53 |
# File 'lib/aws/ec2/security_group/ip_permission.rb', line 51 def ip_ranges @ip_ranges end |
#port_range ⇒ Range (readonly)
Returns The port range (e.g. 80..80, 4000..4010, etc).
48 49 50 |
# File 'lib/aws/ec2/security_group/ip_permission.rb', line 48 def port_range @port_range end |
#protocol ⇒ Symbol (readonly)
Returns The protocol (:tcp, :udp, :icmp).
45 46 47 |
# File 'lib/aws/ec2/security_group/ip_permission.rb', line 45 def protocol @protocol end |
#security_group ⇒ SecurityGroup (readonly)
Returns The security group this permission is authorized for.
42 43 44 |
# File 'lib/aws/ec2/security_group/ip_permission.rb', line 42 def security_group @security_group end |
Instance Method Details
#authorize ⇒ Object
57 58 59 60 |
# File 'lib/aws/ec2/security_group/ip_permission.rb', line 57 def sources = groups + ip_ranges security_group.(protocol, port_range, *sources) end |
#revoke ⇒ Object
62 63 64 65 |
# File 'lib/aws/ec2/security_group/ip_permission.rb', line 62 def revoke sources = groups + ip_ranges security_group.revoke_ingress(protocol, port_range, *sources) end |