Sha256: 0d8ad33fcdd9926ab0a91a85720e2786c8aad715f10de9dd7d8c1bd01ded2373

Contents?: true

Size: 719 Bytes

Versions: 4

Compression:

Stored size: 719 Bytes

Contents

require 'fog/huaweicloud/models/collection'
require 'fog/shared_file_system/huaweicloud/models/snapshot'

module Fog
  module SharedFileSystem
    class HuaweiCloud
      class Snapshots < Fog::HuaweiCloud::Collection
        model Fog::SharedFileSystem::HuaweiCloud::Snapshot

        def all(options = {})
          load_response(service.list_snapshots_detail(options), 'snapshots')
        end

        def find_by_id(id)
          snapshot_hash = service.get_snapshot(id).body['snapshot']
          new(snapshot_hash.merge(:service => service))
        end

        alias get find_by_id

        def destroy(id)
          snapshot = find_by_id(id)
          snapshot.destroy
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-huaweicloud-0.0.3 lib/fog/shared_file_system/huaweicloud/models/snapshots.rb
fog-huaweicloud-0.0.2 lib/fog/shared_file_system/huaweicloud/models/snapshots.rb
fog-huaweicloud-0.1.3 lib/fog/shared_file_system/huaweicloud/models/snapshots.rb
fog-huaweicloud-0.1.2 lib/fog/shared_file_system/huaweicloud/models/snapshots.rb