Class: Fog::HP::BlockStorageV2::Snapshot

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/hp/models/block_storage_v2/snapshot.rb

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Snapshot

Returns a new instance of Snapshot.



19
20
21
22
23
# File 'lib/fog/hp/models/block_storage_v2/snapshot.rb', line 19

def initialize(attributes = {})
  # assign these attributes first to prevent race condition with persisted?
  self.force = attributes.delete(:force)   # force snapshotting of attached volumes
  super
end

Instance Method Details

#destroyObject



25
26
27
28
29
# File 'lib/fog/hp/models/block_storage_v2/snapshot.rb', line 25

def destroy
  requires :id
  service.delete_snapshot(id)
  true
end

#force=(new_force) ⇒ Object



31
32
33
# File 'lib/fog/hp/models/block_storage_v2/snapshot.rb', line 31

def force=(new_force)
  @force = new_force
end

#ready?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/fog/hp/models/block_storage_v2/snapshot.rb', line 35

def ready?
  self.status == 'available'
end

#saveObject



39
40
41
# File 'lib/fog/hp/models/block_storage_v2/snapshot.rb', line 39

def save
  identity ? update : create
end