# File lib/fog/hp/models/block_storage_v2/snapshot.rb, line 17 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
# File lib/fog/hp/models/block_storage_v2/snapshot.rb, line 23 def destroy requires :id service.delete_snapshot(id) true end
# File lib/fog/hp/models/block_storage_v2/snapshot.rb, line 29 def force=(new_force) @force = new_force end
# File lib/fog/hp/models/block_storage_v2/snapshot.rb, line 33 def ready? self.status == 'available' end
# File lib/fog/hp/models/block_storage_v2/snapshot.rb, line 37 def save identity ? update : create end
# File lib/fog/hp/models/block_storage_v2/snapshot.rb, line 43 def create requires :volume_id options = { 'display_name' => name, 'display_description' => description, 'force' => @force, 'metadata' => metadata } options = options.reject {|_, value| value.nil?} data = service.create_snapshot(volume_id, options) merge_attributes(data.body['snapshot']) true end
# File lib/fog/hp/models/block_storage_v2/snapshot.rb, line 57 def update requires :id options = { 'display_name' => name, 'display_description' => description, 'metadata' => metadata } options = options.reject {|_, value| value.nil?} data = service.update_snapshot(id, options) merge_attributes(data.body['snapshot']) true end