Class: Fog::Compute::Rackspace::Image

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/rackspace/models/compute/image.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject


22
23
24
25
26
27
# File 'lib/fog/rackspace/models/compute/image.rb', line 22

def destroy
  requires :id

  service.delete_image(id)
  true
end

#ready?Boolean


29
30
31
# File 'lib/fog/rackspace/models/compute/image.rb', line 29

def ready?
  status == 'ACTIVE'
end

#saveObject

Raises:

  • (Fog::Errors::Error)

33
34
35
36
37
38
39
40
# File 'lib/fog/rackspace/models/compute/image.rb', line 33

def save
  raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
  requires :server_id

  data = service.create_image(server_id, 'name' => name)
  merge_attributes(data.body['image'])
  true
end

#server=(new_server) ⇒ Object


16
17
18
19
20
# File 'lib/fog/rackspace/models/compute/image.rb', line 16

def server=(new_server)
  requires :id

  self.server_id = new_server.id
end