Class: 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.
Attributes inherited from Model
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.
Methods inherited from Model
#inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Fog::Core::DeprecatedConnectionAccessors
#connection, #connection=, #prepare_service_value
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
Constructor Details
#initialize(attributes = {}) ⇒ Image
Returns a new instance of 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)
Returns The time stamp for the creation date.
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)
Returns The server id.
15 |
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 15 identity :id |
#links ⇒ Array (readonly)
Returns image links.
64 |
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 64 attribute :links |
#name ⇒ String (readonly)
Returns The image name.
19 |
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 19 attribute :name |
#progress ⇒ Fixnum (readonly)
Returns The build completion progress, as a percentage. Value is from 0 to 100.
43 |
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 43 attribute :progress |
#state ⇒ String (readonly)
Returns image status.
31 |
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 31 attribute :state, :aliases => 'status' |
#tenant_id ⇒ String (readonly)
Returns The tenant Id.
39 |
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 39 attribute :tenant_id |
#updated ⇒ String (readonly)
Returns The time stamp for the last update.
27 |
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 27 attribute :updated |
#user_id ⇒ String (readonly)
Returns The user Id.
35 |
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 35 attribute :user_id |
Instance Method Details
#destroy ⇒ Object
Destroy image
111 112 113 114 |
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 111 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 |