Class: AWS.Config
- Inherits:
-
Object
- Object
- AWS.Config
- Defined in:
- lib/config.js
Overview
The main configuration class used by all service objects to set the region, credentials, and other options for requests.
By default, credentials and region settings are left unconfigured. This should be configured by the application before using any AWS service APIs.
In order to set global configuration options, properties should be assigned to the global AWS.config object.
IBM Unsupported
Defined Under Namespace
Modules: keys
Constructor Summary collapse
-
new AWS.Config(options) ⇒ void
constructor
Creates a new configuration object.
General Configuration Options collapse
-
computeChecksums ⇒ Boolean
readwrite
Whether to compute checksums for payload bodies when the service accepts it (currently supported in S3 only).
-
convertResponseTypes ⇒ Boolean
readwrite
Whether types are converted when parsing response data.
-
correctClockSkew ⇒ Boolean
readwrite
Whether to apply a clock skew correction and retry requests that fail because of an skewed client clock.
-
credentials ⇒ AWS.Credentials
readwrite
The AWS credentials to sign requests with.
-
httpOptions ⇒ map
readwrite
A set of options to pass to the low-level HTTP request.
-
logger ⇒ #write, #log
readwrite
An object that responds to .write() (like a stream) or .log() (like the console object) in order to log information about requests.
-
maxRedirects ⇒ Integer
readwrite
The maximum amount of redirects to follow for a service request.
-
maxRetries ⇒ Integer
readwrite
The maximum amount of retries to perform for a service request.
-
paramValidation ⇒ Boolean|map
readwrite
Whether input parameters should be validated against the operation description before sending the request.
-
region ⇒ AWS.Credentials
readwrite
The region to send service requests to.
-
retryDelayOptions ⇒ map
readwrite
A set of options to configure the retry delay on retryable errors.
-
s3BucketEndpoint ⇒ Boolean
readwrite
Whether the provided endpoint addresses an individual bucket (false if it addresses the root API endpoint).
-
s3DisableBodySigning ⇒ Boolean
readwrite
Whether to disable S3 body signing when using signature version
v4
. -
s3ForcePathStyle ⇒ Boolean
readwrite
Whether to force path style URLs for S3 objects.
-
signatureCache ⇒ Boolean
readwrite
Whether the signature to sign requests with (overriding the API configuration) is cached.
-
signatureVersion ⇒ String
readwrite
The signature version to sign requests with (overriding the API configuration).
-
sslEnabled ⇒ Boolean
readwrite
Whether SSL is enabled for requests.
-
systemClockOffset ⇒ Number
readwrite
An offset value in milliseconds to apply to all signing times.
-
useAccelerateEndpoint ⇒ Boolean
readwrite
Whether to use the Accelerate endpoint with the S3 service.
-
useDualstackEndpoint ⇒ Boolean
readwrite
Enables IPv6 dualstack endpoint.
-
useFipsEndpoint ⇒ Boolean
readwrite
Enables FIPS compatible endpoints.
Service-Specific Config Options collapse
-
s3 ⇒ AWS.Config, map
readwrite
Service-specific configuration options for AWS.S3.
Managing Credentials collapse
-
getCredentials(callback) ⇒ void
Loads credentials from the configuration object.
-
getToken(callback) ⇒ void
Loads token from the configuration object.
Loading and Setting Configuration Options collapse
-
getPromisesDependency() ⇒ void
Gets the promise dependency set by
AWS.config.setPromisesDependency
. -
loadFromPath(path) ⇒ AWS.Config
Loads configuration data from a JSON file into this config object.
-
setPromisesDependency(dep) ⇒ void
Sets the promise dependency the SDK will use wherever Promises are returned.
-
update(options, allowUnknownKeys = false) ⇒ void
Updates the current configuration object with new options.
Constructor Details
new AWS.Config(options) ⇒ void
Creates a new configuration object. This is the object that passes option data along to service requests, including credentials, security, region information, and some service specific settings.
IBM Unsupported
Property Details
computeChecksums ⇒ Boolean (readwrite)
Returns whether to compute checksums for payload bodies when the service accepts it (currently supported in S3 only).
convertResponseTypes ⇒ Boolean (readwrite)
Returns whether types are converted when parsing response data.
Currently only supported for JSON based services. Turning this off may
improve performance on large response payloads. Defaults to true
.
correctClockSkew ⇒ Boolean (readwrite)
Returns whether to apply a clock skew correction and retry
requests that fail because of an skewed client clock. Defaults to
false
.
credentials ⇒ AWS.Credentials (readwrite)
Returns the AWS credentials to sign requests with.
httpOptions ⇒ map (readwrite)
Returns A set of options to pass to the low-level HTTP request. Currently supported options are:
- proxy [String] — the URL to proxy requests through
- agent [http.Agent, https.Agent] — the Agent object to perform HTTP requests with. Used for connection pooling. Note that for SSL connections, a special Agent object is used in order to enable peer certificate verification. This feature is only supported in the Node.js environment.
- connectTimeout [Integer] — Sets the socket to timeout after
failing to establish a connection with the server after
connectTimeout
milliseconds. This timeout has no effect once a socket connection has been established. - timeout [Integer] — The number of milliseconds a request can take before automatically being terminated. Defaults to two minutes (120000).
- xhrAsync [Boolean] — Whether the SDK will send asynchronous HTTP requests. Used in the browser environment only. Set to false to send requests synchronously. Defaults to true (async on).
- xhrWithCredentials [Boolean] — Sets the "withCredentials" property of an XMLHttpRequest object. Used in the browser environment only. Defaults to false.
logger ⇒ #write, #log (readwrite)
Returns an object that responds to .write() (like a stream) or .log() (like the console object) in order to log information about requests.
maxRedirects ⇒ Integer (readwrite)
Returns the maximum amount of redirects to follow for a service request. Defaults to 10.
maxRetries ⇒ Integer (readwrite)
Returns the maximum amount of retries to perform for a service request. By default this value is calculated by the specific service object that the request is being made to.
paramValidation ⇒ Boolean|map (readwrite)
Returns whether input parameters should be validated against the operation description before sending the request. Defaults to true. Pass a map to enable any of the following specific validation features:
- min [Boolean] — Validates that a value meets the min
constraint. This is enabled by default when paramValidation is set
to
true
. - max [Boolean] — Validates that a value meets the max constraint.
- pattern [Boolean] — Validates that a string value matches a regular expression.
- enum [Boolean] — Validates that a string value matches one of the allowable enum values.
region ⇒ AWS.Credentials (readwrite)
Returns The region to send service requests to.
retryDelayOptions ⇒ map (readwrite)
Returns A set of options to configure the retry delay on retryable errors. Currently supported options are:
base [Integer] — The base number of milliseconds to use in the exponential backoff for operation retries. Defaults to 100 ms for all services except DynamoDB, where it defaults to 50ms.
customBackoff [function] — A custom function that accepts a retry count and error and returns the amount of time to delay in milliseconds. If the result is a non-zero negative value, no further retry attempts will be made. The
base
option will be ignored if this option is supplied. The function is only called for retryable errors.
s3BucketEndpoint ⇒ Boolean (readwrite)
Setting this configuration option requires an endpoint
to be
provided explicitly to the service constructor.
Returns whether the provided endpoint addresses an individual bucket (false if it addresses the root API endpoint).
s3DisableBodySigning ⇒ Boolean (readwrite)
Returns whether to disable S3 body signing when using signature version v4
.
Body signing can only be disabled when using https. Defaults to true
.
s3ForcePathStyle ⇒ Boolean (readwrite)
Returns whether to force path style URLs for S3 objects.
signatureCache ⇒ Boolean (readwrite)
Returns whether the signature to sign requests with (overriding
the API configuration) is cached. Only applies to the signature version 'v4'.
Defaults to true
.
signatureVersion ⇒ String (readwrite)
Returns the signature version to sign requests with (overriding the API configuration). Possible values are: 'v2', 'v3', 'v4'.
sslEnabled ⇒ Boolean (readwrite)
Returns whether SSL is enabled for requests.
systemClockOffset ⇒ Number (readwrite)
Returns an offset value in milliseconds to apply to all signing
times. Use this to compensate for clock skew when your system may be
out of sync with the service time. Note that this configuration option
can only be applied to the global AWS.config
object and cannot be
overridden in service-specific configuration. Defaults to 0 milliseconds.
useAccelerateEndpoint ⇒ Boolean (readwrite)
This configuration option is only compatible with S3 while accessing dns-compatible buckets.
Returns Whether to use the Accelerate endpoint with the S3 service.
Defaults to false
.
useDualstackEndpoint ⇒ Boolean (readwrite)
Returns Enables IPv6 dualstack endpoint. Defaults to false
.
useFipsEndpoint ⇒ Boolean (readwrite)
Returns Enables FIPS compatible endpoints. Defaults to false
.
Method Details
getCredentials(callback) ⇒ void
If you configure the SDK with static or environment credentials, the credential data should already be present in credentials attribute. This method is primarily necessary to load credentials from asynchronous sources, or sources that can refresh credentials periodically.
Loads credentials from the configuration object. This is used internally by the SDK to ensure that refreshable AWS.Credentials objects are properly refreshed and loaded when sending a request. If you want to ensure that your credentials are loaded prior to a request, you can use this method directly to provide accurate credential data stored in the object.
getPromisesDependency() ⇒ void
Gets the promise dependency set by AWS.config.setPromisesDependency
.
getToken(callback) ⇒ void
If you configure the SDK with static token, the token data should already be present in AWS.Config.token attribute. This method is primarily necessary to load token from asynchronous sources, or sources that can refresh token periodically.
Loads token from the configuration object. This is used internally by the SDK to ensure that refreshable AWS.Token objects are properly refreshed and loaded when sending a request. If you want to ensure that your token is loaded prior to a request, you can use this method directly to provide accurate token data stored in the object.
loadFromPath(path) ⇒ AWS.Config
Loading configuration will reset all existing configuration on the object.
This feature is not supported in the browser environment of the SDK.
Loads configuration data from a JSON file into this config object.
setPromisesDependency(dep) ⇒ void
Sets the promise dependency the SDK will use wherever Promises are returned.
Passing null
will force the SDK to use native Promises if they are available.
If native Promises are not available, passing null
will have no effect.