Sha256: c6477dc5269a964bbc7fd04446ceeb66d605ef4b2ade3200deb8d4b845a38d19

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

module Fog
  module Compute
    class Cloudstack

      class Real
        # Lists all available snapshots for the account.
        #
        # {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/listSnapshots.html]
        def list_snapshots(*args)
          options = {}
          if args[0].is_a? Hash
            options = args[0]
            options.merge!('command' => 'listSnapshots') 
          else
            options.merge!('command' => 'listSnapshots')
          end
          request(options)
        end
      end
 
      class Mock
        def list_snapshots(options={})
          snapshot_id = options.delete('id')
          if snapshot_id
            snapshots = [self.data[:snapshots][snapshot_id]]
          else
            snapshots = self.data[:snapshots].values
          end

          {
            'listsnapshotsresponse' => {
              'count' => snapshots.size,
              'snapshot' => snapshots
            }
          }
        end
      end 
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
fog-1.26.0 lib/fog/cloudstack/requests/compute/list_snapshots.rb
fog-1.25.0 lib/fog/cloudstack/requests/compute/list_snapshots.rb
nsidc-fog-1.24.1 lib/fog/cloudstack/requests/compute/list_snapshots.rb
fog-1.24.0 lib/fog/cloudstack/requests/compute/list_snapshots.rb