Sha256: 630ec2db41cd461985b523eb73f6abe2c634a49efd88911f5d413427a4e91ee5

Contents?: true

Size: 1.71 KB

Versions: 111

Compression:

Stored size: 1.71 KB

Contents

module Fog
  module AWS
    class 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',
            :idempotent => true,
            :parser     => Fog::Parsers::AWS::SimpleDB::ListDomains.new(@nil_string)
          }.merge!(options))
        end

      end

      class Mock

        def list_domains(options = {})
          response = Excon::Response.new
          keys = self.data[:domains].keys
          max = options['MaxNumberOfDomains'] || keys.size
          offset = options['NextToken'] || 0
          domains = []
          for key, value in self.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

111 entries across 111 versions & 18 rubygems

Version Path
fog-1.22.0 lib/fog/aws/requests/simpledb/list_domains.rb
fog-1.21.0 lib/fog/aws/requests/simpledb/list_domains.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/aws/requests/simpledb/list_domains.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/aws/requests/simpledb/list_domains.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/aws/requests/simpledb/list_domains.rb
fog-1.20.0 lib/fog/aws/requests/simpledb/list_domains.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/aws/requests/simpledb/list_domains.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/aws/requests/simpledb/list_domains.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/aws/requests/simpledb/list_domains.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/aws/requests/simpledb/list_domains.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/aws/requests/simpledb/list_domains.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/aws/requests/simpledb/list_domains.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/aws/requests/simpledb/list_domains.rb
fog-1.19.0 lib/fog/aws/requests/simpledb/list_domains.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/aws/requests/simpledb/list_domains.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/aws/requests/simpledb/list_domains.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/aws/requests/simpledb/list_domains.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/aws/requests/simpledb/list_domains.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/aws/requests/simpledb/list_domains.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/aws/requests/simpledb/list_domains.rb