Class: Fog::Rackspace::Servers::Image

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

Instance Attribute Summary

Attributes inherited from Model

#connection

Instance Method Summary collapse

Methods inherited from Model

#_dump, _load, aliases, attribute, #attributes, attributes, #collection, identity, #identity, #initialize, #inspect, #merge_attributes, #new_record?, #reload, #requires, #to_json, #wait_for

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#destroyObject


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

def destroy
  requires :id

  connection.delete_image(@id)
  true
end

#saveObject


30
31
32
33
34
35
36
# File 'lib/fog/rackspace/models/servers/image.rb', line 30

def save
  requires :server_id

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

#server=(new_server) ⇒ Object


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

def server=(new_server)
  requires :id

  @server_id = new_server.id
end