Sha256: bcd518194e87546ead4948db04bc5423b8c3164b6fbf5a3390c99f954777129a

Contents?: true

Size: 950 Bytes

Versions: 2

Compression:

Stored size: 950 Bytes

Contents

# frozen_string_literal: true

module Fog
  module Aliyun
    class Storage
      class Real
        def list_buckets(options = {})
          prefix = options[:prefix]
          marker = options[:marker]
          maxKeys = options[:maxKeys] || 1000
          maxKeys = maxKeys.to_i
          maxKeys =[maxKeys,1000].min.to_s

          path = ''
          if prefix
            path += '?prefix=' + prefix
            path += '&marker=' + marker if marker
            path += '&max-keys=' + maxKeys if maxKeys

          elsif marker
            path += '?marker=' + marker
            path += '&max-keys=' + maxKeys if maxKeys

          elsif maxKeys
            path += '?max-keys=' + maxKeys
          end

          ret = request(
            expects: [200, 203],
            method: 'GET',
            path: path
          )
          xml = ret.data[:body]
          XmlSimple.xml_in(xml)['Buckets'][0]
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-aliyun-0.3.18 lib/fog/aliyun/requests/storage/list_buckets.rb
fog-aliyun-0.3.17 lib/fog/aliyun/requests/storage/list_buckets.rb