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



62
63
64
65
66
# File 'lib/fog/brightbox/models/compute/image.rb', line 62

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

#ready?Boolean

Returns:

  • (Boolean)


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

def ready?
  status == "available"
end

#saveObject

Raises:

  • (Fog::Errors::Error)


44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/fog/brightbox/models/compute/image.rb', line 44

def save
  raise Fog::Errors::Error, "Resaving an existing object may create a duplicate" if persisted?

  options = {
    arch: arch,
    description: description,
    http_url: http_url,
    name: name,
    server: server,
    source: source,
    username: username,
    volume: volume
  }.delete_if { |_k, v| v.nil? || v == "" }
  data = service.create_image(options)
  merge_attributes(data)
  true
end