Class: SoftLayer::VirtualDiskImage
- Includes:
- DynamicAttribute
- Defined in:
- lib/softlayer/VirtualDiskImage.rb
Overview
Each SoftLayer VirtualDiskImage instance provides information about software installed on a specific piece of hardware.
This class roughly corresponds to the entity SoftLayer_Virtual_Disk_Image in the API.
Instance Attribute Summary
Attributes inherited from ModelBase
Class Method Summary collapse
-
.image_with_id(image_id, options = {}) ⇒ Object
Retrieve the virtual disk image with the given image ID from the API.
Instance Method Summary collapse
-
#capacity ⇒ Object
:attr_reader: A disk image’s size measured in gigabytes.
-
#checksum ⇒ Object
:attr_reader: A disk image’s unique md5 checksum.
-
#coalesced_disk_images ⇒ Object
Retrieve coalesced disk images associated with this virtual disk image :call-seq: coalesced_disk_images(force_update=false).
-
#created ⇒ Object
:attr_reader: created The date a disk image was created.
-
#created_at ⇒ Object
:attr_reader: created_at The date a disk image was created.
-
#description ⇒ Object
:attr_reader: A brief description of a virtual disk image.
-
#local_disk ⇒ Object
Retrieve local disk flag associated with virtual disk image :call-seq: local_disk(force_update=false).
-
#metadata ⇒ Object
Retrieve metadata as to whether this disk image is meant for storage of custom user data supplied with a Cloud Computing Instance order.
-
#modified ⇒ Object
:attr_reader: modified The date a disk image was last modified.
-
#modified_at ⇒ Object
:attr_reader: modified_at The date a disk image was last modified.
-
#name ⇒ Object
:attr_reader: A descriptive name used to identify a disk image to a user.
-
#service ⇒ Object
Returns the service for interacting with this virtual disk image through the network API.
-
#software ⇒ Object
Retrieve the references to the software that resides on a disk image.
-
#source_disk_image ⇒ Object
Retrieve the original disk image that the current disk image was cloned from.
-
#type_description ⇒ Object
Retrieve a brief description of a virtual disk image type’s function.
-
#type_name ⇒ Object
Retrieve a virtual disk image type’s name.
-
#units ⇒ Object
:attr_reader: The unit of storage in which the size of the image is measured.
-
#uuid ⇒ Object
:attr_reader: A disk image’s unique ID on a virtualization platform.
Methods included from DynamicAttribute
Methods inherited from ModelBase
#[], #has_sl_property?, #initialize, #refresh_details, sl_attr, #to_ary
Constructor Details
This class inherits a constructor from SoftLayer::ModelBase
Class Method Details
.image_with_id(image_id, options = {}) ⇒ Object
Retrieve the virtual disk image with the given image ID from the API
The options parameter should contain:
:client
- The client used to connect to the API
If no client is given, then the routine will try to use Client.default_client If no client can be found the routine will raise an error.
The options may include the following keys
-
:object_mask
(string) - A object mask of properties, in addition to the default properties, that you wish to retrieve for the image
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
# File 'lib/softlayer/VirtualDiskImage.rb', line 204 def self.image_with_id(image_id, = {}) softlayer_client = [:client] || Client.default_client raise "#{__method__} requires a client but none was given and Client::default_client is not set" if !softlayer_client vdi_service = softlayer_client[:Virtual_Disk_Image] vdi_service = vdi_service.object_mask(default_object_mask.to_sl_object_mask) if .has_key?(:object_mask) vdi_service = vdi_service.object_mask([:object_mask]) end image_data = vdi_service.object_with_id(image_id).getObject() return VirtualDiskImage.new(softlayer_client, image_data) end |
Instance Method Details
#capacity ⇒ Object
:attr_reader: A disk image’s size measured in gigabytes.
21 |
# File 'lib/softlayer/VirtualDiskImage.rb', line 21 sl_attr :capacity |
#checksum ⇒ Object
:attr_reader: A disk image’s unique md5 checksum.
26 |
# File 'lib/softlayer/VirtualDiskImage.rb', line 26 sl_attr :checksum |
#coalesced_disk_images ⇒ Object
Retrieve coalesced disk images associated with this virtual disk image :call-seq:
coalesced_disk_images(force_update=false)
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/softlayer/VirtualDiskImage.rb', line 77 sl_dynamic_attr :coalesced_disk_images do |resource| resource.should_update? do #only retrieved once per instance @coalesced_disk_images == nil end resource.to_update do coalesced_disk_images = self.service.getCoalescedDiskImages coalesced_disk_images.collect { |coalesced_disk_image| VirtualDiskImage.new(softlayer_client, coalesced_disk_image) } end end |
#created ⇒ Object
:attr_reader: created The date a disk image was created. DEPRECATION WARNING: This attribute is deprecated in favor of created_at and will be removed in the next major release.
38 |
# File 'lib/softlayer/VirtualDiskImage.rb', line 38 sl_attr :created, 'createDate' |
#created_at ⇒ Object
:attr_reader: created_at The date a disk image was created.
31 |
# File 'lib/softlayer/VirtualDiskImage.rb', line 31 sl_attr :created_at, 'createDate' |
#description ⇒ Object
:attr_reader: A brief description of a virtual disk image.
43 |
# File 'lib/softlayer/VirtualDiskImage.rb', line 43 sl_attr :description |
#local_disk ⇒ Object
Retrieve local disk flag associated with virtual disk image :call-seq:
local_disk(force_update=false)
93 94 95 96 97 98 99 100 101 102 |
# File 'lib/softlayer/VirtualDiskImage.rb', line 93 sl_dynamic_attr :local_disk do |resource| resource.should_update? do #only retrieved once per instance @local_disk == nil end resource.to_update do self.service.getLocalDiskFlag end end |
#metadata ⇒ Object
Retrieve metadata as to whether this disk image is meant for storage of custom user data supplied with a Cloud Computing Instance order. :call-seq:
(force_update=false)
109 110 111 112 113 114 115 116 117 118 |
# File 'lib/softlayer/VirtualDiskImage.rb', line 109 sl_dynamic_attr :metadata do |resource| resource.should_update? do #only retrieved once per instance @metadata == nil end resource.to_update do self.service.getMetadataFlag end end |
#modified ⇒ Object
:attr_reader: modified The date a disk image was last modified. DEPRECATION WARNING: This attribute is deprecated in favor of modified_at and will be removed in the next major release.
55 |
# File 'lib/softlayer/VirtualDiskImage.rb', line 55 sl_attr :modified, 'modifyDate' |
#modified_at ⇒ Object
:attr_reader: modified_at The date a disk image was last modified.
48 |
# File 'lib/softlayer/VirtualDiskImage.rb', line 48 sl_attr :modified_at, 'modifyDate' |
#name ⇒ Object
:attr_reader: A descriptive name used to identify a disk image to a user.
60 |
# File 'lib/softlayer/VirtualDiskImage.rb', line 60 sl_attr :name |
#service ⇒ Object
Returns the service for interacting with this virtual disk image through the network API
187 188 189 |
# File 'lib/softlayer/VirtualDiskImage.rb', line 187 def service softlayer_client[:Virtual_Disk_Image].object_with_id(self.id) end |
#software ⇒ Object
Retrieve the references to the software that resides on a disk image. :call-seq:
software(force_update=false)
124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/softlayer/VirtualDiskImage.rb', line 124 sl_dynamic_attr :software do |resource| resource.should_update? do #only retrieved once per instance @software == nil end resource.to_update do software_references = self.service.object_mask(VirtualDiskImageSoftware.default_object_mask).getSoftwareReferences software_references.collect { |software| VirtualDiskImageSoftware.new(softlayer_client, software) unless software.empty? }.compact end end |
#source_disk_image ⇒ Object
Retrieve the original disk image that the current disk image was cloned from. :call-seq:
source_disk_image(force_update=false)
140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/softlayer/VirtualDiskImage.rb', line 140 sl_dynamic_attr :source_disk_image do |resource| resource.should_update? do #only retrieved once per instance @source_disk_image == nil end resource.to_update do source_disk_image = self.service.object_mask(VirtualDiskImage.default_object_mask).getSourceDiskImage VirtualDiskImage.new(softlayer_client, source_disk_image) unless source_disk_image.empty? end end |
#type_description ⇒ Object
Retrieve a brief description of a virtual disk image type’s function. :call-seq:
type_description(force_update=false)
156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/softlayer/VirtualDiskImage.rb', line 156 sl_dynamic_attr :type_description do |resource| resource.should_update? do #only retrieved once per instance @type_description == nil end resource.to_update do type = self.service.getType type['description'] end end |
#type_name ⇒ Object
Retrieve a virtual disk image type’s name. :call-seq:
type_name(force_update=false)
172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/softlayer/VirtualDiskImage.rb', line 172 sl_dynamic_attr :type_name do |resource| resource.should_update? do #only retrieved once per instance @type_name == nil end resource.to_update do type = self.service.getType type['name'] end end |
#units ⇒ Object
:attr_reader: The unit of storage in which the size of the image is measured. Defaults to “GB” for gigabytes.
66 |
# File 'lib/softlayer/VirtualDiskImage.rb', line 66 sl_attr :units |
#uuid ⇒ Object
:attr_reader: A disk image’s unique ID on a virtualization platform.
71 |
# File 'lib/softlayer/VirtualDiskImage.rb', line 71 sl_attr :uuid |