Class: Fog::Brightbox::Compute::Image

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

Instance Method Summary collapse

Methods included from ResourceLocking

#lock!, #locked?, #unlock!

Methods included from ModelHelper

#collection_name, #resource_name

Instance Method Details

#destroyObject



54
55
56
57
58
# File 'lib/fog/brightbox/models/compute/image.rb', line 54

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

#ready?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/fog/brightbox/models/compute/image.rb', line 35

def ready?
  status == "available"
end

#saveObject

Raises:

  • (Fog::Errors::Error)


39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/fog/brightbox/models/compute/image.rb', line 39

def save
  raise Fog::Errors::Error.new("Resaving an existing object may create a duplicate") if persisted?
  requires :source, :arch
  options = {
    :source => source,
    :arch => arch,
    :name => name,
    :username => username,
    :description => description
  }.delete_if { |_k, v| v.nil? || v == "" }
  data = service.create_image(options)
  merge_attributes(data)
  true
end