Class: HolePunch::SecurityGroup
- Inherits:
-
Object
- Object
- HolePunch::SecurityGroup
- Defined in:
- lib/holepunch/definition.rb
Instance Attribute Summary collapse
-
#dependency ⇒ Object
Returns the value of attribute dependency.
-
#desc ⇒ Object
Returns the value of attribute desc.
-
#id ⇒ Object
Returns the value of attribute id.
-
#ingresses ⇒ Object
Returns the value of attribute ingresses.
Instance Method Summary collapse
- #include_ingress?(type, ports, source) ⇒ Boolean
-
#initialize(id, opts = {}) ⇒ SecurityGroup
constructor
A new instance of SecurityGroup.
Constructor Details
#initialize(id, opts = {}) ⇒ SecurityGroup
Returns a new instance of SecurityGroup.
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/holepunch/definition.rb', line 25 def initialize(id, opts = {}) opts = { dependency: false }.merge(opts) @id = id @desc = id @dependency = opts[:dependency] @ingresses = [] end |
Instance Attribute Details
#dependency ⇒ Object
Returns the value of attribute dependency.
23 24 25 |
# File 'lib/holepunch/definition.rb', line 23 def dependency @dependency end |
#desc ⇒ Object
Returns the value of attribute desc.
23 24 25 |
# File 'lib/holepunch/definition.rb', line 23 def desc @desc end |
#id ⇒ Object
Returns the value of attribute id.
23 24 25 |
# File 'lib/holepunch/definition.rb', line 23 def id @id end |
#ingresses ⇒ Object
Returns the value of attribute ingresses.
23 24 25 |
# File 'lib/holepunch/definition.rb', line 23 def ingresses @ingresses end |
Instance Method Details
#include_ingress?(type, ports, source) ⇒ Boolean
36 37 38 39 40 41 42 |
# File 'lib/holepunch/definition.rb', line 36 def include_ingress?(type, ports, source) ports = ports.first if ports.is_a?(Range) and ports.size == 1 ingresses.any? do |ingress| ingress.type == type && ingress.ports == ports && ingress.sources.include?(source) end end |