Class: Fog::Compute::CloudSigma::Snapshot

Inherits:
Fog::CloudSigma::CloudsigmaModel show all
Defined in:
lib/fog/cloudsigma/models/snapshot.rb

Instance Method Summary collapse

Methods inherited from Fog::CloudSigma::CloudsigmaModel

model_attribute, model_attribute_array

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/fog/cloudsigma/models/snapshot.rb', line 70

def available?
  status == 'available'
end

#clone(clone_params = {}) ⇒ Object Also known as: promote



60
61
62
63
64
65
# File 'lib/fog/cloudsigma/models/snapshot.rb', line 60

def clone(clone_params={})
  requires :identity
  response = service.clone_snapshot(identity, clone_params)

  Volume.new(response.body)
end

#createObject



31
32
33
34
35
36
37
38
# File 'lib/fog/cloudsigma/models/snapshot.rb', line 31

def create
  requires :name, :drive
  data = attributes

  response = service.create_snapshot(data)
  new_attributes = response.body['objects'].first
  merge_attributes(new_attributes)
end

#destroyObject Also known as: delete



50
51
52
53
54
55
56
# File 'lib/fog/cloudsigma/models/snapshot.rb', line 50

def destroy
  requires :identity

  service.delete_snapshot(identity)

  true
end

#saveObject



23
24
25
26
27
28
29
# File 'lib/fog/cloudsigma/models/snapshot.rb', line 23

def save
  if persisted?
    update
  else
    create
  end
end

#updateObject



40
41
42
43
44
45
46
47
48
# File 'lib/fog/cloudsigma/models/snapshot.rb', line 40

def update
  requires :identity, :name

  data = attributes

  response = service.update_snapshot(identity, data)
  new_attributes = response.body
  merge_attributes(new_attributes)
end