Sha256: 3e192103770c4e0054c77f5bcc39c12b975e13656561e68ca9718f73ff10420e

Contents?: true

Size: 1.56 KB

Versions: 12

Compression:

Stored size: 1.56 KB

Contents

# frozen_string_literal: true

module Fog
  module Storage
    class Aliyun
      class Real
        def get_container(container, options = {})
          options = options.reject { |_key, value| value.nil? }

          bucket = options[:bucket]
          bucket ||= @aliyun_oss_bucket

          marker = options[:marker]
          maxKeys = options[:maxKeys]
          delimiter = '/'

          path = ''

          prefix = if container == '' || container == '.' || container.nil?
                     nil
                   else
                     container + '/'
                   end

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

          location = get_bucket_location(bucket)
          resource = bucket + '/'
          ret = request(
            expects: [200, 203, 400],
            method: 'GET',
            path: path,
            resource: resource,
            bucket: bucket
          )
          xml = ret.data[:body]
          XmlSimple.xml_in(xml)['CommonPrefixes']
        end
      end
    end
  end
end

Version data entries

12 entries across 10 versions & 2 rubygems

Version Path
fog-aliyun-0.3.10 lib/fog/aliyun/requests/storage/get_container.rb
fog-aliyun-0.3.9 lib/fog/aliyun/requests/storage/get_container.rb
fog-aliyun-0.3.8 lib/fog/aliyun/requests/storage/get_container.rb
fog-aliyun-0.3.7 lib/fog/aliyun/requests/storage/get_container.rb
fog-aliyun-0.3.6 lib/fog/aliyun/requests/storage/get_container.rb
fog-aliyun-0.3.5 lib/fog/aliyun/requests/storage/get_container.rb
fog-aliyun-0.3.4 lib/fog/aliyun/requests/storage/get_container.rb
fog-aliyun-0.3.3 lib/fog/aliyun/requests/storage/get_container.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-aliyun-0.3.2/lib/fog/aliyun/requests/storage/get_container.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-aliyun-0.3.2/lib/fog/aliyun/requests/storage/get_container.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-aliyun-0.3.2/lib/fog/aliyun/requests/storage/get_container.rb
fog-aliyun-0.3.2 lib/fog/aliyun/requests/storage/get_container.rb