Sha256: 423b6e0418a83957a01eb3a0118be2d8a7a5fa4df9081ad0dc8386b3ae87c5e2

Contents?: true

Size: 1.69 KB

Versions: 25

Compression:

Stored size: 1.69 KB

Contents

unless Fog.mocking?

  module Fog
    module AWS
      class SimpleDB

        # 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<~Fog::AWS::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'
          }.merge!(options), Fog::Parsers::AWS::SimpleDB::ListDomains.new(@nil_string))
        end

      end
    end
  end

else

  module Fog
    module AWS
      class SimpleDB

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

25 entries across 25 versions & 1 rubygems

Version Path
fog-0.0.29 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.0.28 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.0.27 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.0.26 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.0.25 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.0.24 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.0.23 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.0.22 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.0.21 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.0.20 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.0.19 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.0.18 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.0.17 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.0.16 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.0.15 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.0.14 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.0.13 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.0.12 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.0.11 lib/fog/aws/requests/simpledb/list_domains.rb
fog-0.0.10 lib/fog/aws/requests/simpledb/list_domains.rb