forked from aws/aws-sdk-js-v3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppConfigClient.ts
430 lines (404 loc) · 16.3 KB
/
AppConfigClient.ts
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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
import { CreateApplicationCommandInput, CreateApplicationCommandOutput } from "./commands/CreateApplicationCommand";
import {
CreateConfigurationProfileCommandInput,
CreateConfigurationProfileCommandOutput,
} from "./commands/CreateConfigurationProfileCommand";
import {
CreateDeploymentStrategyCommandInput,
CreateDeploymentStrategyCommandOutput,
} from "./commands/CreateDeploymentStrategyCommand";
import { CreateEnvironmentCommandInput, CreateEnvironmentCommandOutput } from "./commands/CreateEnvironmentCommand";
import {
CreateHostedConfigurationVersionCommandInput,
CreateHostedConfigurationVersionCommandOutput,
} from "./commands/CreateHostedConfigurationVersionCommand";
import { DeleteApplicationCommandInput, DeleteApplicationCommandOutput } from "./commands/DeleteApplicationCommand";
import {
DeleteConfigurationProfileCommandInput,
DeleteConfigurationProfileCommandOutput,
} from "./commands/DeleteConfigurationProfileCommand";
import {
DeleteDeploymentStrategyCommandInput,
DeleteDeploymentStrategyCommandOutput,
} from "./commands/DeleteDeploymentStrategyCommand";
import { DeleteEnvironmentCommandInput, DeleteEnvironmentCommandOutput } from "./commands/DeleteEnvironmentCommand";
import {
DeleteHostedConfigurationVersionCommandInput,
DeleteHostedConfigurationVersionCommandOutput,
} from "./commands/DeleteHostedConfigurationVersionCommand";
import { GetApplicationCommandInput, GetApplicationCommandOutput } from "./commands/GetApplicationCommand";
import { GetConfigurationCommandInput, GetConfigurationCommandOutput } from "./commands/GetConfigurationCommand";
import {
GetConfigurationProfileCommandInput,
GetConfigurationProfileCommandOutput,
} from "./commands/GetConfigurationProfileCommand";
import { GetDeploymentCommandInput, GetDeploymentCommandOutput } from "./commands/GetDeploymentCommand";
import {
GetDeploymentStrategyCommandInput,
GetDeploymentStrategyCommandOutput,
} from "./commands/GetDeploymentStrategyCommand";
import { GetEnvironmentCommandInput, GetEnvironmentCommandOutput } from "./commands/GetEnvironmentCommand";
import {
GetHostedConfigurationVersionCommandInput,
GetHostedConfigurationVersionCommandOutput,
} from "./commands/GetHostedConfigurationVersionCommand";
import { ListApplicationsCommandInput, ListApplicationsCommandOutput } from "./commands/ListApplicationsCommand";
import {
ListConfigurationProfilesCommandInput,
ListConfigurationProfilesCommandOutput,
} from "./commands/ListConfigurationProfilesCommand";
import {
ListDeploymentStrategiesCommandInput,
ListDeploymentStrategiesCommandOutput,
} from "./commands/ListDeploymentStrategiesCommand";
import { ListDeploymentsCommandInput, ListDeploymentsCommandOutput } from "./commands/ListDeploymentsCommand";
import { ListEnvironmentsCommandInput, ListEnvironmentsCommandOutput } from "./commands/ListEnvironmentsCommand";
import {
ListHostedConfigurationVersionsCommandInput,
ListHostedConfigurationVersionsCommandOutput,
} from "./commands/ListHostedConfigurationVersionsCommand";
import {
ListTagsForResourceCommandInput,
ListTagsForResourceCommandOutput,
} from "./commands/ListTagsForResourceCommand";
import { StartDeploymentCommandInput, StartDeploymentCommandOutput } from "./commands/StartDeploymentCommand";
import { StopDeploymentCommandInput, StopDeploymentCommandOutput } from "./commands/StopDeploymentCommand";
import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand";
import { UpdateApplicationCommandInput, UpdateApplicationCommandOutput } from "./commands/UpdateApplicationCommand";
import {
UpdateConfigurationProfileCommandInput,
UpdateConfigurationProfileCommandOutput,
} from "./commands/UpdateConfigurationProfileCommand";
import {
UpdateDeploymentStrategyCommandInput,
UpdateDeploymentStrategyCommandOutput,
} from "./commands/UpdateDeploymentStrategyCommand";
import { UpdateEnvironmentCommandInput, UpdateEnvironmentCommandOutput } from "./commands/UpdateEnvironmentCommand";
import {
ValidateConfigurationCommandInput,
ValidateConfigurationCommandOutput,
} from "./commands/ValidateConfigurationCommand";
import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
import {
EndpointsInputConfig,
EndpointsResolvedConfig,
RegionInputConfig,
RegionResolvedConfig,
resolveEndpointsConfig,
resolveRegionConfig,
} from "@aws-sdk/config-resolver";
import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length";
import {
HostHeaderInputConfig,
HostHeaderResolvedConfig,
getHostHeaderPlugin,
resolveHostHeaderConfig,
} from "@aws-sdk/middleware-host-header";
import { getLoggerPlugin } from "@aws-sdk/middleware-logger";
import { RetryInputConfig, RetryResolvedConfig, getRetryPlugin, resolveRetryConfig } from "@aws-sdk/middleware-retry";
import {
AwsAuthInputConfig,
AwsAuthResolvedConfig,
getAwsAuthPlugin,
resolveAwsAuthConfig,
} from "@aws-sdk/middleware-signing";
import {
UserAgentInputConfig,
UserAgentResolvedConfig,
getUserAgentPlugin,
resolveUserAgentConfig,
} from "@aws-sdk/middleware-user-agent";
import { HttpHandler as __HttpHandler } from "@aws-sdk/protocol-http";
import {
Client as __Client,
SmithyConfiguration as __SmithyConfiguration,
SmithyResolvedConfiguration as __SmithyResolvedConfiguration,
} from "@aws-sdk/smithy-client";
import {
Provider,
RegionInfoProvider,
Credentials as __Credentials,
Decoder as __Decoder,
Encoder as __Encoder,
Hash as __Hash,
HashConstructor as __HashConstructor,
HttpHandlerOptions as __HttpHandlerOptions,
Logger as __Logger,
Provider as __Provider,
StreamCollector as __StreamCollector,
UrlParser as __UrlParser,
UserAgent as __UserAgent,
} from "@aws-sdk/types";
export type ServiceInputTypes =
| CreateApplicationCommandInput
| CreateConfigurationProfileCommandInput
| CreateDeploymentStrategyCommandInput
| CreateEnvironmentCommandInput
| CreateHostedConfigurationVersionCommandInput
| DeleteApplicationCommandInput
| DeleteConfigurationProfileCommandInput
| DeleteDeploymentStrategyCommandInput
| DeleteEnvironmentCommandInput
| DeleteHostedConfigurationVersionCommandInput
| GetApplicationCommandInput
| GetConfigurationCommandInput
| GetConfigurationProfileCommandInput
| GetDeploymentCommandInput
| GetDeploymentStrategyCommandInput
| GetEnvironmentCommandInput
| GetHostedConfigurationVersionCommandInput
| ListApplicationsCommandInput
| ListConfigurationProfilesCommandInput
| ListDeploymentStrategiesCommandInput
| ListDeploymentsCommandInput
| ListEnvironmentsCommandInput
| ListHostedConfigurationVersionsCommandInput
| ListTagsForResourceCommandInput
| StartDeploymentCommandInput
| StopDeploymentCommandInput
| TagResourceCommandInput
| UntagResourceCommandInput
| UpdateApplicationCommandInput
| UpdateConfigurationProfileCommandInput
| UpdateDeploymentStrategyCommandInput
| UpdateEnvironmentCommandInput
| ValidateConfigurationCommandInput;
export type ServiceOutputTypes =
| CreateApplicationCommandOutput
| CreateConfigurationProfileCommandOutput
| CreateDeploymentStrategyCommandOutput
| CreateEnvironmentCommandOutput
| CreateHostedConfigurationVersionCommandOutput
| DeleteApplicationCommandOutput
| DeleteConfigurationProfileCommandOutput
| DeleteDeploymentStrategyCommandOutput
| DeleteEnvironmentCommandOutput
| DeleteHostedConfigurationVersionCommandOutput
| GetApplicationCommandOutput
| GetConfigurationCommandOutput
| GetConfigurationProfileCommandOutput
| GetDeploymentCommandOutput
| GetDeploymentStrategyCommandOutput
| GetEnvironmentCommandOutput
| GetHostedConfigurationVersionCommandOutput
| ListApplicationsCommandOutput
| ListConfigurationProfilesCommandOutput
| ListDeploymentStrategiesCommandOutput
| ListDeploymentsCommandOutput
| ListEnvironmentsCommandOutput
| ListHostedConfigurationVersionsCommandOutput
| ListTagsForResourceCommandOutput
| StartDeploymentCommandOutput
| StopDeploymentCommandOutput
| TagResourceCommandOutput
| UntagResourceCommandOutput
| UpdateApplicationCommandOutput
| UpdateConfigurationProfileCommandOutput
| UpdateDeploymentStrategyCommandOutput
| UpdateEnvironmentCommandOutput
| ValidateConfigurationCommandOutput;
export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> {
/**
* The HTTP handler to use. Fetch in browser and Https in Nodejs.
*/
requestHandler?: __HttpHandler;
/**
* A constructor for a class implementing the {@link __Hash} interface
* that computes the SHA-256 HMAC or checksum of a string or binary buffer.
* @internal
*/
sha256?: __HashConstructor;
/**
* The function that will be used to convert strings into HTTP endpoints.
* @internal
*/
urlParser?: __UrlParser;
/**
* A function that can calculate the length of a request body.
* @internal
*/
bodyLengthChecker?: (body: any) => number | undefined;
/**
* A function that converts a stream into an array of bytes.
* @internal
*/
streamCollector?: __StreamCollector;
/**
* The function that will be used to convert a base64-encoded string to a byte array.
* @internal
*/
base64Decoder?: __Decoder;
/**
* The function that will be used to convert binary data to a base64-encoded string.
* @internal
*/
base64Encoder?: __Encoder;
/**
* The function that will be used to convert a UTF8-encoded string to a byte array.
* @internal
*/
utf8Decoder?: __Decoder;
/**
* The function that will be used to convert binary data to a UTF-8 encoded string.
* @internal
*/
utf8Encoder?: __Encoder;
/**
* The runtime environment.
* @internal
*/
runtime?: string;
/**
* Disable dyanamically changing the endpoint of the client based on the hostPrefix
* trait of an operation.
*/
disableHostPrefix?: boolean;
/**
* Value for how many times a request will be made at most in case of retry.
*/
maxAttempts?: number | __Provider<number>;
/**
* Specifies which retry algorithm to use.
*/
retryMode?: string | __Provider<string>;
/**
* Optional logger for logging debug/info/warn/error.
*/
logger?: __Logger;
/**
* Unique service identifier.
* @internal
*/
serviceId?: string;
/**
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;
/**
* Default credentials provider; Not available in browser runtime.
* @internal
*/
credentialDefaultProvider?: (input: any) => __Provider<__Credentials>;
/**
* Fetch related hostname, signing name or signing region with given region.
* @internal
*/
regionInfoProvider?: RegionInfoProvider;
/**
* The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header
* @internal
*/
defaultUserAgentProvider?: Provider<__UserAgent>;
}
type AppConfigClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> &
ClientDefaults &
RegionInputConfig &
EndpointsInputConfig &
RetryInputConfig &
HostHeaderInputConfig &
AwsAuthInputConfig &
UserAgentInputConfig;
/**
* The configuration interface of AppConfigClient class constructor that set the region, credentials and other options.
*/
export interface AppConfigClientConfig extends AppConfigClientConfigType {}
type AppConfigClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> &
Required<ClientDefaults> &
RegionResolvedConfig &
EndpointsResolvedConfig &
RetryResolvedConfig &
HostHeaderResolvedConfig &
AwsAuthResolvedConfig &
UserAgentResolvedConfig;
/**
* The resolved configuration interface of AppConfigClient class. This is resolved and normalized from the {@link AppConfigClientConfig | constructor configuration interface}.
*/
export interface AppConfigClientResolvedConfig extends AppConfigClientResolvedConfigType {}
/**
* <fullname>AWS AppConfig</fullname>
* <p>Use AWS AppConfig, a capability of AWS Systems Manager, to create, manage, and quickly deploy
* application configurations. AppConfig supports controlled deployments to applications of any
* size and includes built-in validation checks and monitoring. You can use AppConfig with
* applications hosted on Amazon EC2 instances, AWS Lambda, containers, mobile applications, or IoT
* devices.</p>
*
* <p>To prevent errors when deploying application configurations, especially for production
* systems where a simple typo could cause an unexpected outage, AppConfig includes validators.
* A validator provides a syntactic or semantic check to ensure that the configuration you
* want to deploy works as intended. To validate your application configuration data, you
* provide a schema or a Lambda function that runs against the configuration. The
* configuration deployment or update can only proceed when the configuration data is
* valid.</p>
*
* <p>During a configuration deployment, AppConfig monitors the application to ensure that the
* deployment is successful. If the system encounters an error, AppConfig rolls back the change
* to minimize impact for your application users. You can configure a deployment strategy for
* each application or environment that includes deployment criteria, including velocity, bake
* time, and alarms to monitor. Similar to error monitoring, if a deployment triggers an
* alarm, AppConfig automatically rolls back to the previous version. </p>
*
* <p>AppConfig supports multiple use cases. Here are some examples.</p>
* <ul>
* <li>
* <p>
* <b>Application tuning</b>: Use AppConfig to carefully
* introduce changes to your application that can only be tested with production
* traffic.</p>
* </li>
* <li>
* <p>
* <b>Feature toggle</b>: Use AppConfig to turn on new
* features that require a timely deployment, such as a product launch or announcement.
* </p>
* </li>
* <li>
* <p>
* <b>Allow list</b>: Use AppConfig to allow premium
* subscribers to access paid content. </p>
* </li>
* <li>
* <p>
* <b>Operational issues</b>: Use AppConfig to reduce stress
* on your application when a dependency or other external factor impacts the
* system.</p>
* </li>
* </ul>
* <p>This reference is intended to be used with the <a href="http://docs.aws.amazon.com/systems-manager/latest/userguide/appconfig.html">AWS AppConfig User Guide</a>.</p>
*/
export class AppConfigClient extends __Client<
__HttpHandlerOptions,
ServiceInputTypes,
ServiceOutputTypes,
AppConfigClientResolvedConfig
> {
/**
* The resolved configuration of AppConfigClient class. This is resolved and normalized from the {@link AppConfigClientConfig | constructor configuration interface}.
*/
readonly config: AppConfigClientResolvedConfig;
constructor(configuration: AppConfigClientConfig) {
let _config_0 = __getRuntimeConfig(configuration);
let _config_1 = resolveRegionConfig(_config_0);
let _config_2 = resolveEndpointsConfig(_config_1);
let _config_3 = resolveRetryConfig(_config_2);
let _config_4 = resolveHostHeaderConfig(_config_3);
let _config_5 = resolveAwsAuthConfig(_config_4);
let _config_6 = resolveUserAgentConfig(_config_5);
super(_config_6);
this.config = _config_6;
this.middlewareStack.use(getRetryPlugin(this.config));
this.middlewareStack.use(getContentLengthPlugin(this.config));
this.middlewareStack.use(getHostHeaderPlugin(this.config));
this.middlewareStack.use(getLoggerPlugin(this.config));
this.middlewareStack.use(getAwsAuthPlugin(this.config));
this.middlewareStack.use(getUserAgentPlugin(this.config));
}
/**
* Destroy underlying resources, like sockets. It's usually not necessary to do this.
* However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed.
* Otherwise, sockets might stay open for quite a long time before the server terminates them.
*/
destroy(): void {
super.destroy();
}
}