Sha256: b0fb73c0cc73cda0bb622a034a92b768cfd0645e527d06a8362582c643959fe6

Contents?: true

Size: 848 Bytes

Versions: 26

Compression:

Stored size: 848 Bytes

Contents

module Fog
  module Compute
    class Google
      class Snapshots < Fog::Collection
        model Fog::Compute::Google::Snapshot

        def all
          items = []
          next_page_token = nil
          loop do
            data = service.list_snapshots(:page_token => next_page_token)
            next_items = data.to_h[:items] || []
            items.concat(next_items)
            next_page_token = data.next_page_token
            break if next_page_token.nil? || next_page_token.empty?
          end
          load(items)
        end

        def get(identity)
          if identity
            snapshot = service.get_snapshot(identity).to_h
            return new(snapshot)
          end
        rescue ::Google::Apis::ClientError => e
          raise e unless e.status_code == 404
          nil
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
fog-google-1.24.1 lib/fog/compute/google/models/snapshots.rb
fog-google-1.24.0 lib/fog/compute/google/models/snapshots.rb
fog-google-1.23.0 lib/fog/compute/google/models/snapshots.rb
fog-google-1.22.0 lib/fog/compute/google/models/snapshots.rb
fog-google-1.21.1 lib/fog/compute/google/models/snapshots.rb
fog-google-1.21.0 lib/fog/compute/google/models/snapshots.rb
fog-google-1.20.0 lib/fog/compute/google/models/snapshots.rb
fog-google-1.19.0 lib/fog/compute/google/models/snapshots.rb
fog-google-1.18.0 lib/fog/compute/google/models/snapshots.rb
fog-google-1.17.0 lib/fog/compute/google/models/snapshots.rb
fog-google-1.16.1 lib/fog/compute/google/models/snapshots.rb
fog-google-1.16.0 lib/fog/compute/google/models/snapshots.rb
fog-google-1.15.0 lib/fog/compute/google/models/snapshots.rb
fog-google-1.14.0 lib/fog/compute/google/models/snapshots.rb
gitlab-fog-google-1.14.0 lib/fog/compute/google/models/snapshots.rb
fog-google-1.13.0 lib/fog/compute/google/models/snapshots.rb
gitlab-fog-google-1.13.0 lib/fog/compute/google/models/snapshots.rb
fog-google-1.12.1 lib/fog/compute/google/models/snapshots.rb
fog-google-1.12.0 lib/fog/compute/google/models/snapshots.rb
fog-google-1.11.0 lib/fog/compute/google/models/snapshots.rb