Class: VCloudSdk::Network

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

Constant Summary

Constants included from Infrastructure

Infrastructure::ERROR_STATUSES, Infrastructure::SUCCESS_STATUS

Instance Method Summary collapse

Constructor Details

#initialize(session, link) ⇒ Network

Returns a new instance of Network.



11
12
13
14
# File 'lib/ruby_vcloud_sdk/network.rb', line 11

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

Instance Method Details

#allocated_ipsObject



30
31
32
33
34
35
# File 'lib/ruby_vcloud_sdk/network.rb', line 30

def allocated_ips
  allocated_addresses = connection.get(entity_xml.allocated_addresses_link)
  allocated_addresses.ip_addresses.map do |i|
    i.ip_address
  end
end

#hrefObject



16
17
18
# File 'lib/ruby_vcloud_sdk/network.rb', line 16

def href
  @link
end

#ip_rangesObject



20
21
22
23
24
25
26
27
28
# File 'lib/ruby_vcloud_sdk/network.rb', line 20

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