git-off

Log

Files

Refs

README

config.d.ts (9124B)

     1 /// <reference types="node" />
     2 
     3 import {Agent as httpAgent} from 'http';
     4 import {Agent as httpsAgent} from 'https';
     5 import {AWSError} from './error';
     6 import {Credentials, CredentialsOptions} from './credentials';
     7 import {ConfigurationServicePlaceholders, ConfigurationServiceApiVersions} from './config_service_placeholders';
     8 
     9 export class ConfigBase extends ConfigurationOptions{
    10     constructor(options?: ConfigurationOptions);
    11     /**
    12      * Loads credentials from the configuration object.
    13      */
    14     getCredentials(callback: (err: AWSError) => void): void;
    15     /**
    16      * Loads configuration data from a JSON file into this config object.
    17      * Loading configuration willr eset all existing configuration on the object.
    18      * This feature is not supported in the browser environment of the SDK.
    19      * 
    20      * @param {string} path - the path relative to your process's current working directory to load configuration from.
    21      */
    22     loadFromPath(path: string): ConfigBase;
    23     /**
    24      * Updates the current configuration object with new options.
    25      * 
    26      * @param {ConfigurationOptions} options - a map of option keys and values.
    27      * @param {boolean} allowUnknownKeys - Whether unknown keys can be set on the configuration object.
    28      */
    29     update(options: ConfigurationOptions & {[key: string]: any}, allowUnknownKeys: true): void;
    30     /**
    31      * Updates the current configuration object with new options.
    32      * 
    33      * @param {ConfigurationOptions} options - a map of option keys and values.
    34      * @param {boolean} allowUnknownKeys - Defaults to false. Whether unknown keys can be set on the configuration object.
    35      */
    36     update(options: ConfigurationOptions, allowUnknownKeys?: false): void;
    37     /**
    38      * Gets the promise dependency the SDK will use wherever Promises are returned.
    39      */
    40     getPromisesDependency(): typeof Promise | void;
    41     /**
    42      * Sets the promise dependency the SDK will use wherever Promises are returned.
    43      * @param {function} dep - a reference to a Promise constructor
    44      */
    45     setPromisesDependency(dep: any): void;
    46 }
    47 
    48 export class Config extends ConfigBase {
    49     /**
    50      * Creates a new configuration object.
    51      * This is the object that passes option data along to service requests, including credentials, security, region information, and some service specific settings.
    52      */
    53     constructor(options?: ConfigurationOptions & ConfigurationServicePlaceholders & APIVersions);
    54     /**
    55      * Loads configuration data from a JSON file into this config object.
    56      * Loading configuration willr eset all existing configuration on the object.
    57      * This feature is not supported in the browser environment of the SDK.
    58      * 
    59      * @param {string} path - the path relative to your process's current working directory to load configuration from.
    60      */
    61     loadFromPath(path: string): Config & ConfigurationServicePlaceholders & APIVersions;
    62     /**
    63      * Updates the current configuration object with new options.
    64      * 
    65      * @param {ConfigurationOptions} options - a map of option keys and values.
    66      * @param {boolean} allowUnknownKeys - Whether unknown keys can be set on the configuration object.
    67      */
    68     update(options: ConfigurationOptions & ConfigurationServicePlaceholders & APIVersions & {[key: string]: any}, allowUnknownKeys: true): void;
    69     /**
    70      * Updates the current configuration object with new options.
    71      * 
    72      * @param {ConfigurationOptions} options - a map of option keys and values.
    73      * @param {boolean} allowUnknownKeys - Defaults to false. Whether unknown keys can be set on the configuration object.
    74      */
    75     update(options: ConfigurationOptions & ConfigurationServicePlaceholders & APIVersions, allowUnknownKeys?: false): void;
    76 }
    77 
    78 export type GlobalConfigInstance = Config & ConfigurationServicePlaceholders & APIVersions;
    79 
    80 export interface HTTPOptions {
    81     /**
    82      * the URL to proxy requests through.
    83      */
    84     proxy?: string
    85     /**
    86      * the Agent object to perform HTTP requests with.
    87      * Used for connection pooling.
    88      * Defaults to the global agent (http.globalAgent) for non-SSL connections.
    89      */
    90     agent?: httpAgent | httpsAgent
    91     /**
    92      * The number of milliseconds to wait before giving up on a connection attempt.
    93      * Defaults to two minutes (120000).
    94      */
    95     timeout?: number
    96     /**
    97      * Whether the SDK will send asynchronous HTTP requests.
    98      * Used in the browser environment only.
    99      * Set to false to send requests synchronously.
   100      * Defaults to true (async on).
   101      */
   102     xhrAsync?: boolean
   103     /**
   104      * Sets the 'withCredentials' property of an XMLHttpRequest object.
   105      * Used in the browser environment only.
   106      * Defaults to false.
   107      */
   108     xhrWithCredentials?: boolean
   109 }
   110 export interface Logger {
   111     write?: (chunk: any, encoding?: string, callback?: () => void) => void
   112     log?: (...messages: any[]) => void;
   113 }
   114 export interface ParamValidation {
   115     /**
   116      * Validates that a value meets the min constraint. 
   117      * This is enabled by default when paramValidation is set to true.
   118      */
   119     min?: boolean
   120     /**
   121      * Validates that a value meets the max constraint.
   122      */
   123     max?: boolean
   124     /**
   125      * Validates that a string value matches a regular expression.
   126      */
   127     pattern?: boolean
   128     /**
   129      * Validates that a string value matches one of the allowable enum values.
   130      */
   131     enum?: boolean
   132 }
   133 export interface RetryDelayOptions {
   134     /**
   135      * The base number of milliseconds to use in the exponential backoff for operation retries. 
   136      * Defaults to 100 ms.
   137      */
   138     base?: number
   139     /**
   140      * A custom function that accepts a retry count and returns the amount of time to delay in milliseconds. 
   141      * The base option will be ignored if this option is supplied.
   142      */
   143     customBackoff?: (retryCount: number) => number
   144 }
   145 
   146 export interface APIVersions {
   147     /**
   148      * A string in YYYY-MM-DD format that represents the latest possible API version that can be used in all services (unless overridden by apiVersions). Specify \'latest\' to use the latest possible version.
   149      */
   150     apiVersion?: "latest"|string;
   151     /**
   152      * A map of service identifiers (the lowercase service class name) with the API version to use when instantiating a service. Specify 'latest' for each individual that can use the latest available version.
   153      */
   154     apiVersions?: ConfigurationServiceApiVersions;
   155 }
   156 
   157 export abstract class ConfigurationOptions {
   158 
   159     /**
   160      * Whether to compute checksums for payload bodies when the service accepts it.
   161      * Currently supported in S3 only.
   162      */
   163     computeChecksums?: boolean
   164     /**
   165      * Whether types are converted when parsing response data.
   166      */
   167     convertResponseTypes?: boolean
   168     /**
   169      * Whether to apply a clock skew correction and retry requests that fail because of an skewed client clock.
   170      */
   171     correctClockSkew?: boolean
   172     /**
   173      * The AWS credentials to sign requests with.
   174      */
   175     credentials?: Credentials|CredentialsOptions
   176     /**
   177      * A set of options to pass to the low-level HTTP request.
   178      */
   179     httpOptions?: HTTPOptions
   180     /**
   181      * An object that responds to .write() (like a stream) or .log() (like the console object) in order to log information about requests.
   182      */
   183     logger?: Logger
   184     /**
   185      * The maximum amount of redirects to follow for a service request.
   186      */
   187     maxRedirects?: number
   188     /**
   189      * The maximum amount of retries to perform for a service request.
   190      */
   191     maxRetries?: number
   192     /**
   193      * Returns whether input parameters should be validated against the operation description before sending the request. 
   194      * Defaults to true. 
   195      * Pass a map to enable any of the following specific validation features: min|max|pattern|enum
   196      */
   197     paramValidation?: ParamValidation|boolean
   198     /**
   199      * The region to send service requests to.
   200      */
   201     region?: string
   202     /**
   203      * Returns A set of options to configure the retry delay on retryable errors.
   204      */
   205     retryDelayOptions?: RetryDelayOptions
   206     /**
   207      * Whether the provided endpoint addresses an individual bucket.
   208      * false if it addresses the root API endpoint.
   209      */
   210     s3BucketEndpoint?: boolean
   211     /**
   212      * Whether to disable S3 body signing when using signature version v4.
   213      */
   214     s3DisableBodySigning?: boolean
   215     /**
   216      * Whether to force path style URLs for S3 objects.
   217      */
   218     s3ForcePathStyle?: boolean
   219     /**
   220      * Whether the signature to sign requests with (overriding the API configuration) is cached.
   221      */
   222     signatureCache?: boolean
   223     /**
   224      * The signature version to sign requests with (overriding the API configuration).
   225      * Possible values: 'v2'|'v3'|'v4'
   226      */
   227     signatureVersion?: "v2"|"v3"|"v4"|string
   228     /**
   229      * Whether SSL is enabled for requests.
   230      */
   231     sslEnabled?: boolean
   232     /**
   233      * An offset value in milliseconds to apply to all signing times.
   234      */
   235     systemClockOffset?: number
   236     /**
   237      * Whether to use the Accelerate endpoint with the S3 service.
   238      */
   239     useAccelerateEndpoint?: boolean
   240 ```