Class: VCloudSdk::EdgeGateway

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Infrastructure
Defined in:
lib/ruby_vcloud_sdk/edge_gateway.rb

Constant Summary

Constants included from Infrastructure

Infrastructure::ERROR_STATUSES, Infrastructure::SUCCESS_STATUS

Instance Method Summary collapse

Constructor Details

#initialize(session, link) ⇒ EdgeGateway

Returns a new instance of EdgeGateway.



12
13
14
15
# File 'lib/ruby_vcloud_sdk/edge_gateway.rb', line 12

def initialize(session, link)
  @session = session
  @link = link
end

Instance Method Details

#public_ip_rangesObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ruby_vcloud_sdk/edge_gateway.rb', line 17

def public_ip_ranges
  uplink_gateway_interface = entity_xml
                               .gateway_interfaces
                               .find { |g| g.interface_type == "uplink" }

  ip_ranges = uplink_gateway_interface.ip_ranges
  return IpRanges.new unless ip_ranges

  ip_ranges
    .ranges
    .reduce(IpRanges.new) do |result, i|
      result + IpRanges.new("#{i.start_address}-#{i.end_address}")
    end
end