@aws-sdk/client-controltower 3.312.0 → 3.316.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,67 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ControlTower = void 0;
4
+ const smithy_client_1 = require("@aws-sdk/smithy-client");
4
5
  const DisableControlCommand_1 = require("./commands/DisableControlCommand");
5
6
  const EnableControlCommand_1 = require("./commands/EnableControlCommand");
6
7
  const GetControlOperationCommand_1 = require("./commands/GetControlOperationCommand");
7
8
  const ListEnabledControlsCommand_1 = require("./commands/ListEnabledControlsCommand");
8
9
  const ControlTowerClient_1 = require("./ControlTowerClient");
10
+ const commands = {
11
+ DisableControlCommand: DisableControlCommand_1.DisableControlCommand,
12
+ EnableControlCommand: EnableControlCommand_1.EnableControlCommand,
13
+ GetControlOperationCommand: GetControlOperationCommand_1.GetControlOperationCommand,
14
+ ListEnabledControlsCommand: ListEnabledControlsCommand_1.ListEnabledControlsCommand,
15
+ };
9
16
  class ControlTower extends ControlTowerClient_1.ControlTowerClient {
10
- disableControl(args, optionsOrCb, cb) {
11
- const command = new DisableControlCommand_1.DisableControlCommand(args);
12
- if (typeof optionsOrCb === "function") {
13
- this.send(command, optionsOrCb);
14
- }
15
- else if (typeof cb === "function") {
16
- if (typeof optionsOrCb !== "object")
17
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
18
- this.send(command, optionsOrCb || {}, cb);
19
- }
20
- else {
21
- return this.send(command, optionsOrCb);
22
- }
23
- }
24
- enableControl(args, optionsOrCb, cb) {
25
- const command = new EnableControlCommand_1.EnableControlCommand(args);
26
- if (typeof optionsOrCb === "function") {
27
- this.send(command, optionsOrCb);
28
- }
29
- else if (typeof cb === "function") {
30
- if (typeof optionsOrCb !== "object")
31
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
32
- this.send(command, optionsOrCb || {}, cb);
33
- }
34
- else {
35
- return this.send(command, optionsOrCb);
36
- }
37
- }
38
- getControlOperation(args, optionsOrCb, cb) {
39
- const command = new GetControlOperationCommand_1.GetControlOperationCommand(args);
40
- if (typeof optionsOrCb === "function") {
41
- this.send(command, optionsOrCb);
42
- }
43
- else if (typeof cb === "function") {
44
- if (typeof optionsOrCb !== "object")
45
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
46
- this.send(command, optionsOrCb || {}, cb);
47
- }
48
- else {
49
- return this.send(command, optionsOrCb);
50
- }
51
- }
52
- listEnabledControls(args, optionsOrCb, cb) {
53
- const command = new ListEnabledControlsCommand_1.ListEnabledControlsCommand(args);
54
- if (typeof optionsOrCb === "function") {
55
- this.send(command, optionsOrCb);
56
- }
57
- else if (typeof cb === "function") {
58
- if (typeof optionsOrCb !== "object")
59
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
60
- this.send(command, optionsOrCb || {}, cb);
61
- }
62
- else {
63
- return this.send(command, optionsOrCb);
64
- }
65
- }
66
17
  }
67
18
  exports.ControlTower = ControlTower;
19
+ (0, smithy_client_1.createAggregatedClient)(commands, ControlTower);
@@ -12,10 +12,10 @@ const se_DisableControlCommand = async (input, context) => {
12
12
  };
13
13
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/disable-control";
14
14
  let body;
15
- body = JSON.stringify({
16
- ...(input.controlIdentifier != null && { controlIdentifier: input.controlIdentifier }),
17
- ...(input.targetIdentifier != null && { targetIdentifier: input.targetIdentifier }),
18
- });
15
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
16
+ controlIdentifier: [],
17
+ targetIdentifier: [],
18
+ }));
19
19
  return new protocol_http_1.HttpRequest({
20
20
  protocol,
21
21
  hostname,
@@ -34,10 +34,10 @@ const se_EnableControlCommand = async (input, context) => {
34
34
  };
35
35
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/enable-control";
36
36
  let body;
37
- body = JSON.stringify({
38
- ...(input.controlIdentifier != null && { controlIdentifier: input.controlIdentifier }),
39
- ...(input.targetIdentifier != null && { targetIdentifier: input.targetIdentifier }),
40
- });
37
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
38
+ controlIdentifier: [],
39
+ targetIdentifier: [],
40
+ }));
41
41
  return new protocol_http_1.HttpRequest({
42
42
  protocol,
43
43
  hostname,
@@ -56,9 +56,9 @@ const se_GetControlOperationCommand = async (input, context) => {
56
56
  };
57
57
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/get-control-operation";
58
58
  let body;
59
- body = JSON.stringify({
60
- ...(input.operationIdentifier != null && { operationIdentifier: input.operationIdentifier }),
61
- });
59
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
60
+ operationIdentifier: [],
61
+ }));
62
62
  return new protocol_http_1.HttpRequest({
63
63
  protocol,
64
64
  hostname,
@@ -77,11 +77,11 @@ const se_ListEnabledControlsCommand = async (input, context) => {
77
77
  };
78
78
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/list-enabled-controls";
79
79
  let body;
80
- body = JSON.stringify({
81
- ...(input.maxResults != null && { maxResults: input.maxResults }),
82
- ...(input.nextToken != null && { nextToken: input.nextToken }),
83
- ...(input.targetIdentifier != null && { targetIdentifier: input.targetIdentifier }),
84
- });
80
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
81
+ maxResults: [],
82
+ nextToken: [],
83
+ targetIdentifier: [],
84
+ }));
85
85
  return new protocol_http_1.HttpRequest({
86
86
  protocol,
87
87
  hostname,
@@ -97,13 +97,14 @@ const de_DisableControlCommand = async (output, context) => {
97
97
  if (output.statusCode !== 200 && output.statusCode >= 300) {
98
98
  return de_DisableControlCommandError(output, context);
99
99
  }
100
- const contents = map({
100
+ const contents = (0, smithy_client_1.map)({
101
101
  $metadata: deserializeMetadata(output),
102
102
  });
103
103
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
104
- if (data.operationIdentifier != null) {
105
- contents.operationIdentifier = (0, smithy_client_1.expectString)(data.operationIdentifier);
106
- }
104
+ const doc = (0, smithy_client_1.take)(data, {
105
+ operationIdentifier: smithy_client_1.expectString,
106
+ });
107
+ Object.assign(contents, doc);
107
108
  return contents;
108
109
  };
109
110
  exports.de_DisableControlCommand = de_DisableControlCommand;
@@ -137,10 +138,9 @@ const de_DisableControlCommandError = async (output, context) => {
137
138
  throw await de_ValidationExceptionRes(parsedOutput, context);
138
139
  default:
139
140
  const parsedBody = parsedOutput.body;
140
- (0, smithy_client_1.throwDefaultError)({
141
+ return throwDefaultError({
141
142
  output,
142
143
  parsedBody,
143
- exceptionCtor: ControlTowerServiceException_1.ControlTowerServiceException,
144
144
  errorCode,
145
145
  });
146
146
  }
@@ -149,13 +149,14 @@ const de_EnableControlCommand = async (output, context) => {
149
149
  if (output.statusCode !== 200 && output.statusCode >= 300) {
150
150
  return de_EnableControlCommandError(output, context);
151
151
  }
152
- const contents = map({
152
+ const contents = (0, smithy_client_1.map)({
153
153
  $metadata: deserializeMetadata(output),
154
154
  });
155
155
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
156
- if (data.operationIdentifier != null) {
157
- contents.operationIdentifier = (0, smithy_client_1.expectString)(data.operationIdentifier);
158
- }
156
+ const doc = (0, smithy_client_1.take)(data, {
157
+ operationIdentifier: smithy_client_1.expectString,
158
+ });
159
+ Object.assign(contents, doc);
159
160
  return contents;
160
161
  };
161
162
  exports.de_EnableControlCommand = de_EnableControlCommand;
@@ -189,10 +190,9 @@ const de_EnableControlCommandError = async (output, context) => {
189
190
  throw await de_ValidationExceptionRes(parsedOutput, context);
190
191
  default:
191
192
  const parsedBody = parsedOutput.body;
192
- (0, smithy_client_1.throwDefaultError)({
193
+ return throwDefaultError({
193
194
  output,
194
195
  parsedBody,
195
- exceptionCtor: ControlTowerServiceException_1.ControlTowerServiceException,
196
196
  errorCode,
197
197
  });
198
198
  }
@@ -201,13 +201,14 @@ const de_GetControlOperationCommand = async (output, context) => {
201
201
  if (output.statusCode !== 200 && output.statusCode >= 300) {
202
202
  return de_GetControlOperationCommandError(output, context);
203
203
  }
204
- const contents = map({
204
+ const contents = (0, smithy_client_1.map)({
205
205
  $metadata: deserializeMetadata(output),
206
206
  });
207
207
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
208
- if (data.controlOperation != null) {
209
- contents.controlOperation = de_ControlOperation(data.controlOperation, context);
210
- }
208
+ const doc = (0, smithy_client_1.take)(data, {
209
+ controlOperation: (_) => de_ControlOperation(_, context),
210
+ });
211
+ Object.assign(contents, doc);
211
212
  return contents;
212
213
  };
213
214
  exports.de_GetControlOperationCommand = de_GetControlOperationCommand;
@@ -235,10 +236,9 @@ const de_GetControlOperationCommandError = async (output, context) => {
235
236
  throw await de_ValidationExceptionRes(parsedOutput, context);
236
237
  default:
237
238
  const parsedBody = parsedOutput.body;
238
- (0, smithy_client_1.throwDefaultError)({
239
+ return throwDefaultError({
239
240
  output,
240
241
  parsedBody,
241
- exceptionCtor: ControlTowerServiceException_1.ControlTowerServiceException,
242
242
  errorCode,
243
243
  });
244
244
  }
@@ -247,16 +247,15 @@ const de_ListEnabledControlsCommand = async (output, context) => {
247
247
  if (output.statusCode !== 200 && output.statusCode >= 300) {
248
248
  return de_ListEnabledControlsCommandError(output, context);
249
249
  }
250
- const contents = map({
250
+ const contents = (0, smithy_client_1.map)({
251
251
  $metadata: deserializeMetadata(output),
252
252
  });
253
253
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
254
- if (data.enabledControls != null) {
255
- contents.enabledControls = de_EnabledControls(data.enabledControls, context);
256
- }
257
- if (data.nextToken != null) {
258
- contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
259
- }
254
+ const doc = (0, smithy_client_1.take)(data, {
255
+ enabledControls: smithy_client_1._json,
256
+ nextToken: smithy_client_1.expectString,
257
+ });
258
+ Object.assign(contents, doc);
260
259
  return contents;
261
260
  };
262
261
  exports.de_ListEnabledControlsCommand = de_ListEnabledControlsCommand;
@@ -284,21 +283,21 @@ const de_ListEnabledControlsCommandError = async (output, context) => {
284
283
  throw await de_ValidationExceptionRes(parsedOutput, context);
285
284
  default:
286
285
  const parsedBody = parsedOutput.body;
287
- (0, smithy_client_1.throwDefaultError)({
286
+ return throwDefaultError({
288
287
  output,
289
288
  parsedBody,
290
- exceptionCtor: ControlTowerServiceException_1.ControlTowerServiceException,
291
289
  errorCode,
292
290
  });
293
291
  }
294
292
  };
295
- const map = smithy_client_1.map;
293
+ const throwDefaultError = (0, smithy_client_1.withBaseException)(ControlTowerServiceException_1.ControlTowerServiceException);
296
294
  const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
297
- const contents = map({});
295
+ const contents = (0, smithy_client_1.map)({});
298
296
  const data = parsedOutput.body;
299
- if (data.message != null) {
300
- contents.message = (0, smithy_client_1.expectString)(data.message);
301
- }
297
+ const doc = (0, smithy_client_1.take)(data, {
298
+ message: smithy_client_1.expectString,
299
+ });
300
+ Object.assign(contents, doc);
302
301
  const exception = new models_0_1.AccessDeniedException({
303
302
  $metadata: deserializeMetadata(parsedOutput),
304
303
  ...contents,
@@ -306,11 +305,12 @@ const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
306
305
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
307
306
  };
308
307
  const de_ConflictExceptionRes = async (parsedOutput, context) => {
309
- const contents = map({});
308
+ const contents = (0, smithy_client_1.map)({});
310
309
  const data = parsedOutput.body;
311
- if (data.message != null) {
312
- contents.message = (0, smithy_client_1.expectString)(data.message);
313
- }
310
+ const doc = (0, smithy_client_1.take)(data, {
311
+ message: smithy_client_1.expectString,
312
+ });
313
+ Object.assign(contents, doc);
314
314
  const exception = new models_0_1.ConflictException({
315
315
  $metadata: deserializeMetadata(parsedOutput),
316
316
  ...contents,
@@ -318,11 +318,12 @@ const de_ConflictExceptionRes = async (parsedOutput, context) => {
318
318
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
319
319
  };
320
320
  const de_InternalServerExceptionRes = async (parsedOutput, context) => {
321
- const contents = map({});
321
+ const contents = (0, smithy_client_1.map)({});
322
322
  const data = parsedOutput.body;
323
- if (data.message != null) {
324
- contents.message = (0, smithy_client_1.expectString)(data.message);
325
- }
323
+ const doc = (0, smithy_client_1.take)(data, {
324
+ message: smithy_client_1.expectString,
325
+ });
326
+ Object.assign(contents, doc);
326
327
  const exception = new models_0_1.InternalServerException({
327
328
  $metadata: deserializeMetadata(parsedOutput),
328
329
  ...contents,
@@ -330,11 +331,12 @@ const de_InternalServerExceptionRes = async (parsedOutput, context) => {
330
331
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
331
332
  };
332
333
  const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
333
- const contents = map({});
334
+ const contents = (0, smithy_client_1.map)({});
334
335
  const data = parsedOutput.body;
335
- if (data.message != null) {
336
- contents.message = (0, smithy_client_1.expectString)(data.message);
337
- }
336
+ const doc = (0, smithy_client_1.take)(data, {
337
+ message: smithy_client_1.expectString,
338
+ });
339
+ Object.assign(contents, doc);
338
340
  const exception = new models_0_1.ResourceNotFoundException({
339
341
  $metadata: deserializeMetadata(parsedOutput),
340
342
  ...contents,
@@ -342,11 +344,12 @@ const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
342
344
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
343
345
  };
344
346
  const de_ServiceQuotaExceededExceptionRes = async (parsedOutput, context) => {
345
- const contents = map({});
347
+ const contents = (0, smithy_client_1.map)({});
346
348
  const data = parsedOutput.body;
347
- if (data.message != null) {
348
- contents.message = (0, smithy_client_1.expectString)(data.message);
349
- }
349
+ const doc = (0, smithy_client_1.take)(data, {
350
+ message: smithy_client_1.expectString,
351
+ });
352
+ Object.assign(contents, doc);
350
353
  const exception = new models_0_1.ServiceQuotaExceededException({
351
354
  $metadata: deserializeMetadata(parsedOutput),
352
355
  ...contents,
@@ -354,22 +357,19 @@ const de_ServiceQuotaExceededExceptionRes = async (parsedOutput, context) => {
354
357
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
355
358
  };
356
359
  const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
357
- const contents = map({
360
+ const contents = (0, smithy_client_1.map)({
358
361
  retryAfterSeconds: [
359
362
  () => void 0 !== parsedOutput.headers["retry-after"],
360
363
  () => (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]),
361
364
  ],
362
365
  });
363
366
  const data = parsedOutput.body;
364
- if (data.message != null) {
365
- contents.message = (0, smithy_client_1.expectString)(data.message);
366
- }
367
- if (data.quotaCode != null) {
368
- contents.quotaCode = (0, smithy_client_1.expectString)(data.quotaCode);
369
- }
370
- if (data.serviceCode != null) {
371
- contents.serviceCode = (0, smithy_client_1.expectString)(data.serviceCode);
372
- }
367
+ const doc = (0, smithy_client_1.take)(data, {
368
+ message: smithy_client_1.expectString,
369
+ quotaCode: smithy_client_1.expectString,
370
+ serviceCode: smithy_client_1.expectString,
371
+ });
372
+ Object.assign(contents, doc);
373
373
  const exception = new models_0_1.ThrottlingException({
374
374
  $metadata: deserializeMetadata(parsedOutput),
375
375
  ...contents,
@@ -377,11 +377,12 @@ const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
377
377
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
378
378
  };
379
379
  const de_ValidationExceptionRes = async (parsedOutput, context) => {
380
- const contents = map({});
380
+ const contents = (0, smithy_client_1.map)({});
381
381
  const data = parsedOutput.body;
382
- if (data.message != null) {
383
- contents.message = (0, smithy_client_1.expectString)(data.message);
384
- }
382
+ const doc = (0, smithy_client_1.take)(data, {
383
+ message: smithy_client_1.expectString,
384
+ });
385
+ Object.assign(contents, doc);
385
386
  const exception = new models_0_1.ValidationException({
386
387
  $metadata: deserializeMetadata(parsedOutput),
387
388
  ...contents,
@@ -389,29 +390,13 @@ const de_ValidationExceptionRes = async (parsedOutput, context) => {
389
390
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
390
391
  };
391
392
  const de_ControlOperation = (output, context) => {
392
- return {
393
- endTime: output.endTime != null ? (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTimeWithOffset)(output.endTime)) : undefined,
394
- operationType: (0, smithy_client_1.expectString)(output.operationType),
395
- startTime: output.startTime != null ? (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTimeWithOffset)(output.startTime)) : undefined,
396
- status: (0, smithy_client_1.expectString)(output.status),
397
- statusMessage: (0, smithy_client_1.expectString)(output.statusMessage),
398
- };
399
- };
400
- const de_EnabledControls = (output, context) => {
401
- const retVal = (output || [])
402
- .filter((e) => e != null)
403
- .map((entry) => {
404
- if (entry === null) {
405
- return null;
406
- }
407
- return de_EnabledControlSummary(entry, context);
393
+ return (0, smithy_client_1.take)(output, {
394
+ endTime: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTimeWithOffset)(_)),
395
+ operationType: smithy_client_1.expectString,
396
+ startTime: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTimeWithOffset)(_)),
397
+ status: smithy_client_1.expectString,
398
+ statusMessage: smithy_client_1.expectString,
408
399
  });
409
- return retVal;
410
- };
411
- const de_EnabledControlSummary = (output, context) => {
412
- return {
413
- controlIdentifier: (0, smithy_client_1.expectString)(output.controlIdentifier),
414
- };
415
400
  };
416
401
  const deserializeMetadata = (output) => ({
417
402
  httpStatusCode: output.statusCode,
@@ -1,63 +1,15 @@
1
+ import { createAggregatedClient } from "@aws-sdk/smithy-client";
1
2
  import { DisableControlCommand, } from "./commands/DisableControlCommand";
2
3
  import { EnableControlCommand, } from "./commands/EnableControlCommand";
3
4
  import { GetControlOperationCommand, } from "./commands/GetControlOperationCommand";
4
5
  import { ListEnabledControlsCommand, } from "./commands/ListEnabledControlsCommand";
5
6
  import { ControlTowerClient } from "./ControlTowerClient";
7
+ const commands = {
8
+ DisableControlCommand,
9
+ EnableControlCommand,
10
+ GetControlOperationCommand,
11
+ ListEnabledControlsCommand,
12
+ };
6
13
  export class ControlTower extends ControlTowerClient {
7
- disableControl(args, optionsOrCb, cb) {
8
- const command = new DisableControlCommand(args);
9
- if (typeof optionsOrCb === "function") {
10
- this.send(command, optionsOrCb);
11
- }
12
- else if (typeof cb === "function") {
13
- if (typeof optionsOrCb !== "object")
14
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
15
- this.send(command, optionsOrCb || {}, cb);
16
- }
17
- else {
18
- return this.send(command, optionsOrCb);
19
- }
20
- }
21
- enableControl(args, optionsOrCb, cb) {
22
- const command = new EnableControlCommand(args);
23
- if (typeof optionsOrCb === "function") {
24
- this.send(command, optionsOrCb);
25
- }
26
- else if (typeof cb === "function") {
27
- if (typeof optionsOrCb !== "object")
28
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
29
- this.send(command, optionsOrCb || {}, cb);
30
- }
31
- else {
32
- return this.send(command, optionsOrCb);
33
- }
34
- }
35
- getControlOperation(args, optionsOrCb, cb) {
36
- const command = new GetControlOperationCommand(args);
37
- if (typeof optionsOrCb === "function") {
38
- this.send(command, optionsOrCb);
39
- }
40
- else if (typeof cb === "function") {
41
- if (typeof optionsOrCb !== "object")
42
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
43
- this.send(command, optionsOrCb || {}, cb);
44
- }
45
- else {
46
- return this.send(command, optionsOrCb);
47
- }
48
- }
49
- listEnabledControls(args, optionsOrCb, cb) {
50
- const command = new ListEnabledControlsCommand(args);
51
- if (typeof optionsOrCb === "function") {
52
- this.send(command, optionsOrCb);
53
- }
54
- else if (typeof cb === "function") {
55
- if (typeof optionsOrCb !== "object")
56
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
57
- this.send(command, optionsOrCb || {}, cb);
58
- }
59
- else {
60
- return this.send(command, optionsOrCb);
61
- }
62
- }
63
14
  }
15
+ createAggregatedClient(commands, ControlTower);
@@ -1,5 +1,5 @@
1
1
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
- import { decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map as __map, parseRfc3339DateTimeWithOffset as __parseRfc3339DateTimeWithOffset, strictParseInt32 as __strictParseInt32, throwDefaultError, } from "@aws-sdk/smithy-client";
2
+ import { _json, decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map, parseRfc3339DateTimeWithOffset as __parseRfc3339DateTimeWithOffset, strictParseInt32 as __strictParseInt32, take, withBaseException, } from "@aws-sdk/smithy-client";
3
3
  import { ControlTowerServiceException as __BaseException } from "../models/ControlTowerServiceException";
4
4
  import { AccessDeniedException, ConflictException, InternalServerException, ResourceNotFoundException, ServiceQuotaExceededException, ThrottlingException, ValidationException, } from "../models/models_0";
5
5
  export const se_DisableControlCommand = async (input, context) => {
@@ -9,10 +9,10 @@ export const se_DisableControlCommand = async (input, context) => {
9
9
  };
10
10
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/disable-control";
11
11
  let body;
12
- body = JSON.stringify({
13
- ...(input.controlIdentifier != null && { controlIdentifier: input.controlIdentifier }),
14
- ...(input.targetIdentifier != null && { targetIdentifier: input.targetIdentifier }),
15
- });
12
+ body = JSON.stringify(take(input, {
13
+ controlIdentifier: [],
14
+ targetIdentifier: [],
15
+ }));
16
16
  return new __HttpRequest({
17
17
  protocol,
18
18
  hostname,
@@ -30,10 +30,10 @@ export const se_EnableControlCommand = async (input, context) => {
30
30
  };
31
31
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/enable-control";
32
32
  let body;
33
- body = JSON.stringify({
34
- ...(input.controlIdentifier != null && { controlIdentifier: input.controlIdentifier }),
35
- ...(input.targetIdentifier != null && { targetIdentifier: input.targetIdentifier }),
36
- });
33
+ body = JSON.stringify(take(input, {
34
+ controlIdentifier: [],
35
+ targetIdentifier: [],
36
+ }));
37
37
  return new __HttpRequest({
38
38
  protocol,
39
39
  hostname,
@@ -51,9 +51,9 @@ export const se_GetControlOperationCommand = async (input, context) => {
51
51
  };
52
52
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/get-control-operation";
53
53
  let body;
54
- body = JSON.stringify({
55
- ...(input.operationIdentifier != null && { operationIdentifier: input.operationIdentifier }),
56
- });
54
+ body = JSON.stringify(take(input, {
55
+ operationIdentifier: [],
56
+ }));
57
57
  return new __HttpRequest({
58
58
  protocol,
59
59
  hostname,
@@ -71,11 +71,11 @@ export const se_ListEnabledControlsCommand = async (input, context) => {
71
71
  };
72
72
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/list-enabled-controls";
73
73
  let body;
74
- body = JSON.stringify({
75
- ...(input.maxResults != null && { maxResults: input.maxResults }),
76
- ...(input.nextToken != null && { nextToken: input.nextToken }),
77
- ...(input.targetIdentifier != null && { targetIdentifier: input.targetIdentifier }),
78
- });
74
+ body = JSON.stringify(take(input, {
75
+ maxResults: [],
76
+ nextToken: [],
77
+ targetIdentifier: [],
78
+ }));
79
79
  return new __HttpRequest({
80
80
  protocol,
81
81
  hostname,
@@ -94,9 +94,10 @@ export const de_DisableControlCommand = async (output, context) => {
94
94
  $metadata: deserializeMetadata(output),
95
95
  });
96
96
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
97
- if (data.operationIdentifier != null) {
98
- contents.operationIdentifier = __expectString(data.operationIdentifier);
99
- }
97
+ const doc = take(data, {
98
+ operationIdentifier: __expectString,
99
+ });
100
+ Object.assign(contents, doc);
100
101
  return contents;
101
102
  };
102
103
  const de_DisableControlCommandError = async (output, context) => {
@@ -129,10 +130,9 @@ const de_DisableControlCommandError = async (output, context) => {
129
130
  throw await de_ValidationExceptionRes(parsedOutput, context);
130
131
  default:
131
132
  const parsedBody = parsedOutput.body;
132
- throwDefaultError({
133
+ return throwDefaultError({
133
134
  output,
134
135
  parsedBody,
135
- exceptionCtor: __BaseException,
136
136
  errorCode,
137
137
  });
138
138
  }
@@ -145,9 +145,10 @@ export const de_EnableControlCommand = async (output, context) => {
145
145
  $metadata: deserializeMetadata(output),
146
146
  });
147
147
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
148
- if (data.operationIdentifier != null) {
149
- contents.operationIdentifier = __expectString(data.operationIdentifier);
150
- }
148
+ const doc = take(data, {
149
+ operationIdentifier: __expectString,
150
+ });
151
+ Object.assign(contents, doc);
151
152
  return contents;
152
153
  };
153
154
  const de_EnableControlCommandError = async (output, context) => {
@@ -180,10 +181,9 @@ const de_EnableControlCommandError = async (output, context) => {
180
181
  throw await de_ValidationExceptionRes(parsedOutput, context);
181
182
  default:
182
183
  const parsedBody = parsedOutput.body;
183
- throwDefaultError({
184
+ return throwDefaultError({
184
185
  output,
185
186
  parsedBody,
186
- exceptionCtor: __BaseException,
187
187
  errorCode,
188
188
  });
189
189
  }
@@ -196,9 +196,10 @@ export const de_GetControlOperationCommand = async (output, context) => {
196
196
  $metadata: deserializeMetadata(output),
197
197
  });
198
198
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
199
- if (data.controlOperation != null) {
200
- contents.controlOperation = de_ControlOperation(data.controlOperation, context);
201
- }
199
+ const doc = take(data, {
200
+ controlOperation: (_) => de_ControlOperation(_, context),
201
+ });
202
+ Object.assign(contents, doc);
202
203
  return contents;
203
204
  };
204
205
  const de_GetControlOperationCommandError = async (output, context) => {
@@ -225,10 +226,9 @@ const de_GetControlOperationCommandError = async (output, context) => {
225
226
  throw await de_ValidationExceptionRes(parsedOutput, context);
226
227
  default:
227
228
  const parsedBody = parsedOutput.body;
228
- throwDefaultError({
229
+ return throwDefaultError({
229
230
  output,
230
231
  parsedBody,
231
- exceptionCtor: __BaseException,
232
232
  errorCode,
233
233
  });
234
234
  }
@@ -241,12 +241,11 @@ export const de_ListEnabledControlsCommand = async (output, context) => {
241
241
  $metadata: deserializeMetadata(output),
242
242
  });
243
243
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
244
- if (data.enabledControls != null) {
245
- contents.enabledControls = de_EnabledControls(data.enabledControls, context);
246
- }
247
- if (data.nextToken != null) {
248
- contents.nextToken = __expectString(data.nextToken);
249
- }
244
+ const doc = take(data, {
245
+ enabledControls: _json,
246
+ nextToken: __expectString,
247
+ });
248
+ Object.assign(contents, doc);
250
249
  return contents;
251
250
  };
252
251
  const de_ListEnabledControlsCommandError = async (output, context) => {
@@ -273,21 +272,21 @@ const de_ListEnabledControlsCommandError = async (output, context) => {
273
272
  throw await de_ValidationExceptionRes(parsedOutput, context);
274
273
  default:
275
274
  const parsedBody = parsedOutput.body;
276
- throwDefaultError({
275
+ return throwDefaultError({
277
276
  output,
278
277
  parsedBody,
279
- exceptionCtor: __BaseException,
280
278
  errorCode,
281
279
  });
282
280
  }
283
281
  };
284
- const map = __map;
282
+ const throwDefaultError = withBaseException(__BaseException);
285
283
  const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
286
284
  const contents = map({});
287
285
  const data = parsedOutput.body;
288
- if (data.message != null) {
289
- contents.message = __expectString(data.message);
290
- }
286
+ const doc = take(data, {
287
+ message: __expectString,
288
+ });
289
+ Object.assign(contents, doc);
291
290
  const exception = new AccessDeniedException({
292
291
  $metadata: deserializeMetadata(parsedOutput),
293
292
  ...contents,
@@ -297,9 +296,10 @@ const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
297
296
  const de_ConflictExceptionRes = async (parsedOutput, context) => {
298
297
  const contents = map({});
299
298
  const data = parsedOutput.body;
300
- if (data.message != null) {
301
- contents.message = __expectString(data.message);
302
- }
299
+ const doc = take(data, {
300
+ message: __expectString,
301
+ });
302
+ Object.assign(contents, doc);
303
303
  const exception = new ConflictException({
304
304
  $metadata: deserializeMetadata(parsedOutput),
305
305
  ...contents,
@@ -309,9 +309,10 @@ const de_ConflictExceptionRes = async (parsedOutput, context) => {
309
309
  const de_InternalServerExceptionRes = async (parsedOutput, context) => {
310
310
  const contents = map({});
311
311
  const data = parsedOutput.body;
312
- if (data.message != null) {
313
- contents.message = __expectString(data.message);
314
- }
312
+ const doc = take(data, {
313
+ message: __expectString,
314
+ });
315
+ Object.assign(contents, doc);
315
316
  const exception = new InternalServerException({
316
317
  $metadata: deserializeMetadata(parsedOutput),
317
318
  ...contents,
@@ -321,9 +322,10 @@ const de_InternalServerExceptionRes = async (parsedOutput, context) => {
321
322
  const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
322
323
  const contents = map({});
323
324
  const data = parsedOutput.body;
324
- if (data.message != null) {
325
- contents.message = __expectString(data.message);
326
- }
325
+ const doc = take(data, {
326
+ message: __expectString,
327
+ });
328
+ Object.assign(contents, doc);
327
329
  const exception = new ResourceNotFoundException({
328
330
  $metadata: deserializeMetadata(parsedOutput),
329
331
  ...contents,
@@ -333,9 +335,10 @@ const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
333
335
  const de_ServiceQuotaExceededExceptionRes = async (parsedOutput, context) => {
334
336
  const contents = map({});
335
337
  const data = parsedOutput.body;
336
- if (data.message != null) {
337
- contents.message = __expectString(data.message);
338
- }
338
+ const doc = take(data, {
339
+ message: __expectString,
340
+ });
341
+ Object.assign(contents, doc);
339
342
  const exception = new ServiceQuotaExceededException({
340
343
  $metadata: deserializeMetadata(parsedOutput),
341
344
  ...contents,
@@ -350,15 +353,12 @@ const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
350
353
  ],
351
354
  });
352
355
  const data = parsedOutput.body;
353
- if (data.message != null) {
354
- contents.message = __expectString(data.message);
355
- }
356
- if (data.quotaCode != null) {
357
- contents.quotaCode = __expectString(data.quotaCode);
358
- }
359
- if (data.serviceCode != null) {
360
- contents.serviceCode = __expectString(data.serviceCode);
361
- }
356
+ const doc = take(data, {
357
+ message: __expectString,
358
+ quotaCode: __expectString,
359
+ serviceCode: __expectString,
360
+ });
361
+ Object.assign(contents, doc);
362
362
  const exception = new ThrottlingException({
363
363
  $metadata: deserializeMetadata(parsedOutput),
364
364
  ...contents,
@@ -368,9 +368,10 @@ const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
368
368
  const de_ValidationExceptionRes = async (parsedOutput, context) => {
369
369
  const contents = map({});
370
370
  const data = parsedOutput.body;
371
- if (data.message != null) {
372
- contents.message = __expectString(data.message);
373
- }
371
+ const doc = take(data, {
372
+ message: __expectString,
373
+ });
374
+ Object.assign(contents, doc);
374
375
  const exception = new ValidationException({
375
376
  $metadata: deserializeMetadata(parsedOutput),
376
377
  ...contents,
@@ -378,29 +379,13 @@ const de_ValidationExceptionRes = async (parsedOutput, context) => {
378
379
  return __decorateServiceException(exception, parsedOutput.body);
379
380
  };
380
381
  const de_ControlOperation = (output, context) => {
381
- return {
382
- endTime: output.endTime != null ? __expectNonNull(__parseRfc3339DateTimeWithOffset(output.endTime)) : undefined,
383
- operationType: __expectString(output.operationType),
384
- startTime: output.startTime != null ? __expectNonNull(__parseRfc3339DateTimeWithOffset(output.startTime)) : undefined,
385
- status: __expectString(output.status),
386
- statusMessage: __expectString(output.statusMessage),
387
- };
388
- };
389
- const de_EnabledControls = (output, context) => {
390
- const retVal = (output || [])
391
- .filter((e) => e != null)
392
- .map((entry) => {
393
- if (entry === null) {
394
- return null;
395
- }
396
- return de_EnabledControlSummary(entry, context);
382
+ return take(output, {
383
+ endTime: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
384
+ operationType: __expectString,
385
+ startTime: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
386
+ status: __expectString,
387
+ statusMessage: __expectString,
397
388
  });
398
- return retVal;
399
- };
400
- const de_EnabledControlSummary = (output, context) => {
401
- return {
402
- controlIdentifier: __expectString(output.controlIdentifier),
403
- };
404
389
  };
405
390
  const deserializeMetadata = (output) => ({
406
391
  httpStatusCode: output.statusCode,
@@ -4,6 +4,32 @@ import { EnableControlCommandInput, EnableControlCommandOutput } from "./command
4
4
  import { GetControlOperationCommandInput, GetControlOperationCommandOutput } from "./commands/GetControlOperationCommand";
5
5
  import { ListEnabledControlsCommandInput, ListEnabledControlsCommandOutput } from "./commands/ListEnabledControlsCommand";
6
6
  import { ControlTowerClient } from "./ControlTowerClient";
7
+ export interface ControlTower {
8
+ /**
9
+ * @see {@link DisableControlCommand}
10
+ */
11
+ disableControl(args: DisableControlCommandInput, options?: __HttpHandlerOptions): Promise<DisableControlCommandOutput>;
12
+ disableControl(args: DisableControlCommandInput, cb: (err: any, data?: DisableControlCommandOutput) => void): void;
13
+ disableControl(args: DisableControlCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: DisableControlCommandOutput) => void): void;
14
+ /**
15
+ * @see {@link EnableControlCommand}
16
+ */
17
+ enableControl(args: EnableControlCommandInput, options?: __HttpHandlerOptions): Promise<EnableControlCommandOutput>;
18
+ enableControl(args: EnableControlCommandInput, cb: (err: any, data?: EnableControlCommandOutput) => void): void;
19
+ enableControl(args: EnableControlCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: EnableControlCommandOutput) => void): void;
20
+ /**
21
+ * @see {@link GetControlOperationCommand}
22
+ */
23
+ getControlOperation(args: GetControlOperationCommandInput, options?: __HttpHandlerOptions): Promise<GetControlOperationCommandOutput>;
24
+ getControlOperation(args: GetControlOperationCommandInput, cb: (err: any, data?: GetControlOperationCommandOutput) => void): void;
25
+ getControlOperation(args: GetControlOperationCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: GetControlOperationCommandOutput) => void): void;
26
+ /**
27
+ * @see {@link ListEnabledControlsCommand}
28
+ */
29
+ listEnabledControls(args: ListEnabledControlsCommandInput, options?: __HttpHandlerOptions): Promise<ListEnabledControlsCommandOutput>;
30
+ listEnabledControls(args: ListEnabledControlsCommandInput, cb: (err: any, data?: ListEnabledControlsCommandOutput) => void): void;
31
+ listEnabledControls(args: ListEnabledControlsCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: ListEnabledControlsCommandOutput) => void): void;
32
+ }
7
33
  /**
8
34
  * @public
9
35
  * <p>These interfaces allow you to apply the AWS library of pre-defined <i>controls</i> to your
@@ -78,40 +104,5 @@ import { ControlTowerClient } from "./ControlTowerClient";
78
104
  * </p>
79
105
  * <p>AWS Control Tower supports AWS CloudTrail, a service that records AWS API calls for your AWS account and delivers log files to an Amazon S3 bucket. By using information collected by CloudTrail, you can determine which requests the AWS Control Tower service received, who made the request and when, and so on. For more about AWS Control Tower and its support for CloudTrail, see <a href="https://docs.aws.amazon.com/controltower/latest/userguide/logging-using-cloudtrail.html">Logging AWS Control Tower Actions with AWS CloudTrail</a> in the AWS Control Tower User Guide. To learn more about CloudTrail, including how to turn it on and find your log files, see the AWS CloudTrail User Guide.</p>
80
106
  */
81
- export declare class ControlTower extends ControlTowerClient {
82
- /**
83
- * @public
84
- * <p>This API call turns off a control. It starts an asynchronous operation that deletes AWS resources on the specified
85
- * organizational unit and the accounts it contains. The resources will vary according to the
86
- * control that you specify.</p>
87
- */
88
- disableControl(args: DisableControlCommandInput, options?: __HttpHandlerOptions): Promise<DisableControlCommandOutput>;
89
- disableControl(args: DisableControlCommandInput, cb: (err: any, data?: DisableControlCommandOutput) => void): void;
90
- disableControl(args: DisableControlCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: DisableControlCommandOutput) => void): void;
91
- /**
92
- * @public
93
- * <p>This API call activates a control. It starts an asynchronous operation that creates AWS resources on the specified
94
- * organizational unit and the accounts it contains. The resources created will vary according to
95
- * the control that you specify.</p>
96
- */
97
- enableControl(args: EnableControlCommandInput, options?: __HttpHandlerOptions): Promise<EnableControlCommandOutput>;
98
- enableControl(args: EnableControlCommandInput, cb: (err: any, data?: EnableControlCommandOutput) => void): void;
99
- enableControl(args: EnableControlCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: EnableControlCommandOutput) => void): void;
100
- /**
101
- * @public
102
- * <p>Returns the status of a particular <code>EnableControl</code> or
103
- * <code>DisableControl</code> operation. Displays a message in case of error.
104
- * Details for an operation are available for 90 days.</p>
105
- */
106
- getControlOperation(args: GetControlOperationCommandInput, options?: __HttpHandlerOptions): Promise<GetControlOperationCommandOutput>;
107
- getControlOperation(args: GetControlOperationCommandInput, cb: (err: any, data?: GetControlOperationCommandOutput) => void): void;
108
- getControlOperation(args: GetControlOperationCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: GetControlOperationCommandOutput) => void): void;
109
- /**
110
- * @public
111
- * <p>Lists the controls enabled by AWS Control Tower on the specified organizational unit and
112
- * the accounts it contains.</p>
113
- */
114
- listEnabledControls(args: ListEnabledControlsCommandInput, options?: __HttpHandlerOptions): Promise<ListEnabledControlsCommandOutput>;
115
- listEnabledControls(args: ListEnabledControlsCommandInput, cb: (err: any, data?: ListEnabledControlsCommandOutput) => void): void;
116
- listEnabledControls(args: ListEnabledControlsCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: ListEnabledControlsCommandOutput) => void): void;
107
+ export declare class ControlTower extends ControlTowerClient implements ControlTower {
117
108
  }
@@ -16,7 +16,7 @@ import {
16
16
  ListEnabledControlsCommandOutput,
17
17
  } from "./commands/ListEnabledControlsCommand";
18
18
  import { ControlTowerClient } from "./ControlTowerClient";
19
- export declare class ControlTower extends ControlTowerClient {
19
+ export interface ControlTower {
20
20
  disableControl(
21
21
  args: DisableControlCommandInput,
22
22
  options?: __HttpHandlerOptions
@@ -70,3 +70,6 @@ export declare class ControlTower extends ControlTowerClient {
70
70
  cb: (err: any, data?: ListEnabledControlsCommandOutput) => void
71
71
  ): void;
72
72
  }
73
+ export declare class ControlTower
74
+ extends ControlTowerClient
75
+ implements ControlTower {}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-controltower",
3
3
  "description": "AWS SDK for JavaScript Controltower Client for Node.js, Browser and React Native",
4
- "version": "3.312.0",
4
+ "version": "3.316.0",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -21,9 +21,9 @@
21
21
  "dependencies": {
22
22
  "@aws-crypto/sha256-browser": "3.0.0",
23
23
  "@aws-crypto/sha256-js": "3.0.0",
24
- "@aws-sdk/client-sts": "3.312.0",
24
+ "@aws-sdk/client-sts": "3.316.0",
25
25
  "@aws-sdk/config-resolver": "3.310.0",
26
- "@aws-sdk/credential-provider-node": "3.310.0",
26
+ "@aws-sdk/credential-provider-node": "3.316.0",
27
27
  "@aws-sdk/fetch-http-handler": "3.310.0",
28
28
  "@aws-sdk/hash-node": "3.310.0",
29
29
  "@aws-sdk/invalid-dependency": "3.310.0",
@@ -40,14 +40,14 @@
40
40
  "@aws-sdk/node-config-provider": "3.310.0",
41
41
  "@aws-sdk/node-http-handler": "3.310.0",
42
42
  "@aws-sdk/protocol-http": "3.310.0",
43
- "@aws-sdk/smithy-client": "3.310.0",
43
+ "@aws-sdk/smithy-client": "3.316.0",
44
44
  "@aws-sdk/types": "3.310.0",
45
45
  "@aws-sdk/url-parser": "3.310.0",
46
46
  "@aws-sdk/util-base64": "3.310.0",
47
47
  "@aws-sdk/util-body-length-browser": "3.310.0",
48
48
  "@aws-sdk/util-body-length-node": "3.310.0",
49
- "@aws-sdk/util-defaults-mode-browser": "3.310.0",
50
- "@aws-sdk/util-defaults-mode-node": "3.310.0",
49
+ "@aws-sdk/util-defaults-mode-browser": "3.316.0",
50
+ "@aws-sdk/util-defaults-mode-node": "3.316.0",
51
51
  "@aws-sdk/util-endpoints": "3.310.0",
52
52
  "@aws-sdk/util-retry": "3.310.0",
53
53
  "@aws-sdk/util-user-agent-browser": "3.310.0",