@aws-sdk/client-rum 3.44.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 (108) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/LICENSE +201 -0
  3. package/README.md +211 -0
  4. package/dist-cjs/RUM.js +157 -0
  5. package/dist-cjs/RUMClient.js +35 -0
  6. package/dist-cjs/commands/CreateAppMonitorCommand.js +36 -0
  7. package/dist-cjs/commands/DeleteAppMonitorCommand.js +36 -0
  8. package/dist-cjs/commands/GetAppMonitorCommand.js +36 -0
  9. package/dist-cjs/commands/GetAppMonitorDataCommand.js +36 -0
  10. package/dist-cjs/commands/ListAppMonitorsCommand.js +36 -0
  11. package/dist-cjs/commands/ListTagsForResourceCommand.js +36 -0
  12. package/dist-cjs/commands/PutRumEventsCommand.js +36 -0
  13. package/dist-cjs/commands/TagResourceCommand.js +36 -0
  14. package/dist-cjs/commands/UntagResourceCommand.js +36 -0
  15. package/dist-cjs/commands/UpdateAppMonitorCommand.js +36 -0
  16. package/dist-cjs/commands/index.js +13 -0
  17. package/dist-cjs/endpoints.js +130 -0
  18. package/dist-cjs/index.js +8 -0
  19. package/dist-cjs/models/index.js +4 -0
  20. package/dist-cjs/models/models_0.js +237 -0
  21. package/dist-cjs/pagination/GetAppMonitorDataPaginator.js +35 -0
  22. package/dist-cjs/pagination/Interfaces.js +2 -0
  23. package/dist-cjs/pagination/ListAppMonitorsPaginator.js +35 -0
  24. package/dist-cjs/pagination/index.js +6 -0
  25. package/dist-cjs/protocols/Aws_restJson1.js +1502 -0
  26. package/dist-cjs/runtimeConfig.browser.js +40 -0
  27. package/dist-cjs/runtimeConfig.js +44 -0
  28. package/dist-cjs/runtimeConfig.native.js +16 -0
  29. package/dist-cjs/runtimeConfig.shared.js +17 -0
  30. package/dist-es/RUM.js +160 -0
  31. package/dist-es/RUMClient.js +37 -0
  32. package/dist-es/commands/CreateAppMonitorCommand.js +39 -0
  33. package/dist-es/commands/DeleteAppMonitorCommand.js +39 -0
  34. package/dist-es/commands/GetAppMonitorCommand.js +39 -0
  35. package/dist-es/commands/GetAppMonitorDataCommand.js +39 -0
  36. package/dist-es/commands/ListAppMonitorsCommand.js +39 -0
  37. package/dist-es/commands/ListTagsForResourceCommand.js +39 -0
  38. package/dist-es/commands/PutRumEventsCommand.js +39 -0
  39. package/dist-es/commands/TagResourceCommand.js +39 -0
  40. package/dist-es/commands/UntagResourceCommand.js +39 -0
  41. package/dist-es/commands/UpdateAppMonitorCommand.js +39 -0
  42. package/dist-es/commands/index.js +10 -0
  43. package/dist-es/endpoints.js +126 -0
  44. package/dist-es/index.js +5 -0
  45. package/dist-es/models/index.js +1 -0
  46. package/dist-es/models/models_0.js +161 -0
  47. package/dist-es/pagination/GetAppMonitorDataPaginator.js +74 -0
  48. package/dist-es/pagination/Interfaces.js +1 -0
  49. package/dist-es/pagination/ListAppMonitorsPaginator.js +74 -0
  50. package/dist-es/pagination/index.js +3 -0
  51. package/dist-es/protocols/Aws_restJson1.js +1652 -0
  52. package/dist-es/runtimeConfig.browser.js +17 -0
  53. package/dist-es/runtimeConfig.js +21 -0
  54. package/dist-es/runtimeConfig.native.js +8 -0
  55. package/dist-es/runtimeConfig.shared.js +13 -0
  56. package/dist-types/RUM.d.ts +120 -0
  57. package/dist-types/RUMClient.d.ts +158 -0
  58. package/dist-types/commands/CreateAppMonitorCommand.d.ts +43 -0
  59. package/dist-types/commands/DeleteAppMonitorCommand.d.ts +35 -0
  60. package/dist-types/commands/GetAppMonitorCommand.d.ts +35 -0
  61. package/dist-types/commands/GetAppMonitorDataCommand.d.ts +36 -0
  62. package/dist-types/commands/ListAppMonitorsCommand.d.ts +35 -0
  63. package/dist-types/commands/ListTagsForResourceCommand.d.ts +35 -0
  64. package/dist-types/commands/PutRumEventsCommand.d.ts +38 -0
  65. package/dist-types/commands/TagResourceCommand.d.ts +48 -0
  66. package/dist-types/commands/UntagResourceCommand.d.ts +35 -0
  67. package/dist-types/commands/UpdateAppMonitorCommand.d.ts +45 -0
  68. package/dist-types/commands/index.d.ts +10 -0
  69. package/dist-types/endpoints.d.ts +2 -0
  70. package/dist-types/index.d.ts +5 -0
  71. package/dist-types/models/index.d.ts +1 -0
  72. package/dist-types/models/models_0.d.ts +824 -0
  73. package/dist-types/pagination/GetAppMonitorDataPaginator.d.ts +4 -0
  74. package/dist-types/pagination/Interfaces.d.ts +6 -0
  75. package/dist-types/pagination/ListAppMonitorsPaginator.d.ts +4 -0
  76. package/dist-types/pagination/index.d.ts +3 -0
  77. package/dist-types/protocols/Aws_restJson1.d.ts +32 -0
  78. package/dist-types/runtimeConfig.browser.d.ts +39 -0
  79. package/dist-types/runtimeConfig.d.ts +39 -0
  80. package/dist-types/runtimeConfig.native.d.ts +38 -0
  81. package/dist-types/runtimeConfig.shared.d.ts +13 -0
  82. package/dist-types/ts3.4/RUM.d.ts +55 -0
  83. package/dist-types/ts3.4/RUMClient.d.ts +81 -0
  84. package/dist-types/ts3.4/commands/CreateAppMonitorCommand.d.ts +17 -0
  85. package/dist-types/ts3.4/commands/DeleteAppMonitorCommand.d.ts +17 -0
  86. package/dist-types/ts3.4/commands/GetAppMonitorCommand.d.ts +17 -0
  87. package/dist-types/ts3.4/commands/GetAppMonitorDataCommand.d.ts +17 -0
  88. package/dist-types/ts3.4/commands/ListAppMonitorsCommand.d.ts +17 -0
  89. package/dist-types/ts3.4/commands/ListTagsForResourceCommand.d.ts +17 -0
  90. package/dist-types/ts3.4/commands/PutRumEventsCommand.d.ts +17 -0
  91. package/dist-types/ts3.4/commands/TagResourceCommand.d.ts +17 -0
  92. package/dist-types/ts3.4/commands/UntagResourceCommand.d.ts +17 -0
  93. package/dist-types/ts3.4/commands/UpdateAppMonitorCommand.d.ts +17 -0
  94. package/dist-types/ts3.4/commands/index.d.ts +10 -0
  95. package/dist-types/ts3.4/endpoints.d.ts +2 -0
  96. package/dist-types/ts3.4/index.d.ts +5 -0
  97. package/dist-types/ts3.4/models/index.d.ts +1 -0
  98. package/dist-types/ts3.4/models/models_0.d.ts +455 -0
  99. package/dist-types/ts3.4/pagination/GetAppMonitorDataPaginator.d.ts +4 -0
  100. package/dist-types/ts3.4/pagination/Interfaces.d.ts +6 -0
  101. package/dist-types/ts3.4/pagination/ListAppMonitorsPaginator.d.ts +4 -0
  102. package/dist-types/ts3.4/pagination/index.d.ts +3 -0
  103. package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +32 -0
  104. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +37 -0
  105. package/dist-types/ts3.4/runtimeConfig.d.ts +37 -0
  106. package/dist-types/ts3.4/runtimeConfig.native.d.ts +36 -0
  107. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +11 -0
  108. package/package.json +94 -0
@@ -0,0 +1,1502 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deserializeAws_restJson1UpdateAppMonitorCommand = exports.deserializeAws_restJson1UntagResourceCommand = exports.deserializeAws_restJson1TagResourceCommand = exports.deserializeAws_restJson1PutRumEventsCommand = exports.deserializeAws_restJson1ListTagsForResourceCommand = exports.deserializeAws_restJson1ListAppMonitorsCommand = exports.deserializeAws_restJson1GetAppMonitorDataCommand = exports.deserializeAws_restJson1GetAppMonitorCommand = exports.deserializeAws_restJson1DeleteAppMonitorCommand = exports.deserializeAws_restJson1CreateAppMonitorCommand = exports.serializeAws_restJson1UpdateAppMonitorCommand = exports.serializeAws_restJson1UntagResourceCommand = exports.serializeAws_restJson1TagResourceCommand = exports.serializeAws_restJson1PutRumEventsCommand = exports.serializeAws_restJson1ListTagsForResourceCommand = exports.serializeAws_restJson1ListAppMonitorsCommand = exports.serializeAws_restJson1GetAppMonitorDataCommand = exports.serializeAws_restJson1GetAppMonitorCommand = exports.serializeAws_restJson1DeleteAppMonitorCommand = exports.serializeAws_restJson1CreateAppMonitorCommand = void 0;
4
+ const protocol_http_1 = require("@aws-sdk/protocol-http");
5
+ const smithy_client_1 = require("@aws-sdk/smithy-client");
6
+ const serializeAws_restJson1CreateAppMonitorCommand = async (input, context) => {
7
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
8
+ const headers = {
9
+ "content-type": "application/json",
10
+ };
11
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/appmonitor";
12
+ let body;
13
+ body = JSON.stringify({
14
+ ...(input.AppMonitorConfiguration !== undefined &&
15
+ input.AppMonitorConfiguration !== null && {
16
+ AppMonitorConfiguration: serializeAws_restJson1AppMonitorConfiguration(input.AppMonitorConfiguration, context),
17
+ }),
18
+ ...(input.CwLogEnabled !== undefined && input.CwLogEnabled !== null && { CwLogEnabled: input.CwLogEnabled }),
19
+ ...(input.Domain !== undefined && input.Domain !== null && { Domain: input.Domain }),
20
+ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }),
21
+ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }),
22
+ });
23
+ return new protocol_http_1.HttpRequest({
24
+ protocol,
25
+ hostname,
26
+ port,
27
+ method: "POST",
28
+ headers,
29
+ path: resolvedPath,
30
+ body,
31
+ });
32
+ };
33
+ exports.serializeAws_restJson1CreateAppMonitorCommand = serializeAws_restJson1CreateAppMonitorCommand;
34
+ const serializeAws_restJson1DeleteAppMonitorCommand = async (input, context) => {
35
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
36
+ const headers = {};
37
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/appmonitor/{Name}";
38
+ if (input.Name !== undefined) {
39
+ const labelValue = input.Name;
40
+ if (labelValue.length <= 0) {
41
+ throw new Error("Empty value provided for input HTTP label: Name.");
42
+ }
43
+ resolvedPath = resolvedPath.replace("{Name}", smithy_client_1.extendedEncodeURIComponent(labelValue));
44
+ }
45
+ else {
46
+ throw new Error("No value provided for input HTTP label: Name.");
47
+ }
48
+ let body;
49
+ return new protocol_http_1.HttpRequest({
50
+ protocol,
51
+ hostname,
52
+ port,
53
+ method: "DELETE",
54
+ headers,
55
+ path: resolvedPath,
56
+ body,
57
+ });
58
+ };
59
+ exports.serializeAws_restJson1DeleteAppMonitorCommand = serializeAws_restJson1DeleteAppMonitorCommand;
60
+ const serializeAws_restJson1GetAppMonitorCommand = async (input, context) => {
61
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
62
+ const headers = {};
63
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/appmonitor/{Name}";
64
+ if (input.Name !== undefined) {
65
+ const labelValue = input.Name;
66
+ if (labelValue.length <= 0) {
67
+ throw new Error("Empty value provided for input HTTP label: Name.");
68
+ }
69
+ resolvedPath = resolvedPath.replace("{Name}", smithy_client_1.extendedEncodeURIComponent(labelValue));
70
+ }
71
+ else {
72
+ throw new Error("No value provided for input HTTP label: Name.");
73
+ }
74
+ let body;
75
+ return new protocol_http_1.HttpRequest({
76
+ protocol,
77
+ hostname,
78
+ port,
79
+ method: "GET",
80
+ headers,
81
+ path: resolvedPath,
82
+ body,
83
+ });
84
+ };
85
+ exports.serializeAws_restJson1GetAppMonitorCommand = serializeAws_restJson1GetAppMonitorCommand;
86
+ const serializeAws_restJson1GetAppMonitorDataCommand = async (input, context) => {
87
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
88
+ const headers = {
89
+ "content-type": "application/json",
90
+ };
91
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/appmonitor/{Name}/data";
92
+ if (input.Name !== undefined) {
93
+ const labelValue = input.Name;
94
+ if (labelValue.length <= 0) {
95
+ throw new Error("Empty value provided for input HTTP label: Name.");
96
+ }
97
+ resolvedPath = resolvedPath.replace("{Name}", smithy_client_1.extendedEncodeURIComponent(labelValue));
98
+ }
99
+ else {
100
+ throw new Error("No value provided for input HTTP label: Name.");
101
+ }
102
+ let body;
103
+ body = JSON.stringify({
104
+ ...(input.Filters !== undefined &&
105
+ input.Filters !== null && { Filters: serializeAws_restJson1QueryFilters(input.Filters, context) }),
106
+ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }),
107
+ ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }),
108
+ ...(input.TimeRange !== undefined &&
109
+ input.TimeRange !== null && { TimeRange: serializeAws_restJson1TimeRange(input.TimeRange, context) }),
110
+ });
111
+ return new protocol_http_1.HttpRequest({
112
+ protocol,
113
+ hostname,
114
+ port,
115
+ method: "POST",
116
+ headers,
117
+ path: resolvedPath,
118
+ body,
119
+ });
120
+ };
121
+ exports.serializeAws_restJson1GetAppMonitorDataCommand = serializeAws_restJson1GetAppMonitorDataCommand;
122
+ const serializeAws_restJson1ListAppMonitorsCommand = async (input, context) => {
123
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
124
+ const headers = {};
125
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/appmonitors";
126
+ const query = {
127
+ ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
128
+ ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
129
+ };
130
+ let body;
131
+ return new protocol_http_1.HttpRequest({
132
+ protocol,
133
+ hostname,
134
+ port,
135
+ method: "POST",
136
+ headers,
137
+ path: resolvedPath,
138
+ query,
139
+ body,
140
+ });
141
+ };
142
+ exports.serializeAws_restJson1ListAppMonitorsCommand = serializeAws_restJson1ListAppMonitorsCommand;
143
+ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context) => {
144
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
145
+ const headers = {};
146
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
147
+ if (input.ResourceArn !== undefined) {
148
+ const labelValue = input.ResourceArn;
149
+ if (labelValue.length <= 0) {
150
+ throw new Error("Empty value provided for input HTTP label: ResourceArn.");
151
+ }
152
+ resolvedPath = resolvedPath.replace("{ResourceArn}", smithy_client_1.extendedEncodeURIComponent(labelValue));
153
+ }
154
+ else {
155
+ throw new Error("No value provided for input HTTP label: ResourceArn.");
156
+ }
157
+ let body;
158
+ return new protocol_http_1.HttpRequest({
159
+ protocol,
160
+ hostname,
161
+ port,
162
+ method: "GET",
163
+ headers,
164
+ path: resolvedPath,
165
+ body,
166
+ });
167
+ };
168
+ exports.serializeAws_restJson1ListTagsForResourceCommand = serializeAws_restJson1ListTagsForResourceCommand;
169
+ const serializeAws_restJson1PutRumEventsCommand = async (input, context) => {
170
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
171
+ const headers = {
172
+ "content-type": "application/json",
173
+ };
174
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/appmonitors/{Id}";
175
+ if (input.Id !== undefined) {
176
+ const labelValue = input.Id;
177
+ if (labelValue.length <= 0) {
178
+ throw new Error("Empty value provided for input HTTP label: Id.");
179
+ }
180
+ resolvedPath = resolvedPath.replace("{Id}", smithy_client_1.extendedEncodeURIComponent(labelValue));
181
+ }
182
+ else {
183
+ throw new Error("No value provided for input HTTP label: Id.");
184
+ }
185
+ let body;
186
+ body = JSON.stringify({
187
+ ...(input.AppMonitorDetails !== undefined &&
188
+ input.AppMonitorDetails !== null && {
189
+ AppMonitorDetails: serializeAws_restJson1AppMonitorDetails(input.AppMonitorDetails, context),
190
+ }),
191
+ ...(input.BatchId !== undefined && input.BatchId !== null && { BatchId: input.BatchId }),
192
+ ...(input.RumEvents !== undefined &&
193
+ input.RumEvents !== null && { RumEvents: serializeAws_restJson1RumEventList(input.RumEvents, context) }),
194
+ ...(input.UserDetails !== undefined &&
195
+ input.UserDetails !== null && { UserDetails: serializeAws_restJson1UserDetails(input.UserDetails, context) }),
196
+ });
197
+ let { hostname: resolvedHostname } = await context.endpoint();
198
+ if (context.disableHostPrefix !== true) {
199
+ resolvedHostname = "dataplane." + resolvedHostname;
200
+ if (!protocol_http_1.isValidHostname(resolvedHostname)) {
201
+ throw new Error("ValidationError: prefixed hostname must be hostname compatible.");
202
+ }
203
+ }
204
+ return new protocol_http_1.HttpRequest({
205
+ protocol,
206
+ hostname: resolvedHostname,
207
+ port,
208
+ method: "POST",
209
+ headers,
210
+ path: resolvedPath,
211
+ body,
212
+ });
213
+ };
214
+ exports.serializeAws_restJson1PutRumEventsCommand = serializeAws_restJson1PutRumEventsCommand;
215
+ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
216
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
217
+ const headers = {
218
+ "content-type": "application/json",
219
+ };
220
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
221
+ if (input.ResourceArn !== undefined) {
222
+ const labelValue = input.ResourceArn;
223
+ if (labelValue.length <= 0) {
224
+ throw new Error("Empty value provided for input HTTP label: ResourceArn.");
225
+ }
226
+ resolvedPath = resolvedPath.replace("{ResourceArn}", smithy_client_1.extendedEncodeURIComponent(labelValue));
227
+ }
228
+ else {
229
+ throw new Error("No value provided for input HTTP label: ResourceArn.");
230
+ }
231
+ let body;
232
+ body = JSON.stringify({
233
+ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }),
234
+ });
235
+ return new protocol_http_1.HttpRequest({
236
+ protocol,
237
+ hostname,
238
+ port,
239
+ method: "POST",
240
+ headers,
241
+ path: resolvedPath,
242
+ body,
243
+ });
244
+ };
245
+ exports.serializeAws_restJson1TagResourceCommand = serializeAws_restJson1TagResourceCommand;
246
+ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
247
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
248
+ const headers = {};
249
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
250
+ if (input.ResourceArn !== undefined) {
251
+ const labelValue = input.ResourceArn;
252
+ if (labelValue.length <= 0) {
253
+ throw new Error("Empty value provided for input HTTP label: ResourceArn.");
254
+ }
255
+ resolvedPath = resolvedPath.replace("{ResourceArn}", smithy_client_1.extendedEncodeURIComponent(labelValue));
256
+ }
257
+ else {
258
+ throw new Error("No value provided for input HTTP label: ResourceArn.");
259
+ }
260
+ const query = {
261
+ ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }),
262
+ };
263
+ let body;
264
+ return new protocol_http_1.HttpRequest({
265
+ protocol,
266
+ hostname,
267
+ port,
268
+ method: "DELETE",
269
+ headers,
270
+ path: resolvedPath,
271
+ query,
272
+ body,
273
+ });
274
+ };
275
+ exports.serializeAws_restJson1UntagResourceCommand = serializeAws_restJson1UntagResourceCommand;
276
+ const serializeAws_restJson1UpdateAppMonitorCommand = async (input, context) => {
277
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
278
+ const headers = {
279
+ "content-type": "application/json",
280
+ };
281
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/appmonitor/{Name}";
282
+ if (input.Name !== undefined) {
283
+ const labelValue = input.Name;
284
+ if (labelValue.length <= 0) {
285
+ throw new Error("Empty value provided for input HTTP label: Name.");
286
+ }
287
+ resolvedPath = resolvedPath.replace("{Name}", smithy_client_1.extendedEncodeURIComponent(labelValue));
288
+ }
289
+ else {
290
+ throw new Error("No value provided for input HTTP label: Name.");
291
+ }
292
+ let body;
293
+ body = JSON.stringify({
294
+ ...(input.AppMonitorConfiguration !== undefined &&
295
+ input.AppMonitorConfiguration !== null && {
296
+ AppMonitorConfiguration: serializeAws_restJson1AppMonitorConfiguration(input.AppMonitorConfiguration, context),
297
+ }),
298
+ ...(input.CwLogEnabled !== undefined && input.CwLogEnabled !== null && { CwLogEnabled: input.CwLogEnabled }),
299
+ ...(input.Domain !== undefined && input.Domain !== null && { Domain: input.Domain }),
300
+ });
301
+ return new protocol_http_1.HttpRequest({
302
+ protocol,
303
+ hostname,
304
+ port,
305
+ method: "PATCH",
306
+ headers,
307
+ path: resolvedPath,
308
+ body,
309
+ });
310
+ };
311
+ exports.serializeAws_restJson1UpdateAppMonitorCommand = serializeAws_restJson1UpdateAppMonitorCommand;
312
+ const deserializeAws_restJson1CreateAppMonitorCommand = async (output, context) => {
313
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
314
+ return deserializeAws_restJson1CreateAppMonitorCommandError(output, context);
315
+ }
316
+ const contents = {
317
+ $metadata: deserializeMetadata(output),
318
+ Id: undefined,
319
+ };
320
+ const data = smithy_client_1.expectNonNull(smithy_client_1.expectObject(await parseBody(output.body, context)), "body");
321
+ if (data.Id !== undefined && data.Id !== null) {
322
+ contents.Id = smithy_client_1.expectString(data.Id);
323
+ }
324
+ return Promise.resolve(contents);
325
+ };
326
+ exports.deserializeAws_restJson1CreateAppMonitorCommand = deserializeAws_restJson1CreateAppMonitorCommand;
327
+ const deserializeAws_restJson1CreateAppMonitorCommandError = async (output, context) => {
328
+ const parsedOutput = {
329
+ ...output,
330
+ body: await parseBody(output.body, context),
331
+ };
332
+ let response;
333
+ let errorCode = "UnknownError";
334
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
335
+ switch (errorCode) {
336
+ case "AccessDeniedException":
337
+ case "com.amazonaws.rum#AccessDeniedException":
338
+ response = {
339
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
340
+ name: errorCode,
341
+ $metadata: deserializeMetadata(output),
342
+ };
343
+ break;
344
+ case "ConflictException":
345
+ case "com.amazonaws.rum#ConflictException":
346
+ response = {
347
+ ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
348
+ name: errorCode,
349
+ $metadata: deserializeMetadata(output),
350
+ };
351
+ break;
352
+ case "InternalServerException":
353
+ case "com.amazonaws.rum#InternalServerException":
354
+ response = {
355
+ ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
356
+ name: errorCode,
357
+ $metadata: deserializeMetadata(output),
358
+ };
359
+ break;
360
+ case "ServiceQuotaExceededException":
361
+ case "com.amazonaws.rum#ServiceQuotaExceededException":
362
+ response = {
363
+ ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
364
+ name: errorCode,
365
+ $metadata: deserializeMetadata(output),
366
+ };
367
+ break;
368
+ case "ThrottlingException":
369
+ case "com.amazonaws.rum#ThrottlingException":
370
+ response = {
371
+ ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
372
+ name: errorCode,
373
+ $metadata: deserializeMetadata(output),
374
+ };
375
+ break;
376
+ case "ValidationException":
377
+ case "com.amazonaws.rum#ValidationException":
378
+ response = {
379
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
380
+ name: errorCode,
381
+ $metadata: deserializeMetadata(output),
382
+ };
383
+ break;
384
+ default:
385
+ const parsedBody = parsedOutput.body;
386
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
387
+ response = {
388
+ ...parsedBody,
389
+ name: `${errorCode}`,
390
+ message: parsedBody.message || parsedBody.Message || errorCode,
391
+ $fault: "client",
392
+ $metadata: deserializeMetadata(output),
393
+ };
394
+ }
395
+ const message = response.message || response.Message || errorCode;
396
+ response.message = message;
397
+ delete response.Message;
398
+ return Promise.reject(Object.assign(new Error(message), response));
399
+ };
400
+ const deserializeAws_restJson1DeleteAppMonitorCommand = async (output, context) => {
401
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
402
+ return deserializeAws_restJson1DeleteAppMonitorCommandError(output, context);
403
+ }
404
+ const contents = {
405
+ $metadata: deserializeMetadata(output),
406
+ };
407
+ await collectBody(output.body, context);
408
+ return Promise.resolve(contents);
409
+ };
410
+ exports.deserializeAws_restJson1DeleteAppMonitorCommand = deserializeAws_restJson1DeleteAppMonitorCommand;
411
+ const deserializeAws_restJson1DeleteAppMonitorCommandError = async (output, context) => {
412
+ const parsedOutput = {
413
+ ...output,
414
+ body: await parseBody(output.body, context),
415
+ };
416
+ let response;
417
+ let errorCode = "UnknownError";
418
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
419
+ switch (errorCode) {
420
+ case "AccessDeniedException":
421
+ case "com.amazonaws.rum#AccessDeniedException":
422
+ response = {
423
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
424
+ name: errorCode,
425
+ $metadata: deserializeMetadata(output),
426
+ };
427
+ break;
428
+ case "ConflictException":
429
+ case "com.amazonaws.rum#ConflictException":
430
+ response = {
431
+ ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
432
+ name: errorCode,
433
+ $metadata: deserializeMetadata(output),
434
+ };
435
+ break;
436
+ case "InternalServerException":
437
+ case "com.amazonaws.rum#InternalServerException":
438
+ response = {
439
+ ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
440
+ name: errorCode,
441
+ $metadata: deserializeMetadata(output),
442
+ };
443
+ break;
444
+ case "ResourceNotFoundException":
445
+ case "com.amazonaws.rum#ResourceNotFoundException":
446
+ response = {
447
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
448
+ name: errorCode,
449
+ $metadata: deserializeMetadata(output),
450
+ };
451
+ break;
452
+ case "ThrottlingException":
453
+ case "com.amazonaws.rum#ThrottlingException":
454
+ response = {
455
+ ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
456
+ name: errorCode,
457
+ $metadata: deserializeMetadata(output),
458
+ };
459
+ break;
460
+ case "ValidationException":
461
+ case "com.amazonaws.rum#ValidationException":
462
+ response = {
463
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
464
+ name: errorCode,
465
+ $metadata: deserializeMetadata(output),
466
+ };
467
+ break;
468
+ default:
469
+ const parsedBody = parsedOutput.body;
470
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
471
+ response = {
472
+ ...parsedBody,
473
+ name: `${errorCode}`,
474
+ message: parsedBody.message || parsedBody.Message || errorCode,
475
+ $fault: "client",
476
+ $metadata: deserializeMetadata(output),
477
+ };
478
+ }
479
+ const message = response.message || response.Message || errorCode;
480
+ response.message = message;
481
+ delete response.Message;
482
+ return Promise.reject(Object.assign(new Error(message), response));
483
+ };
484
+ const deserializeAws_restJson1GetAppMonitorCommand = async (output, context) => {
485
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
486
+ return deserializeAws_restJson1GetAppMonitorCommandError(output, context);
487
+ }
488
+ const contents = {
489
+ $metadata: deserializeMetadata(output),
490
+ AppMonitor: undefined,
491
+ };
492
+ const data = smithy_client_1.expectNonNull(smithy_client_1.expectObject(await parseBody(output.body, context)), "body");
493
+ if (data.AppMonitor !== undefined && data.AppMonitor !== null) {
494
+ contents.AppMonitor = deserializeAws_restJson1AppMonitor(data.AppMonitor, context);
495
+ }
496
+ return Promise.resolve(contents);
497
+ };
498
+ exports.deserializeAws_restJson1GetAppMonitorCommand = deserializeAws_restJson1GetAppMonitorCommand;
499
+ const deserializeAws_restJson1GetAppMonitorCommandError = async (output, context) => {
500
+ const parsedOutput = {
501
+ ...output,
502
+ body: await parseBody(output.body, context),
503
+ };
504
+ let response;
505
+ let errorCode = "UnknownError";
506
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
507
+ switch (errorCode) {
508
+ case "AccessDeniedException":
509
+ case "com.amazonaws.rum#AccessDeniedException":
510
+ response = {
511
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
512
+ name: errorCode,
513
+ $metadata: deserializeMetadata(output),
514
+ };
515
+ break;
516
+ case "InternalServerException":
517
+ case "com.amazonaws.rum#InternalServerException":
518
+ response = {
519
+ ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
520
+ name: errorCode,
521
+ $metadata: deserializeMetadata(output),
522
+ };
523
+ break;
524
+ case "ResourceNotFoundException":
525
+ case "com.amazonaws.rum#ResourceNotFoundException":
526
+ response = {
527
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
528
+ name: errorCode,
529
+ $metadata: deserializeMetadata(output),
530
+ };
531
+ break;
532
+ case "ThrottlingException":
533
+ case "com.amazonaws.rum#ThrottlingException":
534
+ response = {
535
+ ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
536
+ name: errorCode,
537
+ $metadata: deserializeMetadata(output),
538
+ };
539
+ break;
540
+ case "ValidationException":
541
+ case "com.amazonaws.rum#ValidationException":
542
+ response = {
543
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
544
+ name: errorCode,
545
+ $metadata: deserializeMetadata(output),
546
+ };
547
+ break;
548
+ default:
549
+ const parsedBody = parsedOutput.body;
550
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
551
+ response = {
552
+ ...parsedBody,
553
+ name: `${errorCode}`,
554
+ message: parsedBody.message || parsedBody.Message || errorCode,
555
+ $fault: "client",
556
+ $metadata: deserializeMetadata(output),
557
+ };
558
+ }
559
+ const message = response.message || response.Message || errorCode;
560
+ response.message = message;
561
+ delete response.Message;
562
+ return Promise.reject(Object.assign(new Error(message), response));
563
+ };
564
+ const deserializeAws_restJson1GetAppMonitorDataCommand = async (output, context) => {
565
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
566
+ return deserializeAws_restJson1GetAppMonitorDataCommandError(output, context);
567
+ }
568
+ const contents = {
569
+ $metadata: deserializeMetadata(output),
570
+ Events: undefined,
571
+ NextToken: undefined,
572
+ };
573
+ const data = smithy_client_1.expectNonNull(smithy_client_1.expectObject(await parseBody(output.body, context)), "body");
574
+ if (data.Events !== undefined && data.Events !== null) {
575
+ contents.Events = deserializeAws_restJson1EventDataList(data.Events, context);
576
+ }
577
+ if (data.NextToken !== undefined && data.NextToken !== null) {
578
+ contents.NextToken = smithy_client_1.expectString(data.NextToken);
579
+ }
580
+ return Promise.resolve(contents);
581
+ };
582
+ exports.deserializeAws_restJson1GetAppMonitorDataCommand = deserializeAws_restJson1GetAppMonitorDataCommand;
583
+ const deserializeAws_restJson1GetAppMonitorDataCommandError = async (output, context) => {
584
+ const parsedOutput = {
585
+ ...output,
586
+ body: await parseBody(output.body, context),
587
+ };
588
+ let response;
589
+ let errorCode = "UnknownError";
590
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
591
+ switch (errorCode) {
592
+ case "AccessDeniedException":
593
+ case "com.amazonaws.rum#AccessDeniedException":
594
+ response = {
595
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
596
+ name: errorCode,
597
+ $metadata: deserializeMetadata(output),
598
+ };
599
+ break;
600
+ case "InternalServerException":
601
+ case "com.amazonaws.rum#InternalServerException":
602
+ response = {
603
+ ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
604
+ name: errorCode,
605
+ $metadata: deserializeMetadata(output),
606
+ };
607
+ break;
608
+ case "ResourceNotFoundException":
609
+ case "com.amazonaws.rum#ResourceNotFoundException":
610
+ response = {
611
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
612
+ name: errorCode,
613
+ $metadata: deserializeMetadata(output),
614
+ };
615
+ break;
616
+ case "ThrottlingException":
617
+ case "com.amazonaws.rum#ThrottlingException":
618
+ response = {
619
+ ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
620
+ name: errorCode,
621
+ $metadata: deserializeMetadata(output),
622
+ };
623
+ break;
624
+ case "ValidationException":
625
+ case "com.amazonaws.rum#ValidationException":
626
+ response = {
627
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
628
+ name: errorCode,
629
+ $metadata: deserializeMetadata(output),
630
+ };
631
+ break;
632
+ default:
633
+ const parsedBody = parsedOutput.body;
634
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
635
+ response = {
636
+ ...parsedBody,
637
+ name: `${errorCode}`,
638
+ message: parsedBody.message || parsedBody.Message || errorCode,
639
+ $fault: "client",
640
+ $metadata: deserializeMetadata(output),
641
+ };
642
+ }
643
+ const message = response.message || response.Message || errorCode;
644
+ response.message = message;
645
+ delete response.Message;
646
+ return Promise.reject(Object.assign(new Error(message), response));
647
+ };
648
+ const deserializeAws_restJson1ListAppMonitorsCommand = async (output, context) => {
649
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
650
+ return deserializeAws_restJson1ListAppMonitorsCommandError(output, context);
651
+ }
652
+ const contents = {
653
+ $metadata: deserializeMetadata(output),
654
+ AppMonitorSummaries: undefined,
655
+ NextToken: undefined,
656
+ };
657
+ const data = smithy_client_1.expectNonNull(smithy_client_1.expectObject(await parseBody(output.body, context)), "body");
658
+ if (data.AppMonitorSummaries !== undefined && data.AppMonitorSummaries !== null) {
659
+ contents.AppMonitorSummaries = deserializeAws_restJson1AppMonitorSummaryList(data.AppMonitorSummaries, context);
660
+ }
661
+ if (data.NextToken !== undefined && data.NextToken !== null) {
662
+ contents.NextToken = smithy_client_1.expectString(data.NextToken);
663
+ }
664
+ return Promise.resolve(contents);
665
+ };
666
+ exports.deserializeAws_restJson1ListAppMonitorsCommand = deserializeAws_restJson1ListAppMonitorsCommand;
667
+ const deserializeAws_restJson1ListAppMonitorsCommandError = async (output, context) => {
668
+ const parsedOutput = {
669
+ ...output,
670
+ body: await parseBody(output.body, context),
671
+ };
672
+ let response;
673
+ let errorCode = "UnknownError";
674
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
675
+ switch (errorCode) {
676
+ case "AccessDeniedException":
677
+ case "com.amazonaws.rum#AccessDeniedException":
678
+ response = {
679
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
680
+ name: errorCode,
681
+ $metadata: deserializeMetadata(output),
682
+ };
683
+ break;
684
+ case "InternalServerException":
685
+ case "com.amazonaws.rum#InternalServerException":
686
+ response = {
687
+ ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
688
+ name: errorCode,
689
+ $metadata: deserializeMetadata(output),
690
+ };
691
+ break;
692
+ case "ThrottlingException":
693
+ case "com.amazonaws.rum#ThrottlingException":
694
+ response = {
695
+ ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
696
+ name: errorCode,
697
+ $metadata: deserializeMetadata(output),
698
+ };
699
+ break;
700
+ case "ValidationException":
701
+ case "com.amazonaws.rum#ValidationException":
702
+ response = {
703
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
704
+ name: errorCode,
705
+ $metadata: deserializeMetadata(output),
706
+ };
707
+ break;
708
+ default:
709
+ const parsedBody = parsedOutput.body;
710
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
711
+ response = {
712
+ ...parsedBody,
713
+ name: `${errorCode}`,
714
+ message: parsedBody.message || parsedBody.Message || errorCode,
715
+ $fault: "client",
716
+ $metadata: deserializeMetadata(output),
717
+ };
718
+ }
719
+ const message = response.message || response.Message || errorCode;
720
+ response.message = message;
721
+ delete response.Message;
722
+ return Promise.reject(Object.assign(new Error(message), response));
723
+ };
724
+ const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
725
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
726
+ return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
727
+ }
728
+ const contents = {
729
+ $metadata: deserializeMetadata(output),
730
+ ResourceArn: undefined,
731
+ Tags: undefined,
732
+ };
733
+ const data = smithy_client_1.expectNonNull(smithy_client_1.expectObject(await parseBody(output.body, context)), "body");
734
+ if (data.ResourceArn !== undefined && data.ResourceArn !== null) {
735
+ contents.ResourceArn = smithy_client_1.expectString(data.ResourceArn);
736
+ }
737
+ if (data.Tags !== undefined && data.Tags !== null) {
738
+ contents.Tags = deserializeAws_restJson1TagMap(data.Tags, context);
739
+ }
740
+ return Promise.resolve(contents);
741
+ };
742
+ exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
743
+ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
744
+ const parsedOutput = {
745
+ ...output,
746
+ body: await parseBody(output.body, context),
747
+ };
748
+ let response;
749
+ let errorCode = "UnknownError";
750
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
751
+ switch (errorCode) {
752
+ case "InternalServerException":
753
+ case "com.amazonaws.rum#InternalServerException":
754
+ response = {
755
+ ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
756
+ name: errorCode,
757
+ $metadata: deserializeMetadata(output),
758
+ };
759
+ break;
760
+ case "ResourceNotFoundException":
761
+ case "com.amazonaws.rum#ResourceNotFoundException":
762
+ response = {
763
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
764
+ name: errorCode,
765
+ $metadata: deserializeMetadata(output),
766
+ };
767
+ break;
768
+ case "ValidationException":
769
+ case "com.amazonaws.rum#ValidationException":
770
+ response = {
771
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
772
+ name: errorCode,
773
+ $metadata: deserializeMetadata(output),
774
+ };
775
+ break;
776
+ default:
777
+ const parsedBody = parsedOutput.body;
778
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
779
+ response = {
780
+ ...parsedBody,
781
+ name: `${errorCode}`,
782
+ message: parsedBody.message || parsedBody.Message || errorCode,
783
+ $fault: "client",
784
+ $metadata: deserializeMetadata(output),
785
+ };
786
+ }
787
+ const message = response.message || response.Message || errorCode;
788
+ response.message = message;
789
+ delete response.Message;
790
+ return Promise.reject(Object.assign(new Error(message), response));
791
+ };
792
+ const deserializeAws_restJson1PutRumEventsCommand = async (output, context) => {
793
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
794
+ return deserializeAws_restJson1PutRumEventsCommandError(output, context);
795
+ }
796
+ const contents = {
797
+ $metadata: deserializeMetadata(output),
798
+ };
799
+ await collectBody(output.body, context);
800
+ return Promise.resolve(contents);
801
+ };
802
+ exports.deserializeAws_restJson1PutRumEventsCommand = deserializeAws_restJson1PutRumEventsCommand;
803
+ const deserializeAws_restJson1PutRumEventsCommandError = async (output, context) => {
804
+ const parsedOutput = {
805
+ ...output,
806
+ body: await parseBody(output.body, context),
807
+ };
808
+ let response;
809
+ let errorCode = "UnknownError";
810
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
811
+ switch (errorCode) {
812
+ case "AccessDeniedException":
813
+ case "com.amazonaws.rum#AccessDeniedException":
814
+ response = {
815
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
816
+ name: errorCode,
817
+ $metadata: deserializeMetadata(output),
818
+ };
819
+ break;
820
+ case "InternalServerException":
821
+ case "com.amazonaws.rum#InternalServerException":
822
+ response = {
823
+ ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
824
+ name: errorCode,
825
+ $metadata: deserializeMetadata(output),
826
+ };
827
+ break;
828
+ case "ResourceNotFoundException":
829
+ case "com.amazonaws.rum#ResourceNotFoundException":
830
+ response = {
831
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
832
+ name: errorCode,
833
+ $metadata: deserializeMetadata(output),
834
+ };
835
+ break;
836
+ case "ThrottlingException":
837
+ case "com.amazonaws.rum#ThrottlingException":
838
+ response = {
839
+ ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
840
+ name: errorCode,
841
+ $metadata: deserializeMetadata(output),
842
+ };
843
+ break;
844
+ case "ValidationException":
845
+ case "com.amazonaws.rum#ValidationException":
846
+ response = {
847
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
848
+ name: errorCode,
849
+ $metadata: deserializeMetadata(output),
850
+ };
851
+ break;
852
+ default:
853
+ const parsedBody = parsedOutput.body;
854
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
855
+ response = {
856
+ ...parsedBody,
857
+ name: `${errorCode}`,
858
+ message: parsedBody.message || parsedBody.Message || errorCode,
859
+ $fault: "client",
860
+ $metadata: deserializeMetadata(output),
861
+ };
862
+ }
863
+ const message = response.message || response.Message || errorCode;
864
+ response.message = message;
865
+ delete response.Message;
866
+ return Promise.reject(Object.assign(new Error(message), response));
867
+ };
868
+ const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
869
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
870
+ return deserializeAws_restJson1TagResourceCommandError(output, context);
871
+ }
872
+ const contents = {
873
+ $metadata: deserializeMetadata(output),
874
+ };
875
+ await collectBody(output.body, context);
876
+ return Promise.resolve(contents);
877
+ };
878
+ exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
879
+ const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
880
+ const parsedOutput = {
881
+ ...output,
882
+ body: await parseBody(output.body, context),
883
+ };
884
+ let response;
885
+ let errorCode = "UnknownError";
886
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
887
+ switch (errorCode) {
888
+ case "InternalServerException":
889
+ case "com.amazonaws.rum#InternalServerException":
890
+ response = {
891
+ ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
892
+ name: errorCode,
893
+ $metadata: deserializeMetadata(output),
894
+ };
895
+ break;
896
+ case "ResourceNotFoundException":
897
+ case "com.amazonaws.rum#ResourceNotFoundException":
898
+ response = {
899
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
900
+ name: errorCode,
901
+ $metadata: deserializeMetadata(output),
902
+ };
903
+ break;
904
+ case "ValidationException":
905
+ case "com.amazonaws.rum#ValidationException":
906
+ response = {
907
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
908
+ name: errorCode,
909
+ $metadata: deserializeMetadata(output),
910
+ };
911
+ break;
912
+ default:
913
+ const parsedBody = parsedOutput.body;
914
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
915
+ response = {
916
+ ...parsedBody,
917
+ name: `${errorCode}`,
918
+ message: parsedBody.message || parsedBody.Message || errorCode,
919
+ $fault: "client",
920
+ $metadata: deserializeMetadata(output),
921
+ };
922
+ }
923
+ const message = response.message || response.Message || errorCode;
924
+ response.message = message;
925
+ delete response.Message;
926
+ return Promise.reject(Object.assign(new Error(message), response));
927
+ };
928
+ const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
929
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
930
+ return deserializeAws_restJson1UntagResourceCommandError(output, context);
931
+ }
932
+ const contents = {
933
+ $metadata: deserializeMetadata(output),
934
+ };
935
+ await collectBody(output.body, context);
936
+ return Promise.resolve(contents);
937
+ };
938
+ exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
939
+ const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
940
+ const parsedOutput = {
941
+ ...output,
942
+ body: await parseBody(output.body, context),
943
+ };
944
+ let response;
945
+ let errorCode = "UnknownError";
946
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
947
+ switch (errorCode) {
948
+ case "InternalServerException":
949
+ case "com.amazonaws.rum#InternalServerException":
950
+ response = {
951
+ ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
952
+ name: errorCode,
953
+ $metadata: deserializeMetadata(output),
954
+ };
955
+ break;
956
+ case "ResourceNotFoundException":
957
+ case "com.amazonaws.rum#ResourceNotFoundException":
958
+ response = {
959
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
960
+ name: errorCode,
961
+ $metadata: deserializeMetadata(output),
962
+ };
963
+ break;
964
+ case "ValidationException":
965
+ case "com.amazonaws.rum#ValidationException":
966
+ response = {
967
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
968
+ name: errorCode,
969
+ $metadata: deserializeMetadata(output),
970
+ };
971
+ break;
972
+ default:
973
+ const parsedBody = parsedOutput.body;
974
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
975
+ response = {
976
+ ...parsedBody,
977
+ name: `${errorCode}`,
978
+ message: parsedBody.message || parsedBody.Message || errorCode,
979
+ $fault: "client",
980
+ $metadata: deserializeMetadata(output),
981
+ };
982
+ }
983
+ const message = response.message || response.Message || errorCode;
984
+ response.message = message;
985
+ delete response.Message;
986
+ return Promise.reject(Object.assign(new Error(message), response));
987
+ };
988
+ const deserializeAws_restJson1UpdateAppMonitorCommand = async (output, context) => {
989
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
990
+ return deserializeAws_restJson1UpdateAppMonitorCommandError(output, context);
991
+ }
992
+ const contents = {
993
+ $metadata: deserializeMetadata(output),
994
+ };
995
+ await collectBody(output.body, context);
996
+ return Promise.resolve(contents);
997
+ };
998
+ exports.deserializeAws_restJson1UpdateAppMonitorCommand = deserializeAws_restJson1UpdateAppMonitorCommand;
999
+ const deserializeAws_restJson1UpdateAppMonitorCommandError = async (output, context) => {
1000
+ const parsedOutput = {
1001
+ ...output,
1002
+ body: await parseBody(output.body, context),
1003
+ };
1004
+ let response;
1005
+ let errorCode = "UnknownError";
1006
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1007
+ switch (errorCode) {
1008
+ case "AccessDeniedException":
1009
+ case "com.amazonaws.rum#AccessDeniedException":
1010
+ response = {
1011
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1012
+ name: errorCode,
1013
+ $metadata: deserializeMetadata(output),
1014
+ };
1015
+ break;
1016
+ case "ConflictException":
1017
+ case "com.amazonaws.rum#ConflictException":
1018
+ response = {
1019
+ ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
1020
+ name: errorCode,
1021
+ $metadata: deserializeMetadata(output),
1022
+ };
1023
+ break;
1024
+ case "InternalServerException":
1025
+ case "com.amazonaws.rum#InternalServerException":
1026
+ response = {
1027
+ ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1028
+ name: errorCode,
1029
+ $metadata: deserializeMetadata(output),
1030
+ };
1031
+ break;
1032
+ case "ResourceNotFoundException":
1033
+ case "com.amazonaws.rum#ResourceNotFoundException":
1034
+ response = {
1035
+ ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1036
+ name: errorCode,
1037
+ $metadata: deserializeMetadata(output),
1038
+ };
1039
+ break;
1040
+ case "ThrottlingException":
1041
+ case "com.amazonaws.rum#ThrottlingException":
1042
+ response = {
1043
+ ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1044
+ name: errorCode,
1045
+ $metadata: deserializeMetadata(output),
1046
+ };
1047
+ break;
1048
+ case "ValidationException":
1049
+ case "com.amazonaws.rum#ValidationException":
1050
+ response = {
1051
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1052
+ name: errorCode,
1053
+ $metadata: deserializeMetadata(output),
1054
+ };
1055
+ break;
1056
+ default:
1057
+ const parsedBody = parsedOutput.body;
1058
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
1059
+ response = {
1060
+ ...parsedBody,
1061
+ name: `${errorCode}`,
1062
+ message: parsedBody.message || parsedBody.Message || errorCode,
1063
+ $fault: "client",
1064
+ $metadata: deserializeMetadata(output),
1065
+ };
1066
+ }
1067
+ const message = response.message || response.Message || errorCode;
1068
+ response.message = message;
1069
+ delete response.Message;
1070
+ return Promise.reject(Object.assign(new Error(message), response));
1071
+ };
1072
+ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
1073
+ const contents = {
1074
+ name: "AccessDeniedException",
1075
+ $fault: "client",
1076
+ $metadata: deserializeMetadata(parsedOutput),
1077
+ message: undefined,
1078
+ };
1079
+ const data = parsedOutput.body;
1080
+ if (data.message !== undefined && data.message !== null) {
1081
+ contents.message = smithy_client_1.expectString(data.message);
1082
+ }
1083
+ return contents;
1084
+ };
1085
+ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
1086
+ const contents = {
1087
+ name: "ConflictException",
1088
+ $fault: "client",
1089
+ $metadata: deserializeMetadata(parsedOutput),
1090
+ message: undefined,
1091
+ resourceName: undefined,
1092
+ resourceType: undefined,
1093
+ };
1094
+ const data = parsedOutput.body;
1095
+ if (data.message !== undefined && data.message !== null) {
1096
+ contents.message = smithy_client_1.expectString(data.message);
1097
+ }
1098
+ if (data.resourceName !== undefined && data.resourceName !== null) {
1099
+ contents.resourceName = smithy_client_1.expectString(data.resourceName);
1100
+ }
1101
+ if (data.resourceType !== undefined && data.resourceType !== null) {
1102
+ contents.resourceType = smithy_client_1.expectString(data.resourceType);
1103
+ }
1104
+ return contents;
1105
+ };
1106
+ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
1107
+ const contents = {
1108
+ name: "InternalServerException",
1109
+ $fault: "server",
1110
+ $retryable: {},
1111
+ $metadata: deserializeMetadata(parsedOutput),
1112
+ message: undefined,
1113
+ retryAfterSeconds: undefined,
1114
+ };
1115
+ if (parsedOutput.headers["retry-after"] !== undefined) {
1116
+ contents.retryAfterSeconds = smithy_client_1.strictParseInt32(parsedOutput.headers["retry-after"]);
1117
+ }
1118
+ const data = parsedOutput.body;
1119
+ if (data.message !== undefined && data.message !== null) {
1120
+ contents.message = smithy_client_1.expectString(data.message);
1121
+ }
1122
+ return contents;
1123
+ };
1124
+ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1125
+ const contents = {
1126
+ name: "ResourceNotFoundException",
1127
+ $fault: "client",
1128
+ $metadata: deserializeMetadata(parsedOutput),
1129
+ message: undefined,
1130
+ resourceName: undefined,
1131
+ resourceType: undefined,
1132
+ };
1133
+ const data = parsedOutput.body;
1134
+ if (data.message !== undefined && data.message !== null) {
1135
+ contents.message = smithy_client_1.expectString(data.message);
1136
+ }
1137
+ if (data.resourceName !== undefined && data.resourceName !== null) {
1138
+ contents.resourceName = smithy_client_1.expectString(data.resourceName);
1139
+ }
1140
+ if (data.resourceType !== undefined && data.resourceType !== null) {
1141
+ contents.resourceType = smithy_client_1.expectString(data.resourceType);
1142
+ }
1143
+ return contents;
1144
+ };
1145
+ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
1146
+ const contents = {
1147
+ name: "ServiceQuotaExceededException",
1148
+ $fault: "client",
1149
+ $metadata: deserializeMetadata(parsedOutput),
1150
+ message: undefined,
1151
+ };
1152
+ const data = parsedOutput.body;
1153
+ if (data.message !== undefined && data.message !== null) {
1154
+ contents.message = smithy_client_1.expectString(data.message);
1155
+ }
1156
+ return contents;
1157
+ };
1158
+ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
1159
+ const contents = {
1160
+ name: "ThrottlingException",
1161
+ $fault: "client",
1162
+ $retryable: {
1163
+ throttling: true,
1164
+ },
1165
+ $metadata: deserializeMetadata(parsedOutput),
1166
+ message: undefined,
1167
+ quotaCode: undefined,
1168
+ retryAfterSeconds: undefined,
1169
+ serviceCode: undefined,
1170
+ };
1171
+ if (parsedOutput.headers["retry-after"] !== undefined) {
1172
+ contents.retryAfterSeconds = smithy_client_1.strictParseInt32(parsedOutput.headers["retry-after"]);
1173
+ }
1174
+ const data = parsedOutput.body;
1175
+ if (data.message !== undefined && data.message !== null) {
1176
+ contents.message = smithy_client_1.expectString(data.message);
1177
+ }
1178
+ if (data.quotaCode !== undefined && data.quotaCode !== null) {
1179
+ contents.quotaCode = smithy_client_1.expectString(data.quotaCode);
1180
+ }
1181
+ if (data.serviceCode !== undefined && data.serviceCode !== null) {
1182
+ contents.serviceCode = smithy_client_1.expectString(data.serviceCode);
1183
+ }
1184
+ return contents;
1185
+ };
1186
+ const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
1187
+ const contents = {
1188
+ name: "ValidationException",
1189
+ $fault: "client",
1190
+ $metadata: deserializeMetadata(parsedOutput),
1191
+ message: undefined,
1192
+ };
1193
+ const data = parsedOutput.body;
1194
+ if (data.message !== undefined && data.message !== null) {
1195
+ contents.message = smithy_client_1.expectString(data.message);
1196
+ }
1197
+ return contents;
1198
+ };
1199
+ const serializeAws_restJson1AppMonitorConfiguration = (input, context) => {
1200
+ return {
1201
+ ...(input.AllowCookies !== undefined && input.AllowCookies !== null && { AllowCookies: input.AllowCookies }),
1202
+ ...(input.EnableXRay !== undefined && input.EnableXRay !== null && { EnableXRay: input.EnableXRay }),
1203
+ ...(input.ExcludedPages !== undefined &&
1204
+ input.ExcludedPages !== null && { ExcludedPages: serializeAws_restJson1Pages(input.ExcludedPages, context) }),
1205
+ ...(input.FavoritePages !== undefined &&
1206
+ input.FavoritePages !== null && {
1207
+ FavoritePages: serializeAws_restJson1FavoritePages(input.FavoritePages, context),
1208
+ }),
1209
+ ...(input.GuestRoleArn !== undefined && input.GuestRoleArn !== null && { GuestRoleArn: input.GuestRoleArn }),
1210
+ ...(input.IdentityPoolId !== undefined &&
1211
+ input.IdentityPoolId !== null && { IdentityPoolId: input.IdentityPoolId }),
1212
+ ...(input.IncludedPages !== undefined &&
1213
+ input.IncludedPages !== null && { IncludedPages: serializeAws_restJson1Pages(input.IncludedPages, context) }),
1214
+ ...(input.SessionSampleRate !== undefined &&
1215
+ input.SessionSampleRate !== null && { SessionSampleRate: smithy_client_1.serializeFloat(input.SessionSampleRate) }),
1216
+ ...(input.Telemetries !== undefined &&
1217
+ input.Telemetries !== null && { Telemetries: serializeAws_restJson1Telemetries(input.Telemetries, context) }),
1218
+ };
1219
+ };
1220
+ const serializeAws_restJson1AppMonitorDetails = (input, context) => {
1221
+ return {
1222
+ ...(input.id !== undefined && input.id !== null && { id: input.id }),
1223
+ ...(input.name !== undefined && input.name !== null && { name: input.name }),
1224
+ ...(input.version !== undefined && input.version !== null && { version: input.version }),
1225
+ };
1226
+ };
1227
+ const serializeAws_restJson1FavoritePages = (input, context) => {
1228
+ return input
1229
+ .filter((e) => e != null)
1230
+ .map((entry) => {
1231
+ if (entry === null) {
1232
+ return null;
1233
+ }
1234
+ return entry;
1235
+ });
1236
+ };
1237
+ const serializeAws_restJson1Pages = (input, context) => {
1238
+ return input
1239
+ .filter((e) => e != null)
1240
+ .map((entry) => {
1241
+ if (entry === null) {
1242
+ return null;
1243
+ }
1244
+ return entry;
1245
+ });
1246
+ };
1247
+ const serializeAws_restJson1QueryFilter = (input, context) => {
1248
+ return {
1249
+ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }),
1250
+ ...(input.Values !== undefined &&
1251
+ input.Values !== null && { Values: serializeAws_restJson1QueryFilterValueList(input.Values, context) }),
1252
+ };
1253
+ };
1254
+ const serializeAws_restJson1QueryFilters = (input, context) => {
1255
+ return input
1256
+ .filter((e) => e != null)
1257
+ .map((entry) => {
1258
+ if (entry === null) {
1259
+ return null;
1260
+ }
1261
+ return serializeAws_restJson1QueryFilter(entry, context);
1262
+ });
1263
+ };
1264
+ const serializeAws_restJson1QueryFilterValueList = (input, context) => {
1265
+ return input
1266
+ .filter((e) => e != null)
1267
+ .map((entry) => {
1268
+ if (entry === null) {
1269
+ return null;
1270
+ }
1271
+ return entry;
1272
+ });
1273
+ };
1274
+ const serializeAws_restJson1RumEvent = (input, context) => {
1275
+ return {
1276
+ ...(input.details !== undefined &&
1277
+ input.details !== null && { details: smithy_client_1.LazyJsonString.fromObject(input.details) }),
1278
+ ...(input.id !== undefined && input.id !== null && { id: input.id }),
1279
+ ...(input.metadata !== undefined &&
1280
+ input.metadata !== null && { metadata: smithy_client_1.LazyJsonString.fromObject(input.metadata) }),
1281
+ ...(input.timestamp !== undefined &&
1282
+ input.timestamp !== null && { timestamp: Math.round(input.timestamp.getTime() / 1000) }),
1283
+ ...(input.type !== undefined && input.type !== null && { type: input.type }),
1284
+ };
1285
+ };
1286
+ const serializeAws_restJson1RumEventList = (input, context) => {
1287
+ return input
1288
+ .filter((e) => e != null)
1289
+ .map((entry) => {
1290
+ if (entry === null) {
1291
+ return null;
1292
+ }
1293
+ return serializeAws_restJson1RumEvent(entry, context);
1294
+ });
1295
+ };
1296
+ const serializeAws_restJson1TagMap = (input, context) => {
1297
+ return Object.entries(input).reduce((acc, [key, value]) => {
1298
+ if (value === null) {
1299
+ return acc;
1300
+ }
1301
+ return {
1302
+ ...acc,
1303
+ [key]: value,
1304
+ };
1305
+ }, {});
1306
+ };
1307
+ const serializeAws_restJson1Telemetries = (input, context) => {
1308
+ return input
1309
+ .filter((e) => e != null)
1310
+ .map((entry) => {
1311
+ if (entry === null) {
1312
+ return null;
1313
+ }
1314
+ return entry;
1315
+ });
1316
+ };
1317
+ const serializeAws_restJson1TimeRange = (input, context) => {
1318
+ return {
1319
+ ...(input.After !== undefined && input.After !== null && { After: input.After }),
1320
+ ...(input.Before !== undefined && input.Before !== null && { Before: input.Before }),
1321
+ };
1322
+ };
1323
+ const serializeAws_restJson1UserDetails = (input, context) => {
1324
+ return {
1325
+ ...(input.sessionId !== undefined && input.sessionId !== null && { sessionId: input.sessionId }),
1326
+ ...(input.userId !== undefined && input.userId !== null && { userId: input.userId }),
1327
+ };
1328
+ };
1329
+ const deserializeAws_restJson1AppMonitor = (output, context) => {
1330
+ return {
1331
+ AppMonitorConfiguration: output.AppMonitorConfiguration !== undefined && output.AppMonitorConfiguration !== null
1332
+ ? deserializeAws_restJson1AppMonitorConfiguration(output.AppMonitorConfiguration, context)
1333
+ : undefined,
1334
+ Created: smithy_client_1.expectString(output.Created),
1335
+ DataStorage: output.DataStorage !== undefined && output.DataStorage !== null
1336
+ ? deserializeAws_restJson1DataStorage(output.DataStorage, context)
1337
+ : undefined,
1338
+ Domain: smithy_client_1.expectString(output.Domain),
1339
+ Id: smithy_client_1.expectString(output.Id),
1340
+ LastModified: smithy_client_1.expectString(output.LastModified),
1341
+ Name: smithy_client_1.expectString(output.Name),
1342
+ State: smithy_client_1.expectString(output.State),
1343
+ Tags: output.Tags !== undefined && output.Tags !== null
1344
+ ? deserializeAws_restJson1TagMap(output.Tags, context)
1345
+ : undefined,
1346
+ };
1347
+ };
1348
+ const deserializeAws_restJson1AppMonitorConfiguration = (output, context) => {
1349
+ return {
1350
+ AllowCookies: smithy_client_1.expectBoolean(output.AllowCookies),
1351
+ EnableXRay: smithy_client_1.expectBoolean(output.EnableXRay),
1352
+ ExcludedPages: output.ExcludedPages !== undefined && output.ExcludedPages !== null
1353
+ ? deserializeAws_restJson1Pages(output.ExcludedPages, context)
1354
+ : undefined,
1355
+ FavoritePages: output.FavoritePages !== undefined && output.FavoritePages !== null
1356
+ ? deserializeAws_restJson1FavoritePages(output.FavoritePages, context)
1357
+ : undefined,
1358
+ GuestRoleArn: smithy_client_1.expectString(output.GuestRoleArn),
1359
+ IdentityPoolId: smithy_client_1.expectString(output.IdentityPoolId),
1360
+ IncludedPages: output.IncludedPages !== undefined && output.IncludedPages !== null
1361
+ ? deserializeAws_restJson1Pages(output.IncludedPages, context)
1362
+ : undefined,
1363
+ SessionSampleRate: smithy_client_1.limitedParseDouble(output.SessionSampleRate),
1364
+ Telemetries: output.Telemetries !== undefined && output.Telemetries !== null
1365
+ ? deserializeAws_restJson1Telemetries(output.Telemetries, context)
1366
+ : undefined,
1367
+ };
1368
+ };
1369
+ const deserializeAws_restJson1AppMonitorSummary = (output, context) => {
1370
+ return {
1371
+ Created: smithy_client_1.expectString(output.Created),
1372
+ Id: smithy_client_1.expectString(output.Id),
1373
+ LastModified: smithy_client_1.expectString(output.LastModified),
1374
+ Name: smithy_client_1.expectString(output.Name),
1375
+ State: smithy_client_1.expectString(output.State),
1376
+ };
1377
+ };
1378
+ const deserializeAws_restJson1AppMonitorSummaryList = (output, context) => {
1379
+ return (output || [])
1380
+ .filter((e) => e != null)
1381
+ .map((entry) => {
1382
+ if (entry === null) {
1383
+ return null;
1384
+ }
1385
+ return deserializeAws_restJson1AppMonitorSummary(entry, context);
1386
+ });
1387
+ };
1388
+ const deserializeAws_restJson1CwLog = (output, context) => {
1389
+ return {
1390
+ CwLogEnabled: smithy_client_1.expectBoolean(output.CwLogEnabled),
1391
+ CwLogGroup: smithy_client_1.expectString(output.CwLogGroup),
1392
+ };
1393
+ };
1394
+ const deserializeAws_restJson1DataStorage = (output, context) => {
1395
+ return {
1396
+ CwLog: output.CwLog !== undefined && output.CwLog !== null
1397
+ ? deserializeAws_restJson1CwLog(output.CwLog, context)
1398
+ : undefined,
1399
+ };
1400
+ };
1401
+ const deserializeAws_restJson1EventDataList = (output, context) => {
1402
+ return (output || [])
1403
+ .filter((e) => e != null)
1404
+ .map((entry) => {
1405
+ if (entry === null) {
1406
+ return null;
1407
+ }
1408
+ return smithy_client_1.expectString(entry);
1409
+ });
1410
+ };
1411
+ const deserializeAws_restJson1FavoritePages = (output, context) => {
1412
+ return (output || [])
1413
+ .filter((e) => e != null)
1414
+ .map((entry) => {
1415
+ if (entry === null) {
1416
+ return null;
1417
+ }
1418
+ return smithy_client_1.expectString(entry);
1419
+ });
1420
+ };
1421
+ const deserializeAws_restJson1Pages = (output, context) => {
1422
+ return (output || [])
1423
+ .filter((e) => e != null)
1424
+ .map((entry) => {
1425
+ if (entry === null) {
1426
+ return null;
1427
+ }
1428
+ return smithy_client_1.expectString(entry);
1429
+ });
1430
+ };
1431
+ const deserializeAws_restJson1TagMap = (output, context) => {
1432
+ return Object.entries(output).reduce((acc, [key, value]) => {
1433
+ if (value === null) {
1434
+ return acc;
1435
+ }
1436
+ return {
1437
+ ...acc,
1438
+ [key]: smithy_client_1.expectString(value),
1439
+ };
1440
+ }, {});
1441
+ };
1442
+ const deserializeAws_restJson1Telemetries = (output, context) => {
1443
+ return (output || [])
1444
+ .filter((e) => e != null)
1445
+ .map((entry) => {
1446
+ if (entry === null) {
1447
+ return null;
1448
+ }
1449
+ return smithy_client_1.expectString(entry);
1450
+ });
1451
+ };
1452
+ const deserializeMetadata = (output) => {
1453
+ var _a;
1454
+ return ({
1455
+ httpStatusCode: output.statusCode,
1456
+ requestId: (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"],
1457
+ extendedRequestId: output.headers["x-amz-id-2"],
1458
+ cfId: output.headers["x-amz-cf-id"],
1459
+ });
1460
+ };
1461
+ const collectBody = (streamBody = new Uint8Array(), context) => {
1462
+ if (streamBody instanceof Uint8Array) {
1463
+ return Promise.resolve(streamBody);
1464
+ }
1465
+ return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
1466
+ };
1467
+ const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
1468
+ const isSerializableHeaderValue = (value) => value !== undefined &&
1469
+ value !== null &&
1470
+ value !== "" &&
1471
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
1472
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
1473
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
1474
+ if (encoded.length) {
1475
+ return JSON.parse(encoded);
1476
+ }
1477
+ return {};
1478
+ });
1479
+ const loadRestJsonErrorCode = (output, data) => {
1480
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
1481
+ const sanitizeErrorCode = (rawValue) => {
1482
+ let cleanValue = rawValue;
1483
+ if (cleanValue.indexOf(":") >= 0) {
1484
+ cleanValue = cleanValue.split(":")[0];
1485
+ }
1486
+ if (cleanValue.indexOf("#") >= 0) {
1487
+ cleanValue = cleanValue.split("#")[1];
1488
+ }
1489
+ return cleanValue;
1490
+ };
1491
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
1492
+ if (headerKey !== undefined) {
1493
+ return sanitizeErrorCode(output.headers[headerKey]);
1494
+ }
1495
+ if (data.code !== undefined) {
1496
+ return sanitizeErrorCode(data.code);
1497
+ }
1498
+ if (data["__type"] !== undefined) {
1499
+ return sanitizeErrorCode(data["__type"]);
1500
+ }
1501
+ return "";
1502
+ };