Class: Fog::Compute::RackspaceV2::Image
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::RackspaceV2::Image
- Defined in:
- lib/fog/rackspace/models/compute_v2/image.rb
Constant Summary collapse
- UNKNOWN =
'UNKNOWN'- ACTIVE =
'ACTIVE'- SAVING =
'SAVING'- ERROR =
'ERROR'- DELETED =
'DELETED'
Instance Attribute Summary collapse
-
#created ⇒ String
readonly
The time stamp for the creation date.
-
#disk_config ⇒ String<AUTO, MANUAL>
The disk configuration value.
-
#id ⇒ String
readonly
The server id.
-
#links ⇒ Array
readonly
Image links.
-
#name ⇒ String
readonly
The image name.
-
#progress ⇒ Fixnum
readonly
The build completion progress, as a percentage.
-
#state ⇒ String
readonly
Image status.
-
#tenant_id ⇒ String
readonly
The tenant Id.
-
#updated ⇒ String
readonly
The time stamp for the last update.
-
#user_id ⇒ String
readonly
The user Id.
Instance Method Summary collapse
-
#destroy ⇒ Object
Destroy image.
-
#initialize(attributes = {}) ⇒ Image
constructor
A new instance of Image.
-
#metadata ⇒ Fog::Compute::RackspaceV2::Metadata
Image metadata.
-
#metadata=(hash = {}) ⇒ Object
Set server metadata.
-
#ready?(ready_state = ACTIVE, error_states = [ERROR]) ⇒ Boolean
Is image is in ready state.
Constructor Details
#initialize(attributes = {}) ⇒ Image
66 67 68 69 |
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 66 def initialize(attributes={}) @service = attributes[:service] super end |
Instance Attribute Details
#created ⇒ String (readonly)
23 |
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 23 attribute :created |
#disk_config ⇒ String<AUTO, MANUAL>
The disk configuration value.
* AUTO - The server is built with a single partition the size of the target flavor disk. The file system is automatically adjusted to fit the entire partition.
This keeps things simple and automated. AUTO is valid only for images and servers with a single partition that use the EXT3 file system.
This is the default setting for applicable Rackspace base images.
* MANUAL - The server is built using whatever partition scheme and file system is in the source image. If the target flavor disk is larger,
the remaining disk space is left unpartitioned. This enables images to have non-EXT3 file systems, multiple partitions,
and so on, and enables you to manage the disk configuration.
60 |
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 60 attribute :disk_config, :aliases => 'OS-DCF:diskConfig' |
#id ⇒ String (readonly)
15 |
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 15 identity :id |
#links ⇒ Array (readonly)
64 |
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 64 attribute :links |
#name ⇒ String (readonly)
19 |
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 19 attribute :name |
#progress ⇒ Fixnum (readonly)
43 |
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 43 attribute :progress |
#state ⇒ String (readonly)
31 |
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 31 attribute :state, :aliases => 'status' |
#tenant_id ⇒ String (readonly)
39 |
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 39 attribute :tenant_id |
#updated ⇒ String (readonly)
27 |
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 27 attribute :updated |
#user_id ⇒ String (readonly)
35 |
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 35 attribute :user_id |
Instance Method Details
#destroy ⇒ Object
Destroy image
110 111 112 113 |
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 110 def destroy requires :identity service.delete_image(identity) end |
#metadata ⇒ Fog::Compute::RackspaceV2::Metadata
Image metadata
73 74 75 76 77 78 79 80 |
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 73 def @metadata ||= begin Fog::Compute::RackspaceV2::Metadata.new({ :service => service, :parent => self }) end end |
#metadata=(hash = {}) ⇒ Object
Set server metadata
84 85 86 |
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 84 def (hash={}) .from_hash(hash) end |
#ready?(ready_state = ACTIVE, error_states = [ERROR]) ⇒ Boolean
Is image is in ready state
97 98 99 100 101 102 103 |
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 97 def ready?(ready_state = ACTIVE, error_states=[ERROR]) if error_states error_states = Array(error_states) raise InvalidImageStateException.new(ready_state, state) if error_states.include?(state) end state == ready_state end |