Class: VCloudSdk::Disk

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

Constant Summary

Constants included from Infrastructure

Infrastructure::ERROR_STATUSES, Infrastructure::SUCCESS_STATUS

Instance Method Summary collapse

Constructor Details

#initialize(session, link) ⇒ Disk

Returns a new instance of Disk.



14
15
16
17
# File 'lib/ruby_vcloud_sdk/disk.rb', line 14

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

Instance Method Details

#attached?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/ruby_vcloud_sdk/disk.rb', line 23

def attached?
  !vm_reference.nil?
end

#hrefObject



19
20
21
# File 'lib/ruby_vcloud_sdk/disk.rb', line 19

def href
  @link
end

#vmObject



27
28
29
30
31
32
33
# File 'lib/ruby_vcloud_sdk/disk.rb', line 27

def vm
  vm_link = vm_reference
  fail ObjectNotFoundError,
       "No vm is attached to disk '#{name}'" if vm_link.nil?

  VCloudSdk::VM.new(@session, vm_link.href)
end