Class | AWS::Core::Client |
In: |
lib/aws/core/client.rb
|
Parent: | Object |
Base client class for all of the Amazon AWS service clients.
CACHEABLE_REQUESTS | = | Set[] | @api private |
config | [R] | @return [Configuration] This clients configuration. |
credential_provider | [R] |
@return [CredentialProviders::Provider]
Returns the credential
provider for this client. @api private |
endpoint | [R] |
@return [String] Returns the service endpoint (hostname) this client
makes requests against. @api private |
http_read_timeout | [R] |
@return [Integer] The number of seconds before requests made by
this client should timeout if they have not received a response. @api private |
port | [R] | @return [Integer] What port this client makes requests via. @api private |
service_ruby_name | [R] |
@return [String] The snake-cased ruby name for the service
(e.g. 's3', 'iam', 'dynamo_db', etc). @api private |
Creates a new low-level client. @param [Hash] options @option options [Core::Configuration] :config (AWS.config)
The base configuration object to use. All other options are merged with this. Defaults to the AWS.config.
@option (see AWS.config)
Adds a single method to the current client class. This method yields a request method builder that allows you to specify how:
Defines one method for each service operation described in the API configuration. @param [String] api_version
Loads the API configuration for the given API version. @param [String] api_version The API version date string
(e.g. '2012-01-05').
@return [Hash]
@return [Array<Symbol>] Returns a list of service operations as
method names supported by this client.
@api private
Define this in sub-classes (e.g. QueryClient, RESTClient, etc)
Define this in sub-classes (e.g. QueryClient, RESTClient, etc)
@param [Symbol] version @param [String,nil] service_signing_name Required for `:Version4` @api private
Logs the warning to the configured logger, otherwise to stderr. @param [String] warning @return [nil]
Primarily used for testing, this method returns an empty pseudo service response without making a request. Its used primarily for testing the lighter level service interfaces. @api private
@param [Configuration] config The configuration object to use. @return [Core::Client] Returns a new client object with the given
configuration.
@api private
Returns a copy of the client with a different HTTP handler. You can pass an object like BuiltinHttpHandler or you can use a block; for example:
s3_with_logging = s3.with_http_handler do |request, response| $stderr.puts request.inspect super(request, response) $stderr.puts response.inspect end
The block executes in the context of an HttpHandler instance, and `super` delegates to the HTTP handler used by this client. This provides an easy way to spy on requests and responses. See HttpHandler, HttpRequest, and HttpResponse for more details on how to implement a fully functional HTTP handler using a different HTTP library than the one that ships with Ruby. @param handler (nil) A new http handler. Leave blank and pass a
block to wrap the current handler with the block.
@return [Core::Client] Returns a new instance of the client class with
the modified or wrapped http handler.
Returns a new client with the passed configuration options merged with the current configuration options.
no_retry_client = client.with_options(:max_retries => 0)
@param [Hash] options @option (see AWS.config) @return [Client]
Given an error code string, this method will return an error class.
AWS::EC2::Client.new.send(:error_code, 'InvalidInstanceId') #=> AWS::EC2::Errors::InvalidInstanceId
@param [String] error_code The error code string as returned by
the service. If this class contains periods, they will be converted into namespaces (e.g. 'Foo.Bar' becomes Errors::Foo::Bar).
@return [Class]
Returns the ::Errors module for the current client.
AWS::S3::Client.new.errors_module #=> AWS::S3::Errors
@return [Module]
@return [Boolean] Returns `true` if the response contains an
error message that indicates credentials have expired.
Extracts the error code and error message from a response if it contains an error. Returns nil otherwise. Should be defined in sub-classes (e.g. QueryClient, RESTClient, etc). @param [Response] response @return [Array<Code,Message>,nil] Should return an array with an
error code and message, or `nil`.
Logs the response to the configured logger. @param [Response] response @return [nil]