Sha256: 7151585f387bf5ba04fbf2bbde9eece82cb4725c882b0e396d3276d44a97c6a9

Contents?: true

Size: 1.46 KB

Versions: 60

Compression:

Stored size: 1.46 KB

Contents

module Fog
  module Storage
    class Softlayer
      class Mock
        def get_containers(options = {})
          response = Excon::Response.new
          response.body = _format_containers(@containers)
          response.status = 200
          response
        end

        private

        def _format_containers(containers)
          containers.map do |name, container|
            meta = Memory.analyze(container)
            {'count' => container.length, 'bytes' => meta.bytes, 'name' => name}
          end
        end
      end

      class Real

        # List existing storage containers
        #
        # ==== Parameters
        # * options<~Hash>:
        #   * 'limit'<~Integer> - Upper limit to number of results returned
        #   * 'marker'<~String> - Only return objects with name greater than this value
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Array>:
        #     * container<~Hash>:
        #       * 'bytes'<~Integer>: - Number of bytes used by container
        #       * 'count'<~Integer>: - Number of items in container
        #       * 'name'<~String>: - Name of container
        def get_containers(options = {})
          options = options.reject {|key, value| value.nil?}
          request(
            :expects  => [200, 204],
            :method   => 'GET',
            :path     => '',
            :query    => {'format' => 'json'}.merge!(options)
          )
        end

      end
    end
  end
end

Version data entries

60 entries across 58 versions & 3 rubygems

Version Path
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-softlayer-1.1.4/lib/fog/softlayer/requests/storage/get_containers.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-softlayer-1.1.4/lib/fog/softlayer/requests/storage/get_containers.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-softlayer-1.1.4/lib/fog/softlayer/requests/storage/get_containers.rb
fog-softlayer-1.1.4 lib/fog/softlayer/requests/storage/get_containers.rb
fog-softlayer-1.1.3 lib/fog/softlayer/requests/storage/get_containers.rb
fog-softlayer-1.1.2 lib/fog/softlayer/requests/storage/get_containers.rb
fog-softlayer-1.1.1 lib/fog/softlayer/requests/storage/get_containers.rb
fog-softlayer-1.1.0 lib/fog/softlayer/requests/storage/get_containers.rb
fog-softlayer-1.0.3 lib/fog/softlayer/requests/storage/get_containers.rb
fog-softlayer-1.0.2 lib/fog/softlayer/requests/storage/get_containers.rb
fog-softlayer-1.0.1 lib/fog/softlayer/requests/storage/get_containers.rb
fog-softlayer-1.0.0 lib/fog/softlayer/requests/storage/get_containers.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-softlayer-0.4.7/lib/fog/softlayer/requests/storage/get_containers.rb
fog-softlayer-0.4.7 lib/fog/softlayer/requests/storage/get_containers.rb
fog-softlayer-0.4.6 lib/fog/softlayer/requests/storage/get_containers.rb
fog-softlayer-0.4.5 lib/fog/softlayer/requests/storage/get_containers.rb
fog-softlayer-0.4.4 lib/fog/softlayer/requests/storage/get_containers.rb
fog-softlayer-0.4.3 lib/fog/softlayer/requests/storage/get_containers.rb
fog-softlayer-0.4.2 lib/fog/softlayer/requests/storage/get_containers.rb
fog-softlayer-0.4.2.pre lib/fog/softlayer/requests/storage/get_containers.rb