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