Class: Fog::Compute::GoGrid::Image

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

Instance Method Summary collapse

Instance Method Details

#destroyObject



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

def destroy
  requires :id

  service.grid_server_delete(id)
  true
end

#ready?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/fog/go_grid/models/compute/image.rb', line 40

def ready?
  status == 'Available'
end

#saveObject

Raises:

  • (Fog::Errors::Error)


44
45
46
47
48
49
50
51
# File 'lib/fog/go_grid/models/compute/image.rb', line 44

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

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

#server=(new_server) ⇒ Object



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

def server=(new_server)
  requires :id

  @server_id = new_server.id
end