@aws-sdk/client-networkmonitor 3.480.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.
Files changed (131) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +309 -0
  3. package/dist-cjs/NetworkMonitor.js +35 -0
  4. package/dist-cjs/NetworkMonitorClient.js +43 -0
  5. package/dist-cjs/commands/CreateMonitorCommand.js +51 -0
  6. package/dist-cjs/commands/CreateProbeCommand.js +51 -0
  7. package/dist-cjs/commands/DeleteMonitorCommand.js +51 -0
  8. package/dist-cjs/commands/DeleteProbeCommand.js +51 -0
  9. package/dist-cjs/commands/GetMonitorCommand.js +51 -0
  10. package/dist-cjs/commands/GetProbeCommand.js +51 -0
  11. package/dist-cjs/commands/ListMonitorsCommand.js +51 -0
  12. package/dist-cjs/commands/ListTagsForResourceCommand.js +51 -0
  13. package/dist-cjs/commands/TagResourceCommand.js +51 -0
  14. package/dist-cjs/commands/UntagResourceCommand.js +51 -0
  15. package/dist-cjs/commands/UpdateMonitorCommand.js +51 -0
  16. package/dist-cjs/commands/UpdateProbeCommand.js +51 -0
  17. package/dist-cjs/commands/index.js +15 -0
  18. package/dist-cjs/endpoint/EndpointParameters.js +12 -0
  19. package/dist-cjs/endpoint/endpointResolver.js +12 -0
  20. package/dist-cjs/endpoint/ruleset.js +7 -0
  21. package/dist-cjs/extensionConfiguration.js +2 -0
  22. package/dist-cjs/index.js +12 -0
  23. package/dist-cjs/models/NetworkMonitorServiceException.js +12 -0
  24. package/dist-cjs/models/index.js +4 -0
  25. package/dist-cjs/models/models_0.js +122 -0
  26. package/dist-cjs/pagination/Interfaces.js +2 -0
  27. package/dist-cjs/pagination/ListMonitorsPaginator.js +7 -0
  28. package/dist-cjs/pagination/index.js +5 -0
  29. package/dist-cjs/protocols/Aws_restJson1.js +957 -0
  30. package/dist-cjs/runtimeConfig.browser.js +39 -0
  31. package/dist-cjs/runtimeConfig.js +50 -0
  32. package/dist-cjs/runtimeConfig.native.js +15 -0
  33. package/dist-cjs/runtimeConfig.shared.js +24 -0
  34. package/dist-cjs/runtimeExtensions.js +22 -0
  35. package/dist-es/NetworkMonitor.js +31 -0
  36. package/dist-es/NetworkMonitorClient.js +39 -0
  37. package/dist-es/commands/CreateMonitorCommand.js +47 -0
  38. package/dist-es/commands/CreateProbeCommand.js +47 -0
  39. package/dist-es/commands/DeleteMonitorCommand.js +47 -0
  40. package/dist-es/commands/DeleteProbeCommand.js +47 -0
  41. package/dist-es/commands/GetMonitorCommand.js +47 -0
  42. package/dist-es/commands/GetProbeCommand.js +47 -0
  43. package/dist-es/commands/ListMonitorsCommand.js +47 -0
  44. package/dist-es/commands/ListTagsForResourceCommand.js +47 -0
  45. package/dist-es/commands/TagResourceCommand.js +47 -0
  46. package/dist-es/commands/UntagResourceCommand.js +47 -0
  47. package/dist-es/commands/UpdateMonitorCommand.js +47 -0
  48. package/dist-es/commands/UpdateProbeCommand.js +47 -0
  49. package/dist-es/commands/index.js +12 -0
  50. package/dist-es/endpoint/EndpointParameters.js +8 -0
  51. package/dist-es/endpoint/endpointResolver.js +8 -0
  52. package/dist-es/endpoint/ruleset.js +4 -0
  53. package/dist-es/extensionConfiguration.js +1 -0
  54. package/dist-es/index.js +7 -0
  55. package/dist-es/models/NetworkMonitorServiceException.js +8 -0
  56. package/dist-es/models/index.js +1 -0
  57. package/dist-es/models/models_0.js +112 -0
  58. package/dist-es/pagination/Interfaces.js +1 -0
  59. package/dist-es/pagination/ListMonitorsPaginator.js +4 -0
  60. package/dist-es/pagination/index.js +2 -0
  61. package/dist-es/protocols/Aws_restJson1.js +930 -0
  62. package/dist-es/runtimeConfig.browser.js +34 -0
  63. package/dist-es/runtimeConfig.js +45 -0
  64. package/dist-es/runtimeConfig.native.js +11 -0
  65. package/dist-es/runtimeConfig.shared.js +20 -0
  66. package/dist-es/runtimeExtensions.js +18 -0
  67. package/dist-types/NetworkMonitor.d.ts +102 -0
  68. package/dist-types/NetworkMonitorClient.d.ts +189 -0
  69. package/dist-types/commands/CreateMonitorCommand.d.ts +114 -0
  70. package/dist-types/commands/CreateProbeCommand.d.ts +119 -0
  71. package/dist-types/commands/DeleteMonitorCommand.d.ts +86 -0
  72. package/dist-types/commands/DeleteProbeCommand.d.ts +90 -0
  73. package/dist-types/commands/GetMonitorCommand.d.ts +115 -0
  74. package/dist-types/commands/GetProbeCommand.d.ts +103 -0
  75. package/dist-types/commands/ListMonitorsCommand.d.ts +98 -0
  76. package/dist-types/commands/ListTagsForResourceCommand.d.ts +93 -0
  77. package/dist-types/commands/TagResourceCommand.d.ts +92 -0
  78. package/dist-types/commands/UntagResourceCommand.d.ts +92 -0
  79. package/dist-types/commands/UpdateMonitorCommand.d.ts +98 -0
  80. package/dist-types/commands/UpdateProbeCommand.d.ts +111 -0
  81. package/dist-types/commands/index.d.ts +12 -0
  82. package/dist-types/endpoint/EndpointParameters.d.ts +22 -0
  83. package/dist-types/endpoint/endpointResolver.d.ts +5 -0
  84. package/dist-types/endpoint/ruleset.d.ts +2 -0
  85. package/dist-types/extensionConfiguration.d.ts +8 -0
  86. package/dist-types/index.d.ts +23 -0
  87. package/dist-types/models/NetworkMonitorServiceException.d.ts +13 -0
  88. package/dist-types/models/index.d.ts +1 -0
  89. package/dist-types/models/models_0.d.ts +902 -0
  90. package/dist-types/pagination/Interfaces.d.ts +8 -0
  91. package/dist-types/pagination/ListMonitorsPaginator.d.ts +7 -0
  92. package/dist-types/pagination/index.d.ts +2 -0
  93. package/dist-types/protocols/Aws_restJson1.d.ts +110 -0
  94. package/dist-types/runtimeConfig.browser.d.ts +46 -0
  95. package/dist-types/runtimeConfig.d.ts +46 -0
  96. package/dist-types/runtimeConfig.native.d.ts +45 -0
  97. package/dist-types/runtimeConfig.shared.d.ts +19 -0
  98. package/dist-types/runtimeExtensions.d.ts +17 -0
  99. package/dist-types/ts3.4/NetworkMonitor.d.ts +211 -0
  100. package/dist-types/ts3.4/NetworkMonitorClient.d.ts +191 -0
  101. package/dist-types/ts3.4/commands/CreateMonitorCommand.d.ts +35 -0
  102. package/dist-types/ts3.4/commands/CreateProbeCommand.d.ts +35 -0
  103. package/dist-types/ts3.4/commands/DeleteMonitorCommand.d.ts +35 -0
  104. package/dist-types/ts3.4/commands/DeleteProbeCommand.d.ts +35 -0
  105. package/dist-types/ts3.4/commands/GetMonitorCommand.d.ts +35 -0
  106. package/dist-types/ts3.4/commands/GetProbeCommand.d.ts +35 -0
  107. package/dist-types/ts3.4/commands/ListMonitorsCommand.d.ts +35 -0
  108. package/dist-types/ts3.4/commands/ListTagsForResourceCommand.d.ts +39 -0
  109. package/dist-types/ts3.4/commands/TagResourceCommand.d.ts +35 -0
  110. package/dist-types/ts3.4/commands/UntagResourceCommand.d.ts +35 -0
  111. package/dist-types/ts3.4/commands/UpdateMonitorCommand.d.ts +35 -0
  112. package/dist-types/ts3.4/commands/UpdateProbeCommand.d.ts +35 -0
  113. package/dist-types/ts3.4/commands/index.d.ts +12 -0
  114. package/dist-types/ts3.4/endpoint/EndpointParameters.d.ts +33 -0
  115. package/dist-types/ts3.4/endpoint/endpointResolver.d.ts +8 -0
  116. package/dist-types/ts3.4/endpoint/ruleset.d.ts +2 -0
  117. package/dist-types/ts3.4/extensionConfiguration.d.ts +7 -0
  118. package/dist-types/ts3.4/index.d.ts +10 -0
  119. package/dist-types/ts3.4/models/NetworkMonitorServiceException.d.ts +8 -0
  120. package/dist-types/ts3.4/models/index.d.ts +1 -0
  121. package/dist-types/ts3.4/models/models_0.d.ts +254 -0
  122. package/dist-types/ts3.4/pagination/Interfaces.d.ts +6 -0
  123. package/dist-types/ts3.4/pagination/ListMonitorsPaginator.d.ts +11 -0
  124. package/dist-types/ts3.4/pagination/index.d.ts +2 -0
  125. package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +149 -0
  126. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +97 -0
  127. package/dist-types/ts3.4/runtimeConfig.d.ts +97 -0
  128. package/dist-types/ts3.4/runtimeConfig.native.d.ts +88 -0
  129. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +19 -0
  130. package/dist-types/ts3.4/runtimeExtensions.d.ts +11 -0
  131. package/package.json +103 -0
@@ -0,0 +1,930 @@
1
+ import { requestBuilder as rb } from "@smithy/core";
2
+ import { _json, collectBody, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectLong as __expectLong, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, map, parseEpochTimestamp as __parseEpochTimestamp, take, withBaseException, } from "@smithy/smithy-client";
3
+ import { v4 as generateIdempotencyToken } from "uuid";
4
+ import { AccessDeniedException, ConflictException, InternalServerException, ResourceNotFoundException, ServiceQuotaExceededException, ThrottlingException, ValidationException, } from "../models/models_0";
5
+ import { NetworkMonitorServiceException as __BaseException } from "../models/NetworkMonitorServiceException";
6
+ export const se_CreateMonitorCommand = async (input, context) => {
7
+ const b = rb(input, context);
8
+ const headers = {
9
+ "content-type": "application/json",
10
+ };
11
+ b.bp("/monitors");
12
+ let body;
13
+ body = JSON.stringify(take(input, {
14
+ aggregationPeriod: [],
15
+ clientToken: [true, (_) => _ ?? generateIdempotencyToken()],
16
+ monitorName: [],
17
+ probes: (_) => _json(_),
18
+ tags: (_) => _json(_),
19
+ }));
20
+ b.m("POST").h(headers).b(body);
21
+ return b.build();
22
+ };
23
+ export const se_CreateProbeCommand = async (input, context) => {
24
+ const b = rb(input, context);
25
+ const headers = {
26
+ "content-type": "application/json",
27
+ };
28
+ b.bp("/monitors/{monitorName}/probes");
29
+ b.p("monitorName", () => input.monitorName, "{monitorName}", false);
30
+ let body;
31
+ body = JSON.stringify(take(input, {
32
+ clientToken: [true, (_) => _ ?? generateIdempotencyToken()],
33
+ probe: (_) => _json(_),
34
+ tags: (_) => _json(_),
35
+ }));
36
+ b.m("POST").h(headers).b(body);
37
+ return b.build();
38
+ };
39
+ export const se_DeleteMonitorCommand = async (input, context) => {
40
+ const b = rb(input, context);
41
+ const headers = {};
42
+ b.bp("/monitors/{monitorName}");
43
+ b.p("monitorName", () => input.monitorName, "{monitorName}", false);
44
+ let body;
45
+ b.m("DELETE").h(headers).b(body);
46
+ return b.build();
47
+ };
48
+ export const se_DeleteProbeCommand = async (input, context) => {
49
+ const b = rb(input, context);
50
+ const headers = {};
51
+ b.bp("/monitors/{monitorName}/probes/{probeId}");
52
+ b.p("monitorName", () => input.monitorName, "{monitorName}", false);
53
+ b.p("probeId", () => input.probeId, "{probeId}", false);
54
+ let body;
55
+ b.m("DELETE").h(headers).b(body);
56
+ return b.build();
57
+ };
58
+ export const se_GetMonitorCommand = async (input, context) => {
59
+ const b = rb(input, context);
60
+ const headers = {};
61
+ b.bp("/monitors/{monitorName}");
62
+ b.p("monitorName", () => input.monitorName, "{monitorName}", false);
63
+ let body;
64
+ b.m("GET").h(headers).b(body);
65
+ return b.build();
66
+ };
67
+ export const se_GetProbeCommand = async (input, context) => {
68
+ const b = rb(input, context);
69
+ const headers = {};
70
+ b.bp("/monitors/{monitorName}/probes/{probeId}");
71
+ b.p("monitorName", () => input.monitorName, "{monitorName}", false);
72
+ b.p("probeId", () => input.probeId, "{probeId}", false);
73
+ let body;
74
+ b.m("GET").h(headers).b(body);
75
+ return b.build();
76
+ };
77
+ export const se_ListMonitorsCommand = async (input, context) => {
78
+ const b = rb(input, context);
79
+ const headers = {};
80
+ b.bp("/monitors");
81
+ const query = map({
82
+ [_nT]: [, input[_nT]],
83
+ [_mR]: [() => input.maxResults !== void 0, () => input[_mR].toString()],
84
+ [_s]: [, input[_s]],
85
+ });
86
+ let body;
87
+ b.m("GET").h(headers).q(query).b(body);
88
+ return b.build();
89
+ };
90
+ export const se_ListTagsForResourceCommand = async (input, context) => {
91
+ const b = rb(input, context);
92
+ const headers = {};
93
+ b.bp("/tags/{resourceArn}");
94
+ b.p("resourceArn", () => input.resourceArn, "{resourceArn}", false);
95
+ let body;
96
+ b.m("GET").h(headers).b(body);
97
+ return b.build();
98
+ };
99
+ export const se_TagResourceCommand = async (input, context) => {
100
+ const b = rb(input, context);
101
+ const headers = {
102
+ "content-type": "application/json",
103
+ };
104
+ b.bp("/tags/{resourceArn}");
105
+ b.p("resourceArn", () => input.resourceArn, "{resourceArn}", false);
106
+ let body;
107
+ body = JSON.stringify(take(input, {
108
+ tags: (_) => _json(_),
109
+ }));
110
+ b.m("POST").h(headers).b(body);
111
+ return b.build();
112
+ };
113
+ export const se_UntagResourceCommand = async (input, context) => {
114
+ const b = rb(input, context);
115
+ const headers = {};
116
+ b.bp("/tags/{resourceArn}");
117
+ b.p("resourceArn", () => input.resourceArn, "{resourceArn}", false);
118
+ const query = map({
119
+ [_tK]: [
120
+ __expectNonNull(input.tagKeys, `tagKeys`) != null,
121
+ () => (input[_tK] || []).map((_entry) => _entry),
122
+ ],
123
+ });
124
+ let body;
125
+ b.m("DELETE").h(headers).q(query).b(body);
126
+ return b.build();
127
+ };
128
+ export const se_UpdateMonitorCommand = async (input, context) => {
129
+ const b = rb(input, context);
130
+ const headers = {
131
+ "content-type": "application/json",
132
+ };
133
+ b.bp("/monitors/{monitorName}");
134
+ b.p("monitorName", () => input.monitorName, "{monitorName}", false);
135
+ let body;
136
+ body = JSON.stringify(take(input, {
137
+ aggregationPeriod: [],
138
+ }));
139
+ b.m("PATCH").h(headers).b(body);
140
+ return b.build();
141
+ };
142
+ export const se_UpdateProbeCommand = async (input, context) => {
143
+ const b = rb(input, context);
144
+ const headers = {
145
+ "content-type": "application/json",
146
+ };
147
+ b.bp("/monitors/{monitorName}/probes/{probeId}");
148
+ b.p("monitorName", () => input.monitorName, "{monitorName}", false);
149
+ b.p("probeId", () => input.probeId, "{probeId}", false);
150
+ let body;
151
+ body = JSON.stringify(take(input, {
152
+ destination: [],
153
+ destinationPort: [],
154
+ packetSize: [],
155
+ protocol: [],
156
+ state: [],
157
+ }));
158
+ b.m("PATCH").h(headers).b(body);
159
+ return b.build();
160
+ };
161
+ export const de_CreateMonitorCommand = async (output, context) => {
162
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
163
+ return de_CreateMonitorCommandError(output, context);
164
+ }
165
+ const contents = map({
166
+ $metadata: deserializeMetadata(output),
167
+ });
168
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
169
+ const doc = take(data, {
170
+ aggregationPeriod: __expectLong,
171
+ monitorArn: __expectString,
172
+ monitorName: __expectString,
173
+ state: __expectString,
174
+ tags: _json,
175
+ });
176
+ Object.assign(contents, doc);
177
+ return contents;
178
+ };
179
+ const de_CreateMonitorCommandError = async (output, context) => {
180
+ const parsedOutput = {
181
+ ...output,
182
+ body: await parseErrorBody(output.body, context),
183
+ };
184
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
185
+ switch (errorCode) {
186
+ case "AccessDeniedException":
187
+ case "com.amazonaws.networkmonitor#AccessDeniedException":
188
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
189
+ case "ConflictException":
190
+ case "com.amazonaws.networkmonitor#ConflictException":
191
+ throw await de_ConflictExceptionRes(parsedOutput, context);
192
+ case "InternalServerException":
193
+ case "com.amazonaws.networkmonitor#InternalServerException":
194
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
195
+ case "ServiceQuotaExceededException":
196
+ case "com.amazonaws.networkmonitor#ServiceQuotaExceededException":
197
+ throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
198
+ case "ThrottlingException":
199
+ case "com.amazonaws.networkmonitor#ThrottlingException":
200
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
201
+ case "ValidationException":
202
+ case "com.amazonaws.networkmonitor#ValidationException":
203
+ throw await de_ValidationExceptionRes(parsedOutput, context);
204
+ default:
205
+ const parsedBody = parsedOutput.body;
206
+ return throwDefaultError({
207
+ output,
208
+ parsedBody,
209
+ errorCode,
210
+ });
211
+ }
212
+ };
213
+ export const de_CreateProbeCommand = async (output, context) => {
214
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
215
+ return de_CreateProbeCommandError(output, context);
216
+ }
217
+ const contents = map({
218
+ $metadata: deserializeMetadata(output),
219
+ });
220
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
221
+ const doc = take(data, {
222
+ addressFamily: __expectString,
223
+ createdAt: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
224
+ destination: __expectString,
225
+ destinationPort: __expectInt32,
226
+ modifiedAt: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
227
+ packetSize: __expectInt32,
228
+ probeArn: __expectString,
229
+ probeId: __expectString,
230
+ protocol: __expectString,
231
+ sourceArn: __expectString,
232
+ state: __expectString,
233
+ tags: _json,
234
+ vpcId: __expectString,
235
+ });
236
+ Object.assign(contents, doc);
237
+ return contents;
238
+ };
239
+ const de_CreateProbeCommandError = async (output, context) => {
240
+ const parsedOutput = {
241
+ ...output,
242
+ body: await parseErrorBody(output.body, context),
243
+ };
244
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
245
+ switch (errorCode) {
246
+ case "AccessDeniedException":
247
+ case "com.amazonaws.networkmonitor#AccessDeniedException":
248
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
249
+ case "InternalServerException":
250
+ case "com.amazonaws.networkmonitor#InternalServerException":
251
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
252
+ case "ResourceNotFoundException":
253
+ case "com.amazonaws.networkmonitor#ResourceNotFoundException":
254
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
255
+ case "ServiceQuotaExceededException":
256
+ case "com.amazonaws.networkmonitor#ServiceQuotaExceededException":
257
+ throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
258
+ case "ThrottlingException":
259
+ case "com.amazonaws.networkmonitor#ThrottlingException":
260
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
261
+ case "ValidationException":
262
+ case "com.amazonaws.networkmonitor#ValidationException":
263
+ throw await de_ValidationExceptionRes(parsedOutput, context);
264
+ default:
265
+ const parsedBody = parsedOutput.body;
266
+ return throwDefaultError({
267
+ output,
268
+ parsedBody,
269
+ errorCode,
270
+ });
271
+ }
272
+ };
273
+ export const de_DeleteMonitorCommand = async (output, context) => {
274
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
275
+ return de_DeleteMonitorCommandError(output, context);
276
+ }
277
+ const contents = map({
278
+ $metadata: deserializeMetadata(output),
279
+ });
280
+ await collectBody(output.body, context);
281
+ return contents;
282
+ };
283
+ const de_DeleteMonitorCommandError = async (output, context) => {
284
+ const parsedOutput = {
285
+ ...output,
286
+ body: await parseErrorBody(output.body, context),
287
+ };
288
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
289
+ switch (errorCode) {
290
+ case "AccessDeniedException":
291
+ case "com.amazonaws.networkmonitor#AccessDeniedException":
292
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
293
+ case "InternalServerException":
294
+ case "com.amazonaws.networkmonitor#InternalServerException":
295
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
296
+ case "ResourceNotFoundException":
297
+ case "com.amazonaws.networkmonitor#ResourceNotFoundException":
298
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
299
+ case "ThrottlingException":
300
+ case "com.amazonaws.networkmonitor#ThrottlingException":
301
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
302
+ case "ValidationException":
303
+ case "com.amazonaws.networkmonitor#ValidationException":
304
+ throw await de_ValidationExceptionRes(parsedOutput, context);
305
+ default:
306
+ const parsedBody = parsedOutput.body;
307
+ return throwDefaultError({
308
+ output,
309
+ parsedBody,
310
+ errorCode,
311
+ });
312
+ }
313
+ };
314
+ export const de_DeleteProbeCommand = async (output, context) => {
315
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
316
+ return de_DeleteProbeCommandError(output, context);
317
+ }
318
+ const contents = map({
319
+ $metadata: deserializeMetadata(output),
320
+ });
321
+ await collectBody(output.body, context);
322
+ return contents;
323
+ };
324
+ const de_DeleteProbeCommandError = async (output, context) => {
325
+ const parsedOutput = {
326
+ ...output,
327
+ body: await parseErrorBody(output.body, context),
328
+ };
329
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
330
+ switch (errorCode) {
331
+ case "AccessDeniedException":
332
+ case "com.amazonaws.networkmonitor#AccessDeniedException":
333
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
334
+ case "InternalServerException":
335
+ case "com.amazonaws.networkmonitor#InternalServerException":
336
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
337
+ case "ResourceNotFoundException":
338
+ case "com.amazonaws.networkmonitor#ResourceNotFoundException":
339
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
340
+ case "ServiceQuotaExceededException":
341
+ case "com.amazonaws.networkmonitor#ServiceQuotaExceededException":
342
+ throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
343
+ case "ThrottlingException":
344
+ case "com.amazonaws.networkmonitor#ThrottlingException":
345
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
346
+ case "ValidationException":
347
+ case "com.amazonaws.networkmonitor#ValidationException":
348
+ throw await de_ValidationExceptionRes(parsedOutput, context);
349
+ default:
350
+ const parsedBody = parsedOutput.body;
351
+ return throwDefaultError({
352
+ output,
353
+ parsedBody,
354
+ errorCode,
355
+ });
356
+ }
357
+ };
358
+ export const de_GetMonitorCommand = async (output, context) => {
359
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
360
+ return de_GetMonitorCommandError(output, context);
361
+ }
362
+ const contents = map({
363
+ $metadata: deserializeMetadata(output),
364
+ });
365
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
366
+ const doc = take(data, {
367
+ aggregationPeriod: __expectLong,
368
+ createdAt: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
369
+ modifiedAt: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
370
+ monitorArn: __expectString,
371
+ monitorName: __expectString,
372
+ probes: (_) => de_ProbeList(_, context),
373
+ state: __expectString,
374
+ tags: _json,
375
+ });
376
+ Object.assign(contents, doc);
377
+ return contents;
378
+ };
379
+ const de_GetMonitorCommandError = async (output, context) => {
380
+ const parsedOutput = {
381
+ ...output,
382
+ body: await parseErrorBody(output.body, context),
383
+ };
384
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
385
+ switch (errorCode) {
386
+ case "AccessDeniedException":
387
+ case "com.amazonaws.networkmonitor#AccessDeniedException":
388
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
389
+ case "InternalServerException":
390
+ case "com.amazonaws.networkmonitor#InternalServerException":
391
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
392
+ case "ResourceNotFoundException":
393
+ case "com.amazonaws.networkmonitor#ResourceNotFoundException":
394
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
395
+ case "ThrottlingException":
396
+ case "com.amazonaws.networkmonitor#ThrottlingException":
397
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
398
+ case "ValidationException":
399
+ case "com.amazonaws.networkmonitor#ValidationException":
400
+ throw await de_ValidationExceptionRes(parsedOutput, context);
401
+ default:
402
+ const parsedBody = parsedOutput.body;
403
+ return throwDefaultError({
404
+ output,
405
+ parsedBody,
406
+ errorCode,
407
+ });
408
+ }
409
+ };
410
+ export const de_GetProbeCommand = async (output, context) => {
411
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
412
+ return de_GetProbeCommandError(output, context);
413
+ }
414
+ const contents = map({
415
+ $metadata: deserializeMetadata(output),
416
+ });
417
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
418
+ const doc = take(data, {
419
+ addressFamily: __expectString,
420
+ createdAt: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
421
+ destination: __expectString,
422
+ destinationPort: __expectInt32,
423
+ modifiedAt: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
424
+ packetSize: __expectInt32,
425
+ probeArn: __expectString,
426
+ probeId: __expectString,
427
+ protocol: __expectString,
428
+ sourceArn: __expectString,
429
+ state: __expectString,
430
+ tags: _json,
431
+ vpcId: __expectString,
432
+ });
433
+ Object.assign(contents, doc);
434
+ return contents;
435
+ };
436
+ const de_GetProbeCommandError = async (output, context) => {
437
+ const parsedOutput = {
438
+ ...output,
439
+ body: await parseErrorBody(output.body, context),
440
+ };
441
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
442
+ switch (errorCode) {
443
+ case "AccessDeniedException":
444
+ case "com.amazonaws.networkmonitor#AccessDeniedException":
445
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
446
+ case "InternalServerException":
447
+ case "com.amazonaws.networkmonitor#InternalServerException":
448
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
449
+ case "ResourceNotFoundException":
450
+ case "com.amazonaws.networkmonitor#ResourceNotFoundException":
451
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
452
+ case "ThrottlingException":
453
+ case "com.amazonaws.networkmonitor#ThrottlingException":
454
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
455
+ case "ValidationException":
456
+ case "com.amazonaws.networkmonitor#ValidationException":
457
+ throw await de_ValidationExceptionRes(parsedOutput, context);
458
+ default:
459
+ const parsedBody = parsedOutput.body;
460
+ return throwDefaultError({
461
+ output,
462
+ parsedBody,
463
+ errorCode,
464
+ });
465
+ }
466
+ };
467
+ export const de_ListMonitorsCommand = async (output, context) => {
468
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
469
+ return de_ListMonitorsCommandError(output, context);
470
+ }
471
+ const contents = map({
472
+ $metadata: deserializeMetadata(output),
473
+ });
474
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
475
+ const doc = take(data, {
476
+ monitors: _json,
477
+ nextToken: __expectString,
478
+ });
479
+ Object.assign(contents, doc);
480
+ return contents;
481
+ };
482
+ const de_ListMonitorsCommandError = async (output, context) => {
483
+ const parsedOutput = {
484
+ ...output,
485
+ body: await parseErrorBody(output.body, context),
486
+ };
487
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
488
+ switch (errorCode) {
489
+ case "AccessDeniedException":
490
+ case "com.amazonaws.networkmonitor#AccessDeniedException":
491
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
492
+ case "InternalServerException":
493
+ case "com.amazonaws.networkmonitor#InternalServerException":
494
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
495
+ case "ThrottlingException":
496
+ case "com.amazonaws.networkmonitor#ThrottlingException":
497
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
498
+ case "ValidationException":
499
+ case "com.amazonaws.networkmonitor#ValidationException":
500
+ throw await de_ValidationExceptionRes(parsedOutput, context);
501
+ default:
502
+ const parsedBody = parsedOutput.body;
503
+ return throwDefaultError({
504
+ output,
505
+ parsedBody,
506
+ errorCode,
507
+ });
508
+ }
509
+ };
510
+ export const de_ListTagsForResourceCommand = async (output, context) => {
511
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
512
+ return de_ListTagsForResourceCommandError(output, context);
513
+ }
514
+ const contents = map({
515
+ $metadata: deserializeMetadata(output),
516
+ });
517
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
518
+ const doc = take(data, {
519
+ tags: _json,
520
+ });
521
+ Object.assign(contents, doc);
522
+ return contents;
523
+ };
524
+ const de_ListTagsForResourceCommandError = async (output, context) => {
525
+ const parsedOutput = {
526
+ ...output,
527
+ body: await parseErrorBody(output.body, context),
528
+ };
529
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
530
+ switch (errorCode) {
531
+ case "AccessDeniedException":
532
+ case "com.amazonaws.networkmonitor#AccessDeniedException":
533
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
534
+ case "ConflictException":
535
+ case "com.amazonaws.networkmonitor#ConflictException":
536
+ throw await de_ConflictExceptionRes(parsedOutput, context);
537
+ case "InternalServerException":
538
+ case "com.amazonaws.networkmonitor#InternalServerException":
539
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
540
+ case "ResourceNotFoundException":
541
+ case "com.amazonaws.networkmonitor#ResourceNotFoundException":
542
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
543
+ case "ThrottlingException":
544
+ case "com.amazonaws.networkmonitor#ThrottlingException":
545
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
546
+ case "ValidationException":
547
+ case "com.amazonaws.networkmonitor#ValidationException":
548
+ throw await de_ValidationExceptionRes(parsedOutput, context);
549
+ default:
550
+ const parsedBody = parsedOutput.body;
551
+ return throwDefaultError({
552
+ output,
553
+ parsedBody,
554
+ errorCode,
555
+ });
556
+ }
557
+ };
558
+ export const de_TagResourceCommand = async (output, context) => {
559
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
560
+ return de_TagResourceCommandError(output, context);
561
+ }
562
+ const contents = map({
563
+ $metadata: deserializeMetadata(output),
564
+ });
565
+ await collectBody(output.body, context);
566
+ return contents;
567
+ };
568
+ const de_TagResourceCommandError = async (output, context) => {
569
+ const parsedOutput = {
570
+ ...output,
571
+ body: await parseErrorBody(output.body, context),
572
+ };
573
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
574
+ switch (errorCode) {
575
+ case "AccessDeniedException":
576
+ case "com.amazonaws.networkmonitor#AccessDeniedException":
577
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
578
+ case "ConflictException":
579
+ case "com.amazonaws.networkmonitor#ConflictException":
580
+ throw await de_ConflictExceptionRes(parsedOutput, context);
581
+ case "InternalServerException":
582
+ case "com.amazonaws.networkmonitor#InternalServerException":
583
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
584
+ case "ResourceNotFoundException":
585
+ case "com.amazonaws.networkmonitor#ResourceNotFoundException":
586
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
587
+ case "ThrottlingException":
588
+ case "com.amazonaws.networkmonitor#ThrottlingException":
589
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
590
+ case "ValidationException":
591
+ case "com.amazonaws.networkmonitor#ValidationException":
592
+ throw await de_ValidationExceptionRes(parsedOutput, context);
593
+ default:
594
+ const parsedBody = parsedOutput.body;
595
+ return throwDefaultError({
596
+ output,
597
+ parsedBody,
598
+ errorCode,
599
+ });
600
+ }
601
+ };
602
+ export const de_UntagResourceCommand = async (output, context) => {
603
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
604
+ return de_UntagResourceCommandError(output, context);
605
+ }
606
+ const contents = map({
607
+ $metadata: deserializeMetadata(output),
608
+ });
609
+ await collectBody(output.body, context);
610
+ return contents;
611
+ };
612
+ const de_UntagResourceCommandError = async (output, context) => {
613
+ const parsedOutput = {
614
+ ...output,
615
+ body: await parseErrorBody(output.body, context),
616
+ };
617
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
618
+ switch (errorCode) {
619
+ case "AccessDeniedException":
620
+ case "com.amazonaws.networkmonitor#AccessDeniedException":
621
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
622
+ case "ConflictException":
623
+ case "com.amazonaws.networkmonitor#ConflictException":
624
+ throw await de_ConflictExceptionRes(parsedOutput, context);
625
+ case "InternalServerException":
626
+ case "com.amazonaws.networkmonitor#InternalServerException":
627
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
628
+ case "ResourceNotFoundException":
629
+ case "com.amazonaws.networkmonitor#ResourceNotFoundException":
630
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
631
+ case "ThrottlingException":
632
+ case "com.amazonaws.networkmonitor#ThrottlingException":
633
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
634
+ case "ValidationException":
635
+ case "com.amazonaws.networkmonitor#ValidationException":
636
+ throw await de_ValidationExceptionRes(parsedOutput, context);
637
+ default:
638
+ const parsedBody = parsedOutput.body;
639
+ return throwDefaultError({
640
+ output,
641
+ parsedBody,
642
+ errorCode,
643
+ });
644
+ }
645
+ };
646
+ export const de_UpdateMonitorCommand = async (output, context) => {
647
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
648
+ return de_UpdateMonitorCommandError(output, context);
649
+ }
650
+ const contents = map({
651
+ $metadata: deserializeMetadata(output),
652
+ });
653
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
654
+ const doc = take(data, {
655
+ aggregationPeriod: __expectLong,
656
+ monitorArn: __expectString,
657
+ monitorName: __expectString,
658
+ state: __expectString,
659
+ tags: _json,
660
+ });
661
+ Object.assign(contents, doc);
662
+ return contents;
663
+ };
664
+ const de_UpdateMonitorCommandError = async (output, context) => {
665
+ const parsedOutput = {
666
+ ...output,
667
+ body: await parseErrorBody(output.body, context),
668
+ };
669
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
670
+ switch (errorCode) {
671
+ case "AccessDeniedException":
672
+ case "com.amazonaws.networkmonitor#AccessDeniedException":
673
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
674
+ case "InternalServerException":
675
+ case "com.amazonaws.networkmonitor#InternalServerException":
676
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
677
+ case "ResourceNotFoundException":
678
+ case "com.amazonaws.networkmonitor#ResourceNotFoundException":
679
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
680
+ case "ServiceQuotaExceededException":
681
+ case "com.amazonaws.networkmonitor#ServiceQuotaExceededException":
682
+ throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
683
+ case "ThrottlingException":
684
+ case "com.amazonaws.networkmonitor#ThrottlingException":
685
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
686
+ case "ValidationException":
687
+ case "com.amazonaws.networkmonitor#ValidationException":
688
+ throw await de_ValidationExceptionRes(parsedOutput, context);
689
+ default:
690
+ const parsedBody = parsedOutput.body;
691
+ return throwDefaultError({
692
+ output,
693
+ parsedBody,
694
+ errorCode,
695
+ });
696
+ }
697
+ };
698
+ export const de_UpdateProbeCommand = async (output, context) => {
699
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
700
+ return de_UpdateProbeCommandError(output, context);
701
+ }
702
+ const contents = map({
703
+ $metadata: deserializeMetadata(output),
704
+ });
705
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
706
+ const doc = take(data, {
707
+ addressFamily: __expectString,
708
+ createdAt: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
709
+ destination: __expectString,
710
+ destinationPort: __expectInt32,
711
+ modifiedAt: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
712
+ packetSize: __expectInt32,
713
+ probeArn: __expectString,
714
+ probeId: __expectString,
715
+ protocol: __expectString,
716
+ sourceArn: __expectString,
717
+ state: __expectString,
718
+ tags: _json,
719
+ vpcId: __expectString,
720
+ });
721
+ Object.assign(contents, doc);
722
+ return contents;
723
+ };
724
+ const de_UpdateProbeCommandError = async (output, context) => {
725
+ const parsedOutput = {
726
+ ...output,
727
+ body: await parseErrorBody(output.body, context),
728
+ };
729
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
730
+ switch (errorCode) {
731
+ case "AccessDeniedException":
732
+ case "com.amazonaws.networkmonitor#AccessDeniedException":
733
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
734
+ case "InternalServerException":
735
+ case "com.amazonaws.networkmonitor#InternalServerException":
736
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
737
+ case "ResourceNotFoundException":
738
+ case "com.amazonaws.networkmonitor#ResourceNotFoundException":
739
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
740
+ case "ServiceQuotaExceededException":
741
+ case "com.amazonaws.networkmonitor#ServiceQuotaExceededException":
742
+ throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
743
+ case "ThrottlingException":
744
+ case "com.amazonaws.networkmonitor#ThrottlingException":
745
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
746
+ case "ValidationException":
747
+ case "com.amazonaws.networkmonitor#ValidationException":
748
+ throw await de_ValidationExceptionRes(parsedOutput, context);
749
+ default:
750
+ const parsedBody = parsedOutput.body;
751
+ return throwDefaultError({
752
+ output,
753
+ parsedBody,
754
+ errorCode,
755
+ });
756
+ }
757
+ };
758
+ const throwDefaultError = withBaseException(__BaseException);
759
+ const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
760
+ const contents = map({});
761
+ const data = parsedOutput.body;
762
+ const doc = take(data, {
763
+ message: __expectString,
764
+ });
765
+ Object.assign(contents, doc);
766
+ const exception = new AccessDeniedException({
767
+ $metadata: deserializeMetadata(parsedOutput),
768
+ ...contents,
769
+ });
770
+ return __decorateServiceException(exception, parsedOutput.body);
771
+ };
772
+ const de_ConflictExceptionRes = async (parsedOutput, context) => {
773
+ const contents = map({});
774
+ const data = parsedOutput.body;
775
+ const doc = take(data, {
776
+ message: __expectString,
777
+ });
778
+ Object.assign(contents, doc);
779
+ const exception = new ConflictException({
780
+ $metadata: deserializeMetadata(parsedOutput),
781
+ ...contents,
782
+ });
783
+ return __decorateServiceException(exception, parsedOutput.body);
784
+ };
785
+ const de_InternalServerExceptionRes = async (parsedOutput, context) => {
786
+ const contents = map({});
787
+ const data = parsedOutput.body;
788
+ const doc = take(data, {
789
+ message: __expectString,
790
+ });
791
+ Object.assign(contents, doc);
792
+ const exception = new InternalServerException({
793
+ $metadata: deserializeMetadata(parsedOutput),
794
+ ...contents,
795
+ });
796
+ return __decorateServiceException(exception, parsedOutput.body);
797
+ };
798
+ const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
799
+ const contents = map({});
800
+ const data = parsedOutput.body;
801
+ const doc = take(data, {
802
+ message: __expectString,
803
+ });
804
+ Object.assign(contents, doc);
805
+ const exception = new ResourceNotFoundException({
806
+ $metadata: deserializeMetadata(parsedOutput),
807
+ ...contents,
808
+ });
809
+ return __decorateServiceException(exception, parsedOutput.body);
810
+ };
811
+ const de_ServiceQuotaExceededExceptionRes = async (parsedOutput, context) => {
812
+ const contents = map({});
813
+ const data = parsedOutput.body;
814
+ const doc = take(data, {
815
+ message: __expectString,
816
+ });
817
+ Object.assign(contents, doc);
818
+ const exception = new ServiceQuotaExceededException({
819
+ $metadata: deserializeMetadata(parsedOutput),
820
+ ...contents,
821
+ });
822
+ return __decorateServiceException(exception, parsedOutput.body);
823
+ };
824
+ const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
825
+ const contents = map({});
826
+ const data = parsedOutput.body;
827
+ const doc = take(data, {
828
+ message: __expectString,
829
+ });
830
+ Object.assign(contents, doc);
831
+ const exception = new ThrottlingException({
832
+ $metadata: deserializeMetadata(parsedOutput),
833
+ ...contents,
834
+ });
835
+ return __decorateServiceException(exception, parsedOutput.body);
836
+ };
837
+ const de_ValidationExceptionRes = async (parsedOutput, context) => {
838
+ const contents = map({});
839
+ const data = parsedOutput.body;
840
+ const doc = take(data, {
841
+ message: __expectString,
842
+ });
843
+ Object.assign(contents, doc);
844
+ const exception = new ValidationException({
845
+ $metadata: deserializeMetadata(parsedOutput),
846
+ ...contents,
847
+ });
848
+ return __decorateServiceException(exception, parsedOutput.body);
849
+ };
850
+ const de_Probe = (output, context) => {
851
+ return take(output, {
852
+ addressFamily: __expectString,
853
+ createdAt: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
854
+ destination: __expectString,
855
+ destinationPort: __expectInt32,
856
+ modifiedAt: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
857
+ packetSize: __expectInt32,
858
+ probeArn: __expectString,
859
+ probeId: __expectString,
860
+ protocol: __expectString,
861
+ sourceArn: __expectString,
862
+ state: __expectString,
863
+ tags: _json,
864
+ vpcId: __expectString,
865
+ });
866
+ };
867
+ const de_ProbeList = (output, context) => {
868
+ const retVal = (output || [])
869
+ .filter((e) => e != null)
870
+ .map((entry) => {
871
+ return de_Probe(entry, context);
872
+ });
873
+ return retVal;
874
+ };
875
+ const deserializeMetadata = (output) => ({
876
+ httpStatusCode: output.statusCode,
877
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
878
+ extendedRequestId: output.headers["x-amz-id-2"],
879
+ cfId: output.headers["x-amz-cf-id"],
880
+ });
881
+ const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
882
+ const isSerializableHeaderValue = (value) => value !== undefined &&
883
+ value !== null &&
884
+ value !== "" &&
885
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
886
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
887
+ const _mR = "maxResults";
888
+ const _nT = "nextToken";
889
+ const _s = "state";
890
+ const _tK = "tagKeys";
891
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
892
+ if (encoded.length) {
893
+ return JSON.parse(encoded);
894
+ }
895
+ return {};
896
+ });
897
+ const parseErrorBody = async (errorBody, context) => {
898
+ const value = await parseBody(errorBody, context);
899
+ value.message = value.message ?? value.Message;
900
+ return value;
901
+ };
902
+ const loadRestJsonErrorCode = (output, data) => {
903
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
904
+ const sanitizeErrorCode = (rawValue) => {
905
+ let cleanValue = rawValue;
906
+ if (typeof cleanValue === "number") {
907
+ cleanValue = cleanValue.toString();
908
+ }
909
+ if (cleanValue.indexOf(",") >= 0) {
910
+ cleanValue = cleanValue.split(",")[0];
911
+ }
912
+ if (cleanValue.indexOf(":") >= 0) {
913
+ cleanValue = cleanValue.split(":")[0];
914
+ }
915
+ if (cleanValue.indexOf("#") >= 0) {
916
+ cleanValue = cleanValue.split("#")[1];
917
+ }
918
+ return cleanValue;
919
+ };
920
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
921
+ if (headerKey !== undefined) {
922
+ return sanitizeErrorCode(output.headers[headerKey]);
923
+ }
924
+ if (data.code !== undefined) {
925
+ return sanitizeErrorCode(data.code);
926
+ }
927
+ if (data["__type"] !== undefined) {
928
+ return sanitizeErrorCode(data["__type"]);
929
+ }
930
+ };