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.
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/holepunch/definition.rb', line 34 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.
32 33 34 |
# File 'lib/holepunch/definition.rb', line 32 def dependency @dependency end |
#desc ⇒ Object
Returns the value of attribute desc.
32 33 34 |
# File 'lib/holepunch/definition.rb', line 32 def desc @desc end |
#id ⇒ Object
Returns the value of attribute id.
32 33 34 |
# File 'lib/holepunch/definition.rb', line 32 def id @id end |
#ingresses ⇒ Object
Returns the value of attribute ingresses.
32 33 34 |
# File 'lib/holepunch/definition.rb', line 32 def ingresses @ingresses end |
Instance Method Details
#include_ingress?(type, ports, source) ⇒ Boolean
45 46 47 48 49 50 51 |
# File 'lib/holepunch/definition.rb', line 45 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 |