Method: Fog::Compute::AWS::Real#describe_snapshots

Defined in:
lib/fog/compute/requests/aws/describe_snapshots.rb

#describe_snapshots(filters = {}, options = {}) ⇒ Object

Describe all or specified snapshots

Parameters

  • filters<~Hash> - List of filters to limit results with

  • options<~Hash>:

    • ‘Owner’<~String> - Owner of snapshot in [‘self’, ‘amazon’, account_id]

    • ‘RestorableBy’<~String> - Account id of user who can create volumes from this snapshot

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘requestId’<~String> - Id of request

      • ‘snapshotSet’<~Array>:

        • ‘progress’<~String>: The percentage progress of the snapshot

        • ‘snapshotId’<~String>: Id of the snapshot

        • ‘startTime’<~Time>: Timestamp of when snapshot was initiated

        • ‘status’<~String>: Snapshot state, in [‘pending’, ‘completed’]

        • ‘volumeId’<~String>: Id of volume that snapshot contains

Amazon API Reference



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/fog/compute/requests/aws/describe_snapshots.rb', line 28

def describe_snapshots(filters = {}, options = {})
  unless filters.is_a?(Hash)
    Formatador.display_line("[yellow][WARN] describe_snapshots with #{filters.class} param is deprecated, use describe_snapshots('snapshot-id' => []) instead[/] [light_black](#{caller.first})[/]")
    filters = {'snapshot-id' => [*filters]}
  end
  unless options.empty?
    Formatador.display_line("[yellow][WARN] describe_snapshots with a second param is deprecated, use describe_snapshots(options) instead[/] [light_black](#{caller.first})[/]")
  end

  for key in ['ExecutableBy', 'ImageId', 'Owner', 'RestorableBy']
    if filters.has_key?(key)
      options[key] = filters.delete(key)
    end
  end
  options['RestorableBy'] ||= 'self'
  params = Fog::AWS.indexed_filters(filters).merge!(options)
  request({
    'Action'    => 'DescribeSnapshots',
    :idempotent => true,
    :parser     => Fog::Parsers::Compute::AWS::DescribeSnapshots.new
  }.merge!(params))
end