class Fog::Compute::Google::Snapshot

Constants

CREATING_STATE
DELETING_STATE
FAILED_STATE
READY_STATE
UPLOADING_STATE

Public Instance Methods

destroy(async = true) click to toggle source
# File lib/fog/compute/google/models/snapshot.rb, line 30
def destroy(async = true)
  requires :identity

  data = service.delete_snapshot(identity)
  operation = Fog::Compute::Google::Operations.new(:service => service)
                                              .get(data.name)
  operation.wait_for { ready? } unless async
  operation
end
ready?() click to toggle source
# File lib/fog/compute/google/models/snapshot.rb, line 52
def ready?
  status == READY_STATE
end
resource_url() click to toggle source
# File lib/fog/compute/google/models/snapshot.rb, line 56
def resource_url
  "#{service.project}/global/snapshots/#{name}"
end
set_labels(new_labels) click to toggle source
# File lib/fog/compute/google/models/snapshot.rb, line 40
def set_labels(new_labels)
  requires :identity, :label_fingerprint

  unless new_labels.is_a? Hash
    raise ArgumentError,
          "Labels should be a hash, e.g. {foo: \"bar\",fog: \"test\"}"
  end

  service.set_snapshot_labels(identity, label_fingerprint, new_labels)
  reload
end