class Fog::OpenStack::Volume::V1::Snapshot

Public Instance Methods

create() click to toggle source
# File lib/fog/openstack/volume/v1/models/snapshot.rb, line 28
def create
  requires :display_name

  # volume_id, name, description, force=false
  response = service.create_snapshot(attributes[:volume_id],
                                     attributes[:display_name],
                                     attributes[:display_description],
                                     attributes[:force])
  merge_attributes(response.body['snapshot'])

  self
end
save() click to toggle source
# File lib/fog/openstack/volume/v1/models/snapshot.rb, line 17
def save
  requires :display_name
  data = if id.nil?
           service.create_snapshot(attributes[:volume_id], display_name, display_description, force)
         else
           service.update_snapshot(id, attributes.reject { |k, _v| k == :id })
         end
  merge_attributes(data.body['snapshot'])
  true
end