@aws-sdk/client-cloudtrail-data 3.312.0 → 3.315.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.
@@ -11,14 +11,14 @@ const se_PutAuditEventsCommand = async (input, context) => {
11
11
  "content-type": "application/json",
12
12
  };
13
13
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/PutAuditEvents";
14
- const query = map({
14
+ const query = (0, smithy_client_1.map)({
15
15
  channelArn: [, (0, smithy_client_1.expectNonNull)(input.channelArn, `channelArn`)],
16
16
  externalId: [, input.externalId],
17
17
  });
18
18
  let body;
19
- body = JSON.stringify({
20
- ...(input.auditEvents != null && { auditEvents: se_AuditEvents(input.auditEvents, context) }),
21
- });
19
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
20
+ auditEvents: (_) => (0, smithy_client_1._json)(_),
21
+ }));
22
22
  return new protocol_http_1.HttpRequest({
23
23
  protocol,
24
24
  hostname,
@@ -35,16 +35,15 @@ const de_PutAuditEventsCommand = async (output, context) => {
35
35
  if (output.statusCode !== 200 && output.statusCode >= 300) {
36
36
  return de_PutAuditEventsCommandError(output, context);
37
37
  }
38
- const contents = map({
38
+ const contents = (0, smithy_client_1.map)({
39
39
  $metadata: deserializeMetadata(output),
40
40
  });
41
41
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
42
- if (data.failed != null) {
43
- contents.failed = de_ResultErrorEntries(data.failed, context);
44
- }
45
- if (data.successful != null) {
46
- contents.successful = de_AuditEventResultEntries(data.successful, context);
47
- }
42
+ const doc = (0, smithy_client_1.take)(data, {
43
+ failed: smithy_client_1._json,
44
+ successful: smithy_client_1._json,
45
+ });
46
+ Object.assign(contents, doc);
48
47
  return contents;
49
48
  };
50
49
  exports.de_PutAuditEventsCommand = de_PutAuditEventsCommand;
@@ -75,21 +74,21 @@ const de_PutAuditEventsCommandError = async (output, context) => {
75
74
  throw await de_UnsupportedOperationExceptionRes(parsedOutput, context);
76
75
  default:
77
76
  const parsedBody = parsedOutput.body;
78
- (0, smithy_client_1.throwDefaultError)({
77
+ return throwDefaultError({
79
78
  output,
80
79
  parsedBody,
81
- exceptionCtor: CloudTrailDataServiceException_1.CloudTrailDataServiceException,
82
80
  errorCode,
83
81
  });
84
82
  }
85
83
  };
86
- const map = smithy_client_1.map;
84
+ const throwDefaultError = (0, smithy_client_1.withBaseException)(CloudTrailDataServiceException_1.CloudTrailDataServiceException);
87
85
  const de_ChannelInsufficientPermissionRes = async (parsedOutput, context) => {
88
- const contents = map({});
86
+ const contents = (0, smithy_client_1.map)({});
89
87
  const data = parsedOutput.body;
90
- if (data.message != null) {
91
- contents.message = (0, smithy_client_1.expectString)(data.message);
92
- }
88
+ const doc = (0, smithy_client_1.take)(data, {
89
+ message: smithy_client_1.expectString,
90
+ });
91
+ Object.assign(contents, doc);
93
92
  const exception = new models_0_1.ChannelInsufficientPermission({
94
93
  $metadata: deserializeMetadata(parsedOutput),
95
94
  ...contents,
@@ -97,11 +96,12 @@ const de_ChannelInsufficientPermissionRes = async (parsedOutput, context) => {
97
96
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
98
97
  };
99
98
  const de_ChannelNotFoundRes = async (parsedOutput, context) => {
100
- const contents = map({});
99
+ const contents = (0, smithy_client_1.map)({});
101
100
  const data = parsedOutput.body;
102
- if (data.message != null) {
103
- contents.message = (0, smithy_client_1.expectString)(data.message);
104
- }
101
+ const doc = (0, smithy_client_1.take)(data, {
102
+ message: smithy_client_1.expectString,
103
+ });
104
+ Object.assign(contents, doc);
105
105
  const exception = new models_0_1.ChannelNotFound({
106
106
  $metadata: deserializeMetadata(parsedOutput),
107
107
  ...contents,
@@ -109,11 +109,12 @@ const de_ChannelNotFoundRes = async (parsedOutput, context) => {
109
109
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
110
110
  };
111
111
  const de_ChannelUnsupportedSchemaRes = async (parsedOutput, context) => {
112
- const contents = map({});
112
+ const contents = (0, smithy_client_1.map)({});
113
113
  const data = parsedOutput.body;
114
- if (data.message != null) {
115
- contents.message = (0, smithy_client_1.expectString)(data.message);
116
- }
114
+ const doc = (0, smithy_client_1.take)(data, {
115
+ message: smithy_client_1.expectString,
116
+ });
117
+ Object.assign(contents, doc);
117
118
  const exception = new models_0_1.ChannelUnsupportedSchema({
118
119
  $metadata: deserializeMetadata(parsedOutput),
119
120
  ...contents,
@@ -121,11 +122,12 @@ const de_ChannelUnsupportedSchemaRes = async (parsedOutput, context) => {
121
122
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
122
123
  };
123
124
  const de_DuplicatedAuditEventIdRes = async (parsedOutput, context) => {
124
- const contents = map({});
125
+ const contents = (0, smithy_client_1.map)({});
125
126
  const data = parsedOutput.body;
126
- if (data.message != null) {
127
- contents.message = (0, smithy_client_1.expectString)(data.message);
128
- }
127
+ const doc = (0, smithy_client_1.take)(data, {
128
+ message: smithy_client_1.expectString,
129
+ });
130
+ Object.assign(contents, doc);
129
131
  const exception = new models_0_1.DuplicatedAuditEventId({
130
132
  $metadata: deserializeMetadata(parsedOutput),
131
133
  ...contents,
@@ -133,11 +135,12 @@ const de_DuplicatedAuditEventIdRes = async (parsedOutput, context) => {
133
135
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
134
136
  };
135
137
  const de_InvalidChannelARNRes = async (parsedOutput, context) => {
136
- const contents = map({});
138
+ const contents = (0, smithy_client_1.map)({});
137
139
  const data = parsedOutput.body;
138
- if (data.message != null) {
139
- contents.message = (0, smithy_client_1.expectString)(data.message);
140
- }
140
+ const doc = (0, smithy_client_1.take)(data, {
141
+ message: smithy_client_1.expectString,
142
+ });
143
+ Object.assign(contents, doc);
141
144
  const exception = new models_0_1.InvalidChannelARN({
142
145
  $metadata: deserializeMetadata(parsedOutput),
143
146
  ...contents,
@@ -145,66 +148,18 @@ const de_InvalidChannelARNRes = async (parsedOutput, context) => {
145
148
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
146
149
  };
147
150
  const de_UnsupportedOperationExceptionRes = async (parsedOutput, context) => {
148
- const contents = map({});
151
+ const contents = (0, smithy_client_1.map)({});
149
152
  const data = parsedOutput.body;
150
- if (data.message != null) {
151
- contents.message = (0, smithy_client_1.expectString)(data.message);
152
- }
153
+ const doc = (0, smithy_client_1.take)(data, {
154
+ message: smithy_client_1.expectString,
155
+ });
156
+ Object.assign(contents, doc);
153
157
  const exception = new models_0_1.UnsupportedOperationException({
154
158
  $metadata: deserializeMetadata(parsedOutput),
155
159
  ...contents,
156
160
  });
157
161
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
158
162
  };
159
- const se_AuditEvent = (input, context) => {
160
- return {
161
- ...(input.eventData != null && { eventData: input.eventData }),
162
- ...(input.eventDataChecksum != null && { eventDataChecksum: input.eventDataChecksum }),
163
- ...(input.id != null && { id: input.id }),
164
- };
165
- };
166
- const se_AuditEvents = (input, context) => {
167
- return input
168
- .filter((e) => e != null)
169
- .map((entry) => {
170
- return se_AuditEvent(entry, context);
171
- });
172
- };
173
- const de_AuditEventResultEntries = (output, context) => {
174
- const retVal = (output || [])
175
- .filter((e) => e != null)
176
- .map((entry) => {
177
- if (entry === null) {
178
- return null;
179
- }
180
- return de_AuditEventResultEntry(entry, context);
181
- });
182
- return retVal;
183
- };
184
- const de_AuditEventResultEntry = (output, context) => {
185
- return {
186
- eventID: (0, smithy_client_1.expectString)(output.eventID),
187
- id: (0, smithy_client_1.expectString)(output.id),
188
- };
189
- };
190
- const de_ResultErrorEntries = (output, context) => {
191
- const retVal = (output || [])
192
- .filter((e) => e != null)
193
- .map((entry) => {
194
- if (entry === null) {
195
- return null;
196
- }
197
- return de_ResultErrorEntry(entry, context);
198
- });
199
- return retVal;
200
- };
201
- const de_ResultErrorEntry = (output, context) => {
202
- return {
203
- errorCode: (0, smithy_client_1.expectString)(output.errorCode),
204
- errorMessage: (0, smithy_client_1.expectString)(output.errorMessage),
205
- id: (0, smithy_client_1.expectString)(output.id),
206
- };
207
- };
208
163
  const deserializeMetadata = (output) => ({
209
164
  httpStatusCode: output.statusCode,
210
165
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
@@ -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, throwDefaultError, } from "@aws-sdk/smithy-client";
2
+ import { _json, decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map, take, withBaseException, } from "@aws-sdk/smithy-client";
3
3
  import { CloudTrailDataServiceException as __BaseException } from "../models/CloudTrailDataServiceException";
4
4
  import { ChannelInsufficientPermission, ChannelNotFound, ChannelUnsupportedSchema, DuplicatedAuditEventId, InvalidChannelARN, UnsupportedOperationException, } from "../models/models_0";
5
5
  export const se_PutAuditEventsCommand = async (input, context) => {
@@ -13,9 +13,9 @@ export const se_PutAuditEventsCommand = async (input, context) => {
13
13
  externalId: [, input.externalId],
14
14
  });
15
15
  let body;
16
- body = JSON.stringify({
17
- ...(input.auditEvents != null && { auditEvents: se_AuditEvents(input.auditEvents, context) }),
18
- });
16
+ body = JSON.stringify(take(input, {
17
+ auditEvents: (_) => _json(_),
18
+ }));
19
19
  return new __HttpRequest({
20
20
  protocol,
21
21
  hostname,
@@ -35,12 +35,11 @@ export const de_PutAuditEventsCommand = async (output, context) => {
35
35
  $metadata: deserializeMetadata(output),
36
36
  });
37
37
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
38
- if (data.failed != null) {
39
- contents.failed = de_ResultErrorEntries(data.failed, context);
40
- }
41
- if (data.successful != null) {
42
- contents.successful = de_AuditEventResultEntries(data.successful, context);
43
- }
38
+ const doc = take(data, {
39
+ failed: _json,
40
+ successful: _json,
41
+ });
42
+ Object.assign(contents, doc);
44
43
  return contents;
45
44
  };
46
45
  const de_PutAuditEventsCommandError = async (output, context) => {
@@ -70,21 +69,21 @@ const de_PutAuditEventsCommandError = async (output, context) => {
70
69
  throw await de_UnsupportedOperationExceptionRes(parsedOutput, context);
71
70
  default:
72
71
  const parsedBody = parsedOutput.body;
73
- throwDefaultError({
72
+ return throwDefaultError({
74
73
  output,
75
74
  parsedBody,
76
- exceptionCtor: __BaseException,
77
75
  errorCode,
78
76
  });
79
77
  }
80
78
  };
81
- const map = __map;
79
+ const throwDefaultError = withBaseException(__BaseException);
82
80
  const de_ChannelInsufficientPermissionRes = async (parsedOutput, context) => {
83
81
  const contents = map({});
84
82
  const data = parsedOutput.body;
85
- if (data.message != null) {
86
- contents.message = __expectString(data.message);
87
- }
83
+ const doc = take(data, {
84
+ message: __expectString,
85
+ });
86
+ Object.assign(contents, doc);
88
87
  const exception = new ChannelInsufficientPermission({
89
88
  $metadata: deserializeMetadata(parsedOutput),
90
89
  ...contents,
@@ -94,9 +93,10 @@ const de_ChannelInsufficientPermissionRes = async (parsedOutput, context) => {
94
93
  const de_ChannelNotFoundRes = async (parsedOutput, context) => {
95
94
  const contents = map({});
96
95
  const data = parsedOutput.body;
97
- if (data.message != null) {
98
- contents.message = __expectString(data.message);
99
- }
96
+ const doc = take(data, {
97
+ message: __expectString,
98
+ });
99
+ Object.assign(contents, doc);
100
100
  const exception = new ChannelNotFound({
101
101
  $metadata: deserializeMetadata(parsedOutput),
102
102
  ...contents,
@@ -106,9 +106,10 @@ const de_ChannelNotFoundRes = async (parsedOutput, context) => {
106
106
  const de_ChannelUnsupportedSchemaRes = async (parsedOutput, context) => {
107
107
  const contents = map({});
108
108
  const data = parsedOutput.body;
109
- if (data.message != null) {
110
- contents.message = __expectString(data.message);
111
- }
109
+ const doc = take(data, {
110
+ message: __expectString,
111
+ });
112
+ Object.assign(contents, doc);
112
113
  const exception = new ChannelUnsupportedSchema({
113
114
  $metadata: deserializeMetadata(parsedOutput),
114
115
  ...contents,
@@ -118,9 +119,10 @@ const de_ChannelUnsupportedSchemaRes = async (parsedOutput, context) => {
118
119
  const de_DuplicatedAuditEventIdRes = async (parsedOutput, context) => {
119
120
  const contents = map({});
120
121
  const data = parsedOutput.body;
121
- if (data.message != null) {
122
- contents.message = __expectString(data.message);
123
- }
122
+ const doc = take(data, {
123
+ message: __expectString,
124
+ });
125
+ Object.assign(contents, doc);
124
126
  const exception = new DuplicatedAuditEventId({
125
127
  $metadata: deserializeMetadata(parsedOutput),
126
128
  ...contents,
@@ -130,9 +132,10 @@ const de_DuplicatedAuditEventIdRes = async (parsedOutput, context) => {
130
132
  const de_InvalidChannelARNRes = async (parsedOutput, context) => {
131
133
  const contents = map({});
132
134
  const data = parsedOutput.body;
133
- if (data.message != null) {
134
- contents.message = __expectString(data.message);
135
- }
135
+ const doc = take(data, {
136
+ message: __expectString,
137
+ });
138
+ Object.assign(contents, doc);
136
139
  const exception = new InvalidChannelARN({
137
140
  $metadata: deserializeMetadata(parsedOutput),
138
141
  ...contents,
@@ -142,64 +145,16 @@ const de_InvalidChannelARNRes = async (parsedOutput, context) => {
142
145
  const de_UnsupportedOperationExceptionRes = async (parsedOutput, context) => {
143
146
  const contents = map({});
144
147
  const data = parsedOutput.body;
145
- if (data.message != null) {
146
- contents.message = __expectString(data.message);
147
- }
148
+ const doc = take(data, {
149
+ message: __expectString,
150
+ });
151
+ Object.assign(contents, doc);
148
152
  const exception = new UnsupportedOperationException({
149
153
  $metadata: deserializeMetadata(parsedOutput),
150
154
  ...contents,
151
155
  });
152
156
  return __decorateServiceException(exception, parsedOutput.body);
153
157
  };
154
- const se_AuditEvent = (input, context) => {
155
- return {
156
- ...(input.eventData != null && { eventData: input.eventData }),
157
- ...(input.eventDataChecksum != null && { eventDataChecksum: input.eventDataChecksum }),
158
- ...(input.id != null && { id: input.id }),
159
- };
160
- };
161
- const se_AuditEvents = (input, context) => {
162
- return input
163
- .filter((e) => e != null)
164
- .map((entry) => {
165
- return se_AuditEvent(entry, context);
166
- });
167
- };
168
- const de_AuditEventResultEntries = (output, context) => {
169
- const retVal = (output || [])
170
- .filter((e) => e != null)
171
- .map((entry) => {
172
- if (entry === null) {
173
- return null;
174
- }
175
- return de_AuditEventResultEntry(entry, context);
176
- });
177
- return retVal;
178
- };
179
- const de_AuditEventResultEntry = (output, context) => {
180
- return {
181
- eventID: __expectString(output.eventID),
182
- id: __expectString(output.id),
183
- };
184
- };
185
- const de_ResultErrorEntries = (output, context) => {
186
- const retVal = (output || [])
187
- .filter((e) => e != null)
188
- .map((entry) => {
189
- if (entry === null) {
190
- return null;
191
- }
192
- return de_ResultErrorEntry(entry, context);
193
- });
194
- return retVal;
195
- };
196
- const de_ResultErrorEntry = (output, context) => {
197
- return {
198
- errorCode: __expectString(output.errorCode),
199
- errorMessage: __expectString(output.errorMessage),
200
- id: __expectString(output.id),
201
- };
202
- };
203
158
  const deserializeMetadata = (output) => ({
204
159
  httpStatusCode: output.statusCode,
205
160
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-cloudtrail-data",
3
3
  "description": "AWS SDK for JavaScript Cloudtrail Data Client for Node.js, Browser and React Native",
4
- "version": "3.312.0",
4
+ "version": "3.315.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.315.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.315.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.315.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.315.0",
50
+ "@aws-sdk/util-defaults-mode-node": "3.315.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",