config.d.ts
11.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
import {Agent as httpAgent} from 'http';
import {Agent as httpsAgent} from 'https';
import {AWSError} from './error';
import {Credentials, CredentialsOptions} from './credentials';
import {CredentialProviderChain} from './credentials/credential_provider_chain';
import {ConfigurationServicePlaceholders, ConfigurationServiceApiVersions} from './config_service_placeholders';
export class ConfigBase extends ConfigurationOptions{
constructor(options?: ConfigurationOptions);
/**
* Loads credentials from the configuration object.
*/
getCredentials(callback: (err: AWSError) => void): void;
/**
* Loads configuration data from a JSON file into this config object.
* Loading configuration willr eset all existing configuration on the object.
* This feature is not supported in the browser environment of the SDK.
*
* @param {string} path - the path relative to your process's current working directory to load configuration from.
*/
loadFromPath(path: string): ConfigBase;
/**
* Updates the current configuration object with new options.
*
* @param {ConfigurationOptions} options - a map of option keys and values.
* @param {boolean} allowUnknownKeys - Whether unknown keys can be set on the configuration object.
*/
update(options: ConfigurationOptions & {[key: string]: any}, allowUnknownKeys: true): void;
/**
* Updates the current configuration object with new options.
*
* @param {ConfigurationOptions} options - a map of option keys and values.
* @param {boolean} allowUnknownKeys - Defaults to false. Whether unknown keys can be set on the configuration object.
*/
update(options: ConfigurationOptions, allowUnknownKeys?: false): void;
/**
* Gets the promise dependency the SDK will use wherever Promises are returned.
*/
getPromisesDependency(): typeof Promise | void;
/**
* Sets the promise dependency the SDK will use wherever Promises are returned.
* @param {function} dep - a reference to a Promise constructor
*/
setPromisesDependency(dep: any): void;
}
export class Config extends ConfigBase {
/**
* 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.
*/
constructor(options?: ConfigurationOptions & ConfigurationServicePlaceholders & APIVersions);
/**
* Loads configuration data from a JSON file into this config object.
* Loading configuration willr eset all existing configuration on the object.
* This feature is not supported in the browser environment of the SDK.
*
* @param {string} path - the path relative to your process's current working directory to load configuration from.
*/
loadFromPath(path: string): Config & ConfigurationServicePlaceholders & APIVersions;
/**
* Updates the current configuration object with new options.
*
* @param {ConfigurationOptions} options - a map of option keys and values.
* @param {boolean} allowUnknownKeys - Whether unknown keys can be set on the configuration object.
*/
update(options: ConfigurationOptions & ConfigurationServicePlaceholders & APIVersions & {[key: string]: any}, allowUnknownKeys: true): void;
/**
* Updates the current configuration object with new options.
*
* @param {ConfigurationOptions} options - a map of option keys and values.
* @param {boolean} allowUnknownKeys - Defaults to false. Whether unknown keys can be set on the configuration object.
*/
update(options: ConfigurationOptions & ConfigurationServicePlaceholders & APIVersions, allowUnknownKeys?: false): void;
}
export type GlobalConfigInstance = Config & ConfigurationServicePlaceholders & APIVersions;
export interface HTTPOptions {
/**
* the URL to proxy requests through.
*/
proxy?: string;
/**
* the Agent object to perform HTTP requests with.
* Used for connection pooling.
* Defaults to the global agent (http.globalAgent) for non-SSL connections.
*/
agent?: httpAgent | httpsAgent;
/**
* The maximum time in milliseconds that the connection phase of the request
* should be allowed to take. This only limits the connection phase and has
* no impact once the socket has established a connection.
* Used in node.js environments only.
*/
connectTimeout?: number;
/**
* The number of milliseconds to wait before giving up on a connection attempt.
* Defaults to two minutes (120000).
*/
timeout?: number;
/**
* 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).
*/
xhrAsync?: boolean;
/**
* Sets the 'withCredentials' property of an XMLHttpRequest object.
* Used in the browser environment only.
* Defaults to false.
*/
xhrWithCredentials?: boolean;
}
export interface Logger {
write?: (chunk: any, encoding?: string, callback?: () => void) => void
log?: (...messages: any[]) => void;
}
export interface ParamValidation {
/**
* Validates that a value meets the min constraint.
* This is enabled by default when paramValidation is set to true.
*/
min?: boolean
/**
* Validates that a value meets the max constraint.
*/
max?: boolean
/**
* Validates that a string value matches a regular expression.
*/
pattern?: boolean
/**
* Validates that a string value matches one of the allowable enum values.
*/
enum?: boolean
}
export interface RetryDelayOptions {
/**
* The base number of milliseconds to use in the exponential backoff for operation retries.
* Defaults to 100 ms.
*/
base?: number
/**
* 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.
*/
customBackoff?: (retryCount: number, err?: Error) => number
}
export interface APIVersions {
/**
* 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.
*/
apiVersion?: "latest"|string;
/**
* 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.
*/
apiVersions?: ConfigurationServiceApiVersions;
}
export abstract class ConfigurationOptions {
/**
* Whether to compute checksums for payload bodies when the service accepts it.
* Currently supported in S3 only.
*/
computeChecksums?: boolean
/**
* Whether types are converted when parsing response data.
*/
convertResponseTypes?: boolean
/**
* Whether to apply a clock skew correction and retry requests that fail because of an skewed client clock.
*/
correctClockSkew?: boolean
/**
* Sets a custom User-Agent string.
* In node environments this will set the User-Agent header, but
* browser environments this will set the X-Amz-User-Agent header.
*/
customUserAgent?: string
/**
* The AWS credentials to sign requests with.
*/
credentials?: Credentials|CredentialsOptions|null
/**
* The provider chain used to resolve credentials if no static credentials property is set.
*/
credentialProvider?: CredentialProviderChain
/**
* AWS access key ID.
*
* @deprecated
*/
accessKeyId?: string
/**
* AWS secret access key.
*
* @deprecated
*/
secretAccessKey?: string
/**
* AWS session token.
*
* @deprecated
*/
sessionToken?: string
/**
* A set of options to pass to the low-level HTTP request.
*/
httpOptions?: HTTPOptions
/**
* An object that responds to .write() (like a stream) or .log() (like the console object) in order to log information about requests.
*/
logger?: Logger
/**
* The maximum amount of redirects to follow for a service request.
*/
maxRedirects?: number
/**
* The maximum amount of retries to perform for a service request.
*/
maxRetries?: number
/**
* 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|max|pattern|enum
*/
paramValidation?: ParamValidation|boolean
/**
* The region to send service requests to.
*/
region?: string
/**
* Returns A set of options to configure the retry delay on retryable errors.
*/
retryDelayOptions?: RetryDelayOptions
/**
* Whether the provided endpoint addresses an individual bucket.
* false if it addresses the root API endpoint.
*/
s3BucketEndpoint?: boolean
/**
* Whether to disable S3 body signing when using signature version v4.
*/
s3DisableBodySigning?: boolean
/**
* Whether to force path style URLs for S3 objects.
*/
s3ForcePathStyle?: boolean
/**
* when region is set to 'us-east-1', whether to send s3 request to global endpoints
* or 'us-east-1' regional endpoints. This config is only applicable to S3 client;
* Defaults to 'legacy'
*/
s3UsEast1RegionalEndpoint?: "regional"|"legacy"
/**
* whether to override the request region with the region inferred
* from requested resource's ARN. Only available for S3 buckets
* Defaults to `true`
*/
s3UseArnRegion?: boolean
/**
* Whether the signature to sign requests with (overriding the API configuration) is cached.
*/
signatureCache?: boolean
/**
* The signature version to sign requests with (overriding the API configuration).
* Possible values: 'v2'|'v3'|'v4'
*/
signatureVersion?: "v2"|"v3"|"v4"|string
/**
* Whether SSL is enabled for requests.
*/
sslEnabled?: boolean
/**
* An offset value in milliseconds to apply to all signing times.
*/
systemClockOffset?: number
/**
* Whether to use the Accelerate endpoint with the S3 service.
*/
useAccelerateEndpoint?: boolean
/**
* Whether to validate the CRC32 checksum of HTTP response bodies returned
* by DynamoDB.
*/
dynamoDbCrc32?: boolean;
/**
* Whether to enable endpoint discovery for operations that allow optionally using an endpoint returned by
* the service.
*/
endpointDiscoveryEnabled?: boolean;
/**
* The size of the global cache storing endpoints from endpoint
* discovery operations. Once endpoint cache is created, updating this setting
* cannot change existing cache size.
*/
endpointCacheSize?: number;
/**
* whether to marshal request parameters to the prefix of hostname.
*/
hostPrefixEnabled?: boolean;
/**
* whether to send sts request to global endpoints or
* regional endpoints.
*/
stsRegionalEndpoints?: "legacy"|"regional";
}