Class: Fog::Compute::RackspaceV2::Image

Inherits:
Model
  • Object
show all
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

Instance Method Summary collapse

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

#createdString (readonly)



23
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 23

attribute :created

#disk_configString<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'

#idString (readonly)



15
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 15

identity :id


64
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 64

attribute :links

#nameString (readonly)



19
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 19

attribute :name

#progressFixnum (readonly)



43
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 43

attribute :progress

#stateString (readonly)



31
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 31

attribute :state, :aliases => 'status'

#tenant_idString (readonly)



39
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 39

attribute :tenant_id

#updatedString (readonly)



27
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 27

attribute :updated

#user_idString (readonly)



35
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 35

attribute :user_id

Instance Method Details

#destroyObject

Destroy image

Raises:



110
111
112
113
# File 'lib/fog/rackspace/models/compute_v2/image.rb', line 110

def destroy
  requires :identity
  service.delete_image(identity)
end

#metadataFog::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 metadata=(hash={})
  .from_hash(hash)
end

#ready?(ready_state = ACTIVE, error_states = [ERROR]) ⇒ Boolean

Is image is in ready state

Raises:



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