Sha256: 01467a0caa9a996cd3d90eff235a12484f8d49bc3cc52545e55f28d3cef05fcf

Contents?: true

Size: 1.67 KB

Versions: 49

Compression:

Stored size: 1.67 KB

Contents

module Fog
  module AWS
    module SimpleDB
      class Real

        require 'fog/aws/parsers/simpledb/list_domains'

        # List SimpleDB domains
        #
        # ==== Parameters
        # * options<~Hash> - options, defaults to {}
        #   * 'MaxNumberOfDomains'<~Integer> - number of domains to return
        #     between 1 and 100, defaults to 100
        #   * 'NextToken'<~String> - Offset token to start listing, defaults to nil
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'BoxUsage'
        #     * 'Domains' - array of domain names.
        #     * 'NextToken' - offset to start with if there are are more domains to list
        #     * 'RequestId'
        def list_domains(options = {})
          request({
            'Action' => 'ListDomains',
            :parser  => Fog::Parsers::AWS::SimpleDB::ListDomains.new(@nil_string)
          }.merge!(options))
        end

      end

      class Mock

        def list_domains(options = {})
          response = Excon::Response.new
          keys = @data[:domains].keys
          max = options['MaxNumberOfDomains'] || keys.size
          offset = options['NextToken'] || 0
          domains = []
          for key, value in @data[:domains].keys[offset...max]
            domains << key
          end
          response.status = 200
          response.body = {
            'BoxUsage'  => Fog::AWS::Mock.box_usage,
            'Domains'   => domains,
            'RequestId' => Fog::AWS::Mock.request_id
          }
          if max < keys.size
            response.body['NextToken'] = max + 1
          end
          response
        end

      end
    end
  end
end

Version data entries

49 entries across 49 versions & 2 rubygems

Version Path
fog-0.2.30 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.2.28 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.2.27 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.2.26 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.2.25 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.2.24 lib/fog/aws/requests/simpledb/list_domains.rb
tecnh-fog-0.2.23.vpc lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.2.23 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.2.22 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.2.21 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.2.20 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.2.19 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.2.18 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.2.17 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.2.16 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.2.15 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.2.14 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.2.13 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.2.12 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.2.11 lib/fog/aws/requests/simpledb/list_domains.rb