@aws-sdk/client-iot-events-data 3.34.0 → 3.37.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 (174) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/{dist/cjs → dist-cjs}/IoTEventsData.js +1 -9
  3. package/{dist/cjs → dist-cjs}/IoTEventsDataClient.js +8 -21
  4. package/{dist/cjs → dist-cjs}/commands/BatchAcknowledgeAlarmCommand.js +2 -28
  5. package/{dist/cjs → dist-cjs}/commands/BatchDisableAlarmCommand.js +2 -28
  6. package/{dist/cjs → dist-cjs}/commands/BatchEnableAlarmCommand.js +2 -28
  7. package/{dist/cjs → dist-cjs}/commands/BatchPutMessageCommand.js +2 -31
  8. package/{dist/cjs → dist-cjs}/commands/BatchResetAlarmCommand.js +2 -28
  9. package/{dist/cjs → dist-cjs}/commands/BatchSnoozeAlarmCommand.js +2 -28
  10. package/{dist/cjs → dist-cjs}/commands/BatchUpdateDetectorCommand.js +2 -28
  11. package/{dist/cjs → dist-cjs}/commands/DescribeAlarmCommand.js +2 -27
  12. package/{dist/cjs → dist-cjs}/commands/DescribeDetectorCommand.js +2 -27
  13. package/{dist/cjs → dist-cjs}/commands/ListAlarmsCommand.js +2 -28
  14. package/{dist/cjs → dist-cjs}/commands/ListDetectorsCommand.js +2 -27
  15. package/{dist/cjs → dist-cjs}/endpoints.js +1 -2
  16. package/{dist/cjs → dist-cjs}/index.js +0 -1
  17. package/{dist/cjs → dist-cjs}/models/index.js +0 -1
  18. package/{dist/cjs → dist-cjs}/models/models_0.js +0 -181
  19. package/{dist/cjs → dist-cjs}/protocols/Aws_restJson1.js +7 -13
  20. package/{dist/cjs → dist-cjs}/runtimeConfig.browser.js +1 -5
  21. package/{dist/cjs → dist-cjs}/runtimeConfig.js +1 -5
  22. package/{dist/cjs → dist-cjs}/runtimeConfig.native.js +0 -4
  23. package/{dist/cjs → dist-cjs}/runtimeConfig.shared.js +1 -5
  24. package/{dist/es → dist-es}/IoTEventsData.js +1 -2
  25. package/{dist/es → dist-es}/IoTEventsDataClient.js +1 -2
  26. package/{dist/es → dist-es}/commands/BatchAcknowledgeAlarmCommand.js +2 -3
  27. package/{dist/es → dist-es}/commands/BatchDisableAlarmCommand.js +2 -3
  28. package/{dist/es → dist-es}/commands/BatchEnableAlarmCommand.js +2 -3
  29. package/{dist/es → dist-es}/commands/BatchPutMessageCommand.js +2 -3
  30. package/{dist/es → dist-es}/commands/BatchResetAlarmCommand.js +2 -3
  31. package/{dist/es → dist-es}/commands/BatchSnoozeAlarmCommand.js +2 -3
  32. package/{dist/es → dist-es}/commands/BatchUpdateDetectorCommand.js +2 -3
  33. package/{dist/es → dist-es}/commands/DescribeAlarmCommand.js +2 -3
  34. package/{dist/es → dist-es}/commands/DescribeDetectorCommand.js +2 -3
  35. package/{dist/es → dist-es}/commands/ListAlarmsCommand.js +2 -3
  36. package/{dist/es → dist-es}/commands/ListDetectorsCommand.js +2 -3
  37. package/{dist/es → dist-es}/endpoints.js +1 -2
  38. package/{dist/types/index.d.ts → dist-es/index.js} +0 -0
  39. package/{dist/types/models/index.d.ts → dist-es/models/index.js} +0 -0
  40. package/{dist/es → dist-es}/models/models_0.js +0 -1
  41. package/{dist/es → dist-es}/protocols/Aws_restJson1.js +0 -1
  42. package/{dist/es → dist-es}/runtimeConfig.browser.js +1 -2
  43. package/{dist/es → dist-es}/runtimeConfig.js +1 -2
  44. package/{dist/es → dist-es}/runtimeConfig.native.js +0 -1
  45. package/{dist/es → dist-es}/runtimeConfig.shared.js +1 -2
  46. package/{dist/types → dist-types}/IoTEventsData.d.ts +2 -2
  47. package/{dist/types → dist-types}/IoTEventsDataClient.d.ts +8 -8
  48. package/{dist/types → dist-types}/commands/BatchAcknowledgeAlarmCommand.d.ts +2 -2
  49. package/{dist/types → dist-types}/commands/BatchDisableAlarmCommand.d.ts +2 -2
  50. package/{dist/types → dist-types}/commands/BatchEnableAlarmCommand.d.ts +2 -2
  51. package/{dist/types → dist-types}/commands/BatchPutMessageCommand.d.ts +2 -2
  52. package/{dist/types → dist-types}/commands/BatchResetAlarmCommand.d.ts +2 -2
  53. package/{dist/types → dist-types}/commands/BatchSnoozeAlarmCommand.d.ts +2 -2
  54. package/{dist/types → dist-types}/commands/BatchUpdateDetectorCommand.d.ts +2 -2
  55. package/{dist/types → dist-types}/commands/DescribeAlarmCommand.d.ts +2 -2
  56. package/{dist/types → dist-types}/commands/DescribeDetectorCommand.d.ts +2 -2
  57. package/{dist/types → dist-types}/commands/ListAlarmsCommand.d.ts +2 -2
  58. package/{dist/types → dist-types}/commands/ListDetectorsCommand.d.ts +2 -2
  59. package/{dist/types → dist-types}/endpoints.d.ts +0 -0
  60. package/{index.ts → dist-types/index.d.ts} +0 -0
  61. package/{models/index.ts → dist-types/models/index.d.ts} +0 -0
  62. package/{dist/types → dist-types}/models/models_0.d.ts +0 -0
  63. package/{dist/types → dist-types}/protocols/Aws_restJson1.d.ts +2 -2
  64. package/{dist/types → dist-types}/runtimeConfig.browser.d.ts +0 -0
  65. package/{dist/types → dist-types}/runtimeConfig.d.ts +1 -1
  66. package/{dist/types → dist-types}/runtimeConfig.native.d.ts +0 -0
  67. package/{dist/types → dist-types}/runtimeConfig.shared.d.ts +0 -0
  68. package/{dist/types → dist-types}/ts3.4/IoTEventsData.d.ts +14 -53
  69. package/{dist/types → dist-types}/ts3.4/IoTEventsDataClient.d.ts +32 -101
  70. package/dist-types/ts3.4/commands/BatchAcknowledgeAlarmCommand.d.ts +17 -0
  71. package/dist-types/ts3.4/commands/BatchDisableAlarmCommand.d.ts +17 -0
  72. package/dist-types/ts3.4/commands/BatchEnableAlarmCommand.d.ts +17 -0
  73. package/dist-types/ts3.4/commands/BatchPutMessageCommand.d.ts +17 -0
  74. package/dist-types/ts3.4/commands/BatchResetAlarmCommand.d.ts +17 -0
  75. package/dist-types/ts3.4/commands/BatchSnoozeAlarmCommand.d.ts +17 -0
  76. package/dist-types/ts3.4/commands/BatchUpdateDetectorCommand.d.ts +17 -0
  77. package/dist-types/ts3.4/commands/DescribeAlarmCommand.d.ts +17 -0
  78. package/dist-types/ts3.4/commands/DescribeDetectorCommand.d.ts +17 -0
  79. package/dist-types/ts3.4/commands/ListAlarmsCommand.d.ts +17 -0
  80. package/dist-types/ts3.4/commands/ListDetectorsCommand.d.ts +17 -0
  81. package/{dist/types → dist-types}/ts3.4/endpoints.d.ts +0 -0
  82. package/{dist/types → dist-types}/ts3.4/index.d.ts +0 -0
  83. package/{dist/types → dist-types}/ts3.4/models/index.d.ts +0 -0
  84. package/dist-types/ts3.4/models/models_0.d.ts +721 -0
  85. package/{dist/types → dist-types}/ts3.4/protocols/Aws_restJson1.d.ts +2 -2
  86. package/{dist/types → dist-types}/ts3.4/runtimeConfig.browser.d.ts +1 -3
  87. package/{dist/types → dist-types}/ts3.4/runtimeConfig.d.ts +2 -4
  88. package/{dist/types → dist-types}/ts3.4/runtimeConfig.native.d.ts +1 -3
  89. package/{dist/types → dist-types}/ts3.4/runtimeConfig.shared.d.ts +1 -3
  90. package/package.json +45 -42
  91. package/IoTEventsData.ts +0 -419
  92. package/IoTEventsDataClient.ts +0 -278
  93. package/commands/BatchAcknowledgeAlarmCommand.ts +0 -95
  94. package/commands/BatchDisableAlarmCommand.ts +0 -95
  95. package/commands/BatchEnableAlarmCommand.ts +0 -95
  96. package/commands/BatchPutMessageCommand.ts +0 -98
  97. package/commands/BatchResetAlarmCommand.ts +0 -95
  98. package/commands/BatchSnoozeAlarmCommand.ts +0 -95
  99. package/commands/BatchUpdateDetectorCommand.ts +0 -95
  100. package/commands/DescribeAlarmCommand.ts +0 -94
  101. package/commands/DescribeDetectorCommand.ts +0 -94
  102. package/commands/ListAlarmsCommand.ts +0 -95
  103. package/commands/ListDetectorsCommand.ts +0 -94
  104. package/dist/cjs/IoTEventsData.js.map +0 -1
  105. package/dist/cjs/IoTEventsDataClient.js.map +0 -1
  106. package/dist/cjs/commands/BatchAcknowledgeAlarmCommand.js.map +0 -1
  107. package/dist/cjs/commands/BatchDisableAlarmCommand.js.map +0 -1
  108. package/dist/cjs/commands/BatchEnableAlarmCommand.js.map +0 -1
  109. package/dist/cjs/commands/BatchPutMessageCommand.js.map +0 -1
  110. package/dist/cjs/commands/BatchResetAlarmCommand.js.map +0 -1
  111. package/dist/cjs/commands/BatchSnoozeAlarmCommand.js.map +0 -1
  112. package/dist/cjs/commands/BatchUpdateDetectorCommand.js.map +0 -1
  113. package/dist/cjs/commands/DescribeAlarmCommand.js.map +0 -1
  114. package/dist/cjs/commands/DescribeDetectorCommand.js.map +0 -1
  115. package/dist/cjs/commands/ListAlarmsCommand.js.map +0 -1
  116. package/dist/cjs/commands/ListDetectorsCommand.js.map +0 -1
  117. package/dist/cjs/endpoints.js.map +0 -1
  118. package/dist/cjs/index.js.map +0 -1
  119. package/dist/cjs/models/index.js.map +0 -1
  120. package/dist/cjs/models/models_0.js.map +0 -1
  121. package/dist/cjs/package.json +0 -91
  122. package/dist/cjs/protocols/Aws_restJson1.js.map +0 -1
  123. package/dist/cjs/runtimeConfig.browser.js.map +0 -1
  124. package/dist/cjs/runtimeConfig.js.map +0 -1
  125. package/dist/cjs/runtimeConfig.native.js.map +0 -1
  126. package/dist/cjs/runtimeConfig.shared.js.map +0 -1
  127. package/dist/es/IoTEventsData.js.map +0 -1
  128. package/dist/es/IoTEventsDataClient.js.map +0 -1
  129. package/dist/es/commands/BatchAcknowledgeAlarmCommand.js.map +0 -1
  130. package/dist/es/commands/BatchDisableAlarmCommand.js.map +0 -1
  131. package/dist/es/commands/BatchEnableAlarmCommand.js.map +0 -1
  132. package/dist/es/commands/BatchPutMessageCommand.js.map +0 -1
  133. package/dist/es/commands/BatchResetAlarmCommand.js.map +0 -1
  134. package/dist/es/commands/BatchSnoozeAlarmCommand.js.map +0 -1
  135. package/dist/es/commands/BatchUpdateDetectorCommand.js.map +0 -1
  136. package/dist/es/commands/DescribeAlarmCommand.js.map +0 -1
  137. package/dist/es/commands/DescribeDetectorCommand.js.map +0 -1
  138. package/dist/es/commands/ListAlarmsCommand.js.map +0 -1
  139. package/dist/es/commands/ListDetectorsCommand.js.map +0 -1
  140. package/dist/es/endpoints.js.map +0 -1
  141. package/dist/es/index.js +0 -15
  142. package/dist/es/index.js.map +0 -1
  143. package/dist/es/models/index.js +0 -2
  144. package/dist/es/models/index.js.map +0 -1
  145. package/dist/es/models/models_0.js.map +0 -1
  146. package/dist/es/package.json +0 -91
  147. package/dist/es/protocols/Aws_restJson1.js.map +0 -1
  148. package/dist/es/runtimeConfig.browser.js.map +0 -1
  149. package/dist/es/runtimeConfig.js.map +0 -1
  150. package/dist/es/runtimeConfig.native.js.map +0 -1
  151. package/dist/es/runtimeConfig.shared.js.map +0 -1
  152. package/dist/types/ts3.4/commands/BatchAcknowledgeAlarmCommand.d.ts +0 -36
  153. package/dist/types/ts3.4/commands/BatchDisableAlarmCommand.d.ts +0 -36
  154. package/dist/types/ts3.4/commands/BatchEnableAlarmCommand.d.ts +0 -36
  155. package/dist/types/ts3.4/commands/BatchPutMessageCommand.d.ts +0 -39
  156. package/dist/types/ts3.4/commands/BatchResetAlarmCommand.d.ts +0 -36
  157. package/dist/types/ts3.4/commands/BatchSnoozeAlarmCommand.d.ts +0 -36
  158. package/dist/types/ts3.4/commands/BatchUpdateDetectorCommand.d.ts +0 -36
  159. package/dist/types/ts3.4/commands/DescribeAlarmCommand.d.ts +0 -35
  160. package/dist/types/ts3.4/commands/DescribeDetectorCommand.d.ts +0 -35
  161. package/dist/types/ts3.4/commands/ListAlarmsCommand.d.ts +0 -36
  162. package/dist/types/ts3.4/commands/ListDetectorsCommand.d.ts +0 -35
  163. package/dist/types/ts3.4/models/models_0.d.ts +0 -1345
  164. package/endpoints.ts +0 -57
  165. package/jest.config.js +0 -4
  166. package/models/models_0.ts +0 -1669
  167. package/protocols/Aws_restJson1.ts +0 -2060
  168. package/runtimeConfig.browser.ts +0 -40
  169. package/runtimeConfig.native.ts +0 -16
  170. package/runtimeConfig.shared.ts +0 -16
  171. package/runtimeConfig.ts +0 -45
  172. package/tsconfig.es.json +0 -10
  173. package/tsconfig.json +0 -31
  174. package/tsconfig.types.json +0 -8
@@ -1,2060 +0,0 @@
1
- import {
2
- BatchAcknowledgeAlarmCommandInput,
3
- BatchAcknowledgeAlarmCommandOutput,
4
- } from "../commands/BatchAcknowledgeAlarmCommand";
5
- import { BatchDisableAlarmCommandInput, BatchDisableAlarmCommandOutput } from "../commands/BatchDisableAlarmCommand";
6
- import { BatchEnableAlarmCommandInput, BatchEnableAlarmCommandOutput } from "../commands/BatchEnableAlarmCommand";
7
- import { BatchPutMessageCommandInput, BatchPutMessageCommandOutput } from "../commands/BatchPutMessageCommand";
8
- import { BatchResetAlarmCommandInput, BatchResetAlarmCommandOutput } from "../commands/BatchResetAlarmCommand";
9
- import { BatchSnoozeAlarmCommandInput, BatchSnoozeAlarmCommandOutput } from "../commands/BatchSnoozeAlarmCommand";
10
- import {
11
- BatchUpdateDetectorCommandInput,
12
- BatchUpdateDetectorCommandOutput,
13
- } from "../commands/BatchUpdateDetectorCommand";
14
- import { DescribeAlarmCommandInput, DescribeAlarmCommandOutput } from "../commands/DescribeAlarmCommand";
15
- import { DescribeDetectorCommandInput, DescribeDetectorCommandOutput } from "../commands/DescribeDetectorCommand";
16
- import { ListAlarmsCommandInput, ListAlarmsCommandOutput } from "../commands/ListAlarmsCommand";
17
- import { ListDetectorsCommandInput, ListDetectorsCommandOutput } from "../commands/ListDetectorsCommand";
18
- import {
19
- AcknowledgeActionConfiguration,
20
- AcknowledgeAlarmActionRequest,
21
- Alarm,
22
- AlarmState,
23
- AlarmSummary,
24
- BatchAlarmActionErrorEntry,
25
- BatchPutMessageErrorEntry,
26
- BatchUpdateDetectorErrorEntry,
27
- CustomerAction,
28
- Detector,
29
- DetectorState,
30
- DetectorStateDefinition,
31
- DetectorStateSummary,
32
- DetectorSummary,
33
- DisableActionConfiguration,
34
- DisableAlarmActionRequest,
35
- EnableActionConfiguration,
36
- EnableAlarmActionRequest,
37
- InternalFailureException,
38
- InvalidRequestException,
39
- Message,
40
- ResetActionConfiguration,
41
- ResetAlarmActionRequest,
42
- ResourceNotFoundException,
43
- RuleEvaluation,
44
- ServiceUnavailableException,
45
- SimpleRuleEvaluation,
46
- SnoozeActionConfiguration,
47
- SnoozeAlarmActionRequest,
48
- StateChangeConfiguration,
49
- SystemEvent,
50
- ThrottlingException,
51
- Timer,
52
- TimerDefinition,
53
- TimestampValue,
54
- UpdateDetectorRequest,
55
- Variable,
56
- VariableDefinition,
57
- } from "../models/models_0";
58
- import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
59
- import {
60
- expectInt32 as __expectInt32,
61
- expectNonNull as __expectNonNull,
62
- expectNumber as __expectNumber,
63
- expectObject as __expectObject,
64
- expectString as __expectString,
65
- extendedEncodeURIComponent as __extendedEncodeURIComponent,
66
- parseEpochTimestamp as __parseEpochTimestamp,
67
- } from "@aws-sdk/smithy-client";
68
- import {
69
- Endpoint as __Endpoint,
70
- MetadataBearer as __MetadataBearer,
71
- ResponseMetadata as __ResponseMetadata,
72
- SerdeContext as __SerdeContext,
73
- SmithyException as __SmithyException,
74
- } from "@aws-sdk/types";
75
-
76
- export const serializeAws_restJson1BatchAcknowledgeAlarmCommand = async (
77
- input: BatchAcknowledgeAlarmCommandInput,
78
- context: __SerdeContext
79
- ): Promise<__HttpRequest> => {
80
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
81
- const headers: any = {
82
- "content-type": "application/json",
83
- };
84
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/alarms/acknowledge";
85
- let body: any;
86
- body = JSON.stringify({
87
- ...(input.acknowledgeActionRequests !== undefined &&
88
- input.acknowledgeActionRequests !== null && {
89
- acknowledgeActionRequests: serializeAws_restJson1AcknowledgeAlarmActionRequests(
90
- input.acknowledgeActionRequests,
91
- context
92
- ),
93
- }),
94
- });
95
- return new __HttpRequest({
96
- protocol,
97
- hostname,
98
- port,
99
- method: "POST",
100
- headers,
101
- path: resolvedPath,
102
- body,
103
- });
104
- };
105
-
106
- export const serializeAws_restJson1BatchDisableAlarmCommand = async (
107
- input: BatchDisableAlarmCommandInput,
108
- context: __SerdeContext
109
- ): Promise<__HttpRequest> => {
110
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
111
- const headers: any = {
112
- "content-type": "application/json",
113
- };
114
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/alarms/disable";
115
- let body: any;
116
- body = JSON.stringify({
117
- ...(input.disableActionRequests !== undefined &&
118
- input.disableActionRequests !== null && {
119
- disableActionRequests: serializeAws_restJson1DisableAlarmActionRequests(input.disableActionRequests, context),
120
- }),
121
- });
122
- return new __HttpRequest({
123
- protocol,
124
- hostname,
125
- port,
126
- method: "POST",
127
- headers,
128
- path: resolvedPath,
129
- body,
130
- });
131
- };
132
-
133
- export const serializeAws_restJson1BatchEnableAlarmCommand = async (
134
- input: BatchEnableAlarmCommandInput,
135
- context: __SerdeContext
136
- ): Promise<__HttpRequest> => {
137
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
138
- const headers: any = {
139
- "content-type": "application/json",
140
- };
141
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/alarms/enable";
142
- let body: any;
143
- body = JSON.stringify({
144
- ...(input.enableActionRequests !== undefined &&
145
- input.enableActionRequests !== null && {
146
- enableActionRequests: serializeAws_restJson1EnableAlarmActionRequests(input.enableActionRequests, context),
147
- }),
148
- });
149
- return new __HttpRequest({
150
- protocol,
151
- hostname,
152
- port,
153
- method: "POST",
154
- headers,
155
- path: resolvedPath,
156
- body,
157
- });
158
- };
159
-
160
- export const serializeAws_restJson1BatchPutMessageCommand = async (
161
- input: BatchPutMessageCommandInput,
162
- context: __SerdeContext
163
- ): Promise<__HttpRequest> => {
164
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
165
- const headers: any = {
166
- "content-type": "application/json",
167
- };
168
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/inputs/messages";
169
- let body: any;
170
- body = JSON.stringify({
171
- ...(input.messages !== undefined &&
172
- input.messages !== null && { messages: serializeAws_restJson1Messages(input.messages, context) }),
173
- });
174
- return new __HttpRequest({
175
- protocol,
176
- hostname,
177
- port,
178
- method: "POST",
179
- headers,
180
- path: resolvedPath,
181
- body,
182
- });
183
- };
184
-
185
- export const serializeAws_restJson1BatchResetAlarmCommand = async (
186
- input: BatchResetAlarmCommandInput,
187
- context: __SerdeContext
188
- ): Promise<__HttpRequest> => {
189
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
190
- const headers: any = {
191
- "content-type": "application/json",
192
- };
193
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/alarms/reset";
194
- let body: any;
195
- body = JSON.stringify({
196
- ...(input.resetActionRequests !== undefined &&
197
- input.resetActionRequests !== null && {
198
- resetActionRequests: serializeAws_restJson1ResetAlarmActionRequests(input.resetActionRequests, context),
199
- }),
200
- });
201
- return new __HttpRequest({
202
- protocol,
203
- hostname,
204
- port,
205
- method: "POST",
206
- headers,
207
- path: resolvedPath,
208
- body,
209
- });
210
- };
211
-
212
- export const serializeAws_restJson1BatchSnoozeAlarmCommand = async (
213
- input: BatchSnoozeAlarmCommandInput,
214
- context: __SerdeContext
215
- ): Promise<__HttpRequest> => {
216
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
217
- const headers: any = {
218
- "content-type": "application/json",
219
- };
220
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/alarms/snooze";
221
- let body: any;
222
- body = JSON.stringify({
223
- ...(input.snoozeActionRequests !== undefined &&
224
- input.snoozeActionRequests !== null && {
225
- snoozeActionRequests: serializeAws_restJson1SnoozeAlarmActionRequests(input.snoozeActionRequests, context),
226
- }),
227
- });
228
- return new __HttpRequest({
229
- protocol,
230
- hostname,
231
- port,
232
- method: "POST",
233
- headers,
234
- path: resolvedPath,
235
- body,
236
- });
237
- };
238
-
239
- export const serializeAws_restJson1BatchUpdateDetectorCommand = async (
240
- input: BatchUpdateDetectorCommandInput,
241
- context: __SerdeContext
242
- ): Promise<__HttpRequest> => {
243
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
244
- const headers: any = {
245
- "content-type": "application/json",
246
- };
247
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detectors";
248
- let body: any;
249
- body = JSON.stringify({
250
- ...(input.detectors !== undefined &&
251
- input.detectors !== null && {
252
- detectors: serializeAws_restJson1UpdateDetectorRequests(input.detectors, context),
253
- }),
254
- });
255
- return new __HttpRequest({
256
- protocol,
257
- hostname,
258
- port,
259
- method: "POST",
260
- headers,
261
- path: resolvedPath,
262
- body,
263
- });
264
- };
265
-
266
- export const serializeAws_restJson1DescribeAlarmCommand = async (
267
- input: DescribeAlarmCommandInput,
268
- context: __SerdeContext
269
- ): Promise<__HttpRequest> => {
270
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
271
- const headers: any = {};
272
- let resolvedPath =
273
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/alarms/{alarmModelName}/keyValues";
274
- if (input.alarmModelName !== undefined) {
275
- const labelValue: string = input.alarmModelName;
276
- if (labelValue.length <= 0) {
277
- throw new Error("Empty value provided for input HTTP label: alarmModelName.");
278
- }
279
- resolvedPath = resolvedPath.replace("{alarmModelName}", __extendedEncodeURIComponent(labelValue));
280
- } else {
281
- throw new Error("No value provided for input HTTP label: alarmModelName.");
282
- }
283
- const query: any = {
284
- ...(input.keyValue !== undefined && { keyValue: input.keyValue }),
285
- };
286
- let body: any;
287
- return new __HttpRequest({
288
- protocol,
289
- hostname,
290
- port,
291
- method: "GET",
292
- headers,
293
- path: resolvedPath,
294
- query,
295
- body,
296
- });
297
- };
298
-
299
- export const serializeAws_restJson1DescribeDetectorCommand = async (
300
- input: DescribeDetectorCommandInput,
301
- context: __SerdeContext
302
- ): Promise<__HttpRequest> => {
303
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
304
- const headers: any = {};
305
- let resolvedPath =
306
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detectors/{detectorModelName}/keyValues";
307
- if (input.detectorModelName !== undefined) {
308
- const labelValue: string = input.detectorModelName;
309
- if (labelValue.length <= 0) {
310
- throw new Error("Empty value provided for input HTTP label: detectorModelName.");
311
- }
312
- resolvedPath = resolvedPath.replace("{detectorModelName}", __extendedEncodeURIComponent(labelValue));
313
- } else {
314
- throw new Error("No value provided for input HTTP label: detectorModelName.");
315
- }
316
- const query: any = {
317
- ...(input.keyValue !== undefined && { keyValue: input.keyValue }),
318
- };
319
- let body: any;
320
- return new __HttpRequest({
321
- protocol,
322
- hostname,
323
- port,
324
- method: "GET",
325
- headers,
326
- path: resolvedPath,
327
- query,
328
- body,
329
- });
330
- };
331
-
332
- export const serializeAws_restJson1ListAlarmsCommand = async (
333
- input: ListAlarmsCommandInput,
334
- context: __SerdeContext
335
- ): Promise<__HttpRequest> => {
336
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
337
- const headers: any = {};
338
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/alarms/{alarmModelName}";
339
- if (input.alarmModelName !== undefined) {
340
- const labelValue: string = input.alarmModelName;
341
- if (labelValue.length <= 0) {
342
- throw new Error("Empty value provided for input HTTP label: alarmModelName.");
343
- }
344
- resolvedPath = resolvedPath.replace("{alarmModelName}", __extendedEncodeURIComponent(labelValue));
345
- } else {
346
- throw new Error("No value provided for input HTTP label: alarmModelName.");
347
- }
348
- const query: any = {
349
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
350
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
351
- };
352
- let body: any;
353
- return new __HttpRequest({
354
- protocol,
355
- hostname,
356
- port,
357
- method: "GET",
358
- headers,
359
- path: resolvedPath,
360
- query,
361
- body,
362
- });
363
- };
364
-
365
- export const serializeAws_restJson1ListDetectorsCommand = async (
366
- input: ListDetectorsCommandInput,
367
- context: __SerdeContext
368
- ): Promise<__HttpRequest> => {
369
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
370
- const headers: any = {};
371
- let resolvedPath =
372
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detectors/{detectorModelName}";
373
- if (input.detectorModelName !== undefined) {
374
- const labelValue: string = input.detectorModelName;
375
- if (labelValue.length <= 0) {
376
- throw new Error("Empty value provided for input HTTP label: detectorModelName.");
377
- }
378
- resolvedPath = resolvedPath.replace("{detectorModelName}", __extendedEncodeURIComponent(labelValue));
379
- } else {
380
- throw new Error("No value provided for input HTTP label: detectorModelName.");
381
- }
382
- const query: any = {
383
- ...(input.stateName !== undefined && { stateName: input.stateName }),
384
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
385
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
386
- };
387
- let body: any;
388
- return new __HttpRequest({
389
- protocol,
390
- hostname,
391
- port,
392
- method: "GET",
393
- headers,
394
- path: resolvedPath,
395
- query,
396
- body,
397
- });
398
- };
399
-
400
- export const deserializeAws_restJson1BatchAcknowledgeAlarmCommand = async (
401
- output: __HttpResponse,
402
- context: __SerdeContext
403
- ): Promise<BatchAcknowledgeAlarmCommandOutput> => {
404
- if (output.statusCode !== 202 && output.statusCode >= 300) {
405
- return deserializeAws_restJson1BatchAcknowledgeAlarmCommandError(output, context);
406
- }
407
- const contents: BatchAcknowledgeAlarmCommandOutput = {
408
- $metadata: deserializeMetadata(output),
409
- errorEntries: undefined,
410
- };
411
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
412
- if (data.errorEntries !== undefined && data.errorEntries !== null) {
413
- contents.errorEntries = deserializeAws_restJson1BatchAlarmActionErrorEntries(data.errorEntries, context);
414
- }
415
- return Promise.resolve(contents);
416
- };
417
-
418
- const deserializeAws_restJson1BatchAcknowledgeAlarmCommandError = async (
419
- output: __HttpResponse,
420
- context: __SerdeContext
421
- ): Promise<BatchAcknowledgeAlarmCommandOutput> => {
422
- const parsedOutput: any = {
423
- ...output,
424
- body: await parseBody(output.body, context),
425
- };
426
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
427
- let errorCode: string = "UnknownError";
428
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
429
- switch (errorCode) {
430
- case "InternalFailureException":
431
- case "com.amazonaws.ioteventsdata#InternalFailureException":
432
- response = {
433
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
434
- name: errorCode,
435
- $metadata: deserializeMetadata(output),
436
- };
437
- break;
438
- case "InvalidRequestException":
439
- case "com.amazonaws.ioteventsdata#InvalidRequestException":
440
- response = {
441
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
442
- name: errorCode,
443
- $metadata: deserializeMetadata(output),
444
- };
445
- break;
446
- case "ServiceUnavailableException":
447
- case "com.amazonaws.ioteventsdata#ServiceUnavailableException":
448
- response = {
449
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
450
- name: errorCode,
451
- $metadata: deserializeMetadata(output),
452
- };
453
- break;
454
- case "ThrottlingException":
455
- case "com.amazonaws.ioteventsdata#ThrottlingException":
456
- response = {
457
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
458
- name: errorCode,
459
- $metadata: deserializeMetadata(output),
460
- };
461
- break;
462
- default:
463
- const parsedBody = parsedOutput.body;
464
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
465
- response = {
466
- ...parsedBody,
467
- name: `${errorCode}`,
468
- message: parsedBody.message || parsedBody.Message || errorCode,
469
- $fault: "client",
470
- $metadata: deserializeMetadata(output),
471
- } as any;
472
- }
473
- const message = response.message || response.Message || errorCode;
474
- response.message = message;
475
- delete response.Message;
476
- return Promise.reject(Object.assign(new Error(message), response));
477
- };
478
-
479
- export const deserializeAws_restJson1BatchDisableAlarmCommand = async (
480
- output: __HttpResponse,
481
- context: __SerdeContext
482
- ): Promise<BatchDisableAlarmCommandOutput> => {
483
- if (output.statusCode !== 202 && output.statusCode >= 300) {
484
- return deserializeAws_restJson1BatchDisableAlarmCommandError(output, context);
485
- }
486
- const contents: BatchDisableAlarmCommandOutput = {
487
- $metadata: deserializeMetadata(output),
488
- errorEntries: undefined,
489
- };
490
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
491
- if (data.errorEntries !== undefined && data.errorEntries !== null) {
492
- contents.errorEntries = deserializeAws_restJson1BatchAlarmActionErrorEntries(data.errorEntries, context);
493
- }
494
- return Promise.resolve(contents);
495
- };
496
-
497
- const deserializeAws_restJson1BatchDisableAlarmCommandError = async (
498
- output: __HttpResponse,
499
- context: __SerdeContext
500
- ): Promise<BatchDisableAlarmCommandOutput> => {
501
- const parsedOutput: any = {
502
- ...output,
503
- body: await parseBody(output.body, context),
504
- };
505
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
506
- let errorCode: string = "UnknownError";
507
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
508
- switch (errorCode) {
509
- case "InternalFailureException":
510
- case "com.amazonaws.ioteventsdata#InternalFailureException":
511
- response = {
512
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
513
- name: errorCode,
514
- $metadata: deserializeMetadata(output),
515
- };
516
- break;
517
- case "InvalidRequestException":
518
- case "com.amazonaws.ioteventsdata#InvalidRequestException":
519
- response = {
520
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
521
- name: errorCode,
522
- $metadata: deserializeMetadata(output),
523
- };
524
- break;
525
- case "ServiceUnavailableException":
526
- case "com.amazonaws.ioteventsdata#ServiceUnavailableException":
527
- response = {
528
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
529
- name: errorCode,
530
- $metadata: deserializeMetadata(output),
531
- };
532
- break;
533
- case "ThrottlingException":
534
- case "com.amazonaws.ioteventsdata#ThrottlingException":
535
- response = {
536
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
537
- name: errorCode,
538
- $metadata: deserializeMetadata(output),
539
- };
540
- break;
541
- default:
542
- const parsedBody = parsedOutput.body;
543
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
544
- response = {
545
- ...parsedBody,
546
- name: `${errorCode}`,
547
- message: parsedBody.message || parsedBody.Message || errorCode,
548
- $fault: "client",
549
- $metadata: deserializeMetadata(output),
550
- } as any;
551
- }
552
- const message = response.message || response.Message || errorCode;
553
- response.message = message;
554
- delete response.Message;
555
- return Promise.reject(Object.assign(new Error(message), response));
556
- };
557
-
558
- export const deserializeAws_restJson1BatchEnableAlarmCommand = async (
559
- output: __HttpResponse,
560
- context: __SerdeContext
561
- ): Promise<BatchEnableAlarmCommandOutput> => {
562
- if (output.statusCode !== 202 && output.statusCode >= 300) {
563
- return deserializeAws_restJson1BatchEnableAlarmCommandError(output, context);
564
- }
565
- const contents: BatchEnableAlarmCommandOutput = {
566
- $metadata: deserializeMetadata(output),
567
- errorEntries: undefined,
568
- };
569
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
570
- if (data.errorEntries !== undefined && data.errorEntries !== null) {
571
- contents.errorEntries = deserializeAws_restJson1BatchAlarmActionErrorEntries(data.errorEntries, context);
572
- }
573
- return Promise.resolve(contents);
574
- };
575
-
576
- const deserializeAws_restJson1BatchEnableAlarmCommandError = async (
577
- output: __HttpResponse,
578
- context: __SerdeContext
579
- ): Promise<BatchEnableAlarmCommandOutput> => {
580
- const parsedOutput: any = {
581
- ...output,
582
- body: await parseBody(output.body, context),
583
- };
584
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
585
- let errorCode: string = "UnknownError";
586
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
587
- switch (errorCode) {
588
- case "InternalFailureException":
589
- case "com.amazonaws.ioteventsdata#InternalFailureException":
590
- response = {
591
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
592
- name: errorCode,
593
- $metadata: deserializeMetadata(output),
594
- };
595
- break;
596
- case "InvalidRequestException":
597
- case "com.amazonaws.ioteventsdata#InvalidRequestException":
598
- response = {
599
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
600
- name: errorCode,
601
- $metadata: deserializeMetadata(output),
602
- };
603
- break;
604
- case "ServiceUnavailableException":
605
- case "com.amazonaws.ioteventsdata#ServiceUnavailableException":
606
- response = {
607
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
608
- name: errorCode,
609
- $metadata: deserializeMetadata(output),
610
- };
611
- break;
612
- case "ThrottlingException":
613
- case "com.amazonaws.ioteventsdata#ThrottlingException":
614
- response = {
615
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
616
- name: errorCode,
617
- $metadata: deserializeMetadata(output),
618
- };
619
- break;
620
- default:
621
- const parsedBody = parsedOutput.body;
622
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
623
- response = {
624
- ...parsedBody,
625
- name: `${errorCode}`,
626
- message: parsedBody.message || parsedBody.Message || errorCode,
627
- $fault: "client",
628
- $metadata: deserializeMetadata(output),
629
- } as any;
630
- }
631
- const message = response.message || response.Message || errorCode;
632
- response.message = message;
633
- delete response.Message;
634
- return Promise.reject(Object.assign(new Error(message), response));
635
- };
636
-
637
- export const deserializeAws_restJson1BatchPutMessageCommand = async (
638
- output: __HttpResponse,
639
- context: __SerdeContext
640
- ): Promise<BatchPutMessageCommandOutput> => {
641
- if (output.statusCode !== 200 && output.statusCode >= 300) {
642
- return deserializeAws_restJson1BatchPutMessageCommandError(output, context);
643
- }
644
- const contents: BatchPutMessageCommandOutput = {
645
- $metadata: deserializeMetadata(output),
646
- BatchPutMessageErrorEntries: undefined,
647
- };
648
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
649
- if (data.BatchPutMessageErrorEntries !== undefined && data.BatchPutMessageErrorEntries !== null) {
650
- contents.BatchPutMessageErrorEntries = deserializeAws_restJson1BatchPutMessageErrorEntries(
651
- data.BatchPutMessageErrorEntries,
652
- context
653
- );
654
- }
655
- return Promise.resolve(contents);
656
- };
657
-
658
- const deserializeAws_restJson1BatchPutMessageCommandError = async (
659
- output: __HttpResponse,
660
- context: __SerdeContext
661
- ): Promise<BatchPutMessageCommandOutput> => {
662
- const parsedOutput: any = {
663
- ...output,
664
- body: await parseBody(output.body, context),
665
- };
666
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
667
- let errorCode: string = "UnknownError";
668
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
669
- switch (errorCode) {
670
- case "InternalFailureException":
671
- case "com.amazonaws.ioteventsdata#InternalFailureException":
672
- response = {
673
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
674
- name: errorCode,
675
- $metadata: deserializeMetadata(output),
676
- };
677
- break;
678
- case "InvalidRequestException":
679
- case "com.amazonaws.ioteventsdata#InvalidRequestException":
680
- response = {
681
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
682
- name: errorCode,
683
- $metadata: deserializeMetadata(output),
684
- };
685
- break;
686
- case "ServiceUnavailableException":
687
- case "com.amazonaws.ioteventsdata#ServiceUnavailableException":
688
- response = {
689
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
690
- name: errorCode,
691
- $metadata: deserializeMetadata(output),
692
- };
693
- break;
694
- case "ThrottlingException":
695
- case "com.amazonaws.ioteventsdata#ThrottlingException":
696
- response = {
697
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
698
- name: errorCode,
699
- $metadata: deserializeMetadata(output),
700
- };
701
- break;
702
- default:
703
- const parsedBody = parsedOutput.body;
704
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
705
- response = {
706
- ...parsedBody,
707
- name: `${errorCode}`,
708
- message: parsedBody.message || parsedBody.Message || errorCode,
709
- $fault: "client",
710
- $metadata: deserializeMetadata(output),
711
- } as any;
712
- }
713
- const message = response.message || response.Message || errorCode;
714
- response.message = message;
715
- delete response.Message;
716
- return Promise.reject(Object.assign(new Error(message), response));
717
- };
718
-
719
- export const deserializeAws_restJson1BatchResetAlarmCommand = async (
720
- output: __HttpResponse,
721
- context: __SerdeContext
722
- ): Promise<BatchResetAlarmCommandOutput> => {
723
- if (output.statusCode !== 202 && output.statusCode >= 300) {
724
- return deserializeAws_restJson1BatchResetAlarmCommandError(output, context);
725
- }
726
- const contents: BatchResetAlarmCommandOutput = {
727
- $metadata: deserializeMetadata(output),
728
- errorEntries: undefined,
729
- };
730
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
731
- if (data.errorEntries !== undefined && data.errorEntries !== null) {
732
- contents.errorEntries = deserializeAws_restJson1BatchAlarmActionErrorEntries(data.errorEntries, context);
733
- }
734
- return Promise.resolve(contents);
735
- };
736
-
737
- const deserializeAws_restJson1BatchResetAlarmCommandError = async (
738
- output: __HttpResponse,
739
- context: __SerdeContext
740
- ): Promise<BatchResetAlarmCommandOutput> => {
741
- const parsedOutput: any = {
742
- ...output,
743
- body: await parseBody(output.body, context),
744
- };
745
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
746
- let errorCode: string = "UnknownError";
747
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
748
- switch (errorCode) {
749
- case "InternalFailureException":
750
- case "com.amazonaws.ioteventsdata#InternalFailureException":
751
- response = {
752
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
753
- name: errorCode,
754
- $metadata: deserializeMetadata(output),
755
- };
756
- break;
757
- case "InvalidRequestException":
758
- case "com.amazonaws.ioteventsdata#InvalidRequestException":
759
- response = {
760
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
761
- name: errorCode,
762
- $metadata: deserializeMetadata(output),
763
- };
764
- break;
765
- case "ServiceUnavailableException":
766
- case "com.amazonaws.ioteventsdata#ServiceUnavailableException":
767
- response = {
768
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
769
- name: errorCode,
770
- $metadata: deserializeMetadata(output),
771
- };
772
- break;
773
- case "ThrottlingException":
774
- case "com.amazonaws.ioteventsdata#ThrottlingException":
775
- response = {
776
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
777
- name: errorCode,
778
- $metadata: deserializeMetadata(output),
779
- };
780
- break;
781
- default:
782
- const parsedBody = parsedOutput.body;
783
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
784
- response = {
785
- ...parsedBody,
786
- name: `${errorCode}`,
787
- message: parsedBody.message || parsedBody.Message || errorCode,
788
- $fault: "client",
789
- $metadata: deserializeMetadata(output),
790
- } as any;
791
- }
792
- const message = response.message || response.Message || errorCode;
793
- response.message = message;
794
- delete response.Message;
795
- return Promise.reject(Object.assign(new Error(message), response));
796
- };
797
-
798
- export const deserializeAws_restJson1BatchSnoozeAlarmCommand = async (
799
- output: __HttpResponse,
800
- context: __SerdeContext
801
- ): Promise<BatchSnoozeAlarmCommandOutput> => {
802
- if (output.statusCode !== 202 && output.statusCode >= 300) {
803
- return deserializeAws_restJson1BatchSnoozeAlarmCommandError(output, context);
804
- }
805
- const contents: BatchSnoozeAlarmCommandOutput = {
806
- $metadata: deserializeMetadata(output),
807
- errorEntries: undefined,
808
- };
809
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
810
- if (data.errorEntries !== undefined && data.errorEntries !== null) {
811
- contents.errorEntries = deserializeAws_restJson1BatchAlarmActionErrorEntries(data.errorEntries, context);
812
- }
813
- return Promise.resolve(contents);
814
- };
815
-
816
- const deserializeAws_restJson1BatchSnoozeAlarmCommandError = async (
817
- output: __HttpResponse,
818
- context: __SerdeContext
819
- ): Promise<BatchSnoozeAlarmCommandOutput> => {
820
- const parsedOutput: any = {
821
- ...output,
822
- body: await parseBody(output.body, context),
823
- };
824
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
825
- let errorCode: string = "UnknownError";
826
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
827
- switch (errorCode) {
828
- case "InternalFailureException":
829
- case "com.amazonaws.ioteventsdata#InternalFailureException":
830
- response = {
831
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
832
- name: errorCode,
833
- $metadata: deserializeMetadata(output),
834
- };
835
- break;
836
- case "InvalidRequestException":
837
- case "com.amazonaws.ioteventsdata#InvalidRequestException":
838
- response = {
839
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
840
- name: errorCode,
841
- $metadata: deserializeMetadata(output),
842
- };
843
- break;
844
- case "ServiceUnavailableException":
845
- case "com.amazonaws.ioteventsdata#ServiceUnavailableException":
846
- response = {
847
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
848
- name: errorCode,
849
- $metadata: deserializeMetadata(output),
850
- };
851
- break;
852
- case "ThrottlingException":
853
- case "com.amazonaws.ioteventsdata#ThrottlingException":
854
- response = {
855
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
856
- name: errorCode,
857
- $metadata: deserializeMetadata(output),
858
- };
859
- break;
860
- default:
861
- const parsedBody = parsedOutput.body;
862
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
863
- response = {
864
- ...parsedBody,
865
- name: `${errorCode}`,
866
- message: parsedBody.message || parsedBody.Message || errorCode,
867
- $fault: "client",
868
- $metadata: deserializeMetadata(output),
869
- } as any;
870
- }
871
- const message = response.message || response.Message || errorCode;
872
- response.message = message;
873
- delete response.Message;
874
- return Promise.reject(Object.assign(new Error(message), response));
875
- };
876
-
877
- export const deserializeAws_restJson1BatchUpdateDetectorCommand = async (
878
- output: __HttpResponse,
879
- context: __SerdeContext
880
- ): Promise<BatchUpdateDetectorCommandOutput> => {
881
- if (output.statusCode !== 200 && output.statusCode >= 300) {
882
- return deserializeAws_restJson1BatchUpdateDetectorCommandError(output, context);
883
- }
884
- const contents: BatchUpdateDetectorCommandOutput = {
885
- $metadata: deserializeMetadata(output),
886
- batchUpdateDetectorErrorEntries: undefined,
887
- };
888
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
889
- if (data.batchUpdateDetectorErrorEntries !== undefined && data.batchUpdateDetectorErrorEntries !== null) {
890
- contents.batchUpdateDetectorErrorEntries = deserializeAws_restJson1BatchUpdateDetectorErrorEntries(
891
- data.batchUpdateDetectorErrorEntries,
892
- context
893
- );
894
- }
895
- return Promise.resolve(contents);
896
- };
897
-
898
- const deserializeAws_restJson1BatchUpdateDetectorCommandError = async (
899
- output: __HttpResponse,
900
- context: __SerdeContext
901
- ): Promise<BatchUpdateDetectorCommandOutput> => {
902
- const parsedOutput: any = {
903
- ...output,
904
- body: await parseBody(output.body, context),
905
- };
906
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
907
- let errorCode: string = "UnknownError";
908
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
909
- switch (errorCode) {
910
- case "InternalFailureException":
911
- case "com.amazonaws.ioteventsdata#InternalFailureException":
912
- response = {
913
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
914
- name: errorCode,
915
- $metadata: deserializeMetadata(output),
916
- };
917
- break;
918
- case "InvalidRequestException":
919
- case "com.amazonaws.ioteventsdata#InvalidRequestException":
920
- response = {
921
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
922
- name: errorCode,
923
- $metadata: deserializeMetadata(output),
924
- };
925
- break;
926
- case "ServiceUnavailableException":
927
- case "com.amazonaws.ioteventsdata#ServiceUnavailableException":
928
- response = {
929
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
930
- name: errorCode,
931
- $metadata: deserializeMetadata(output),
932
- };
933
- break;
934
- case "ThrottlingException":
935
- case "com.amazonaws.ioteventsdata#ThrottlingException":
936
- response = {
937
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
938
- name: errorCode,
939
- $metadata: deserializeMetadata(output),
940
- };
941
- break;
942
- default:
943
- const parsedBody = parsedOutput.body;
944
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
945
- response = {
946
- ...parsedBody,
947
- name: `${errorCode}`,
948
- message: parsedBody.message || parsedBody.Message || errorCode,
949
- $fault: "client",
950
- $metadata: deserializeMetadata(output),
951
- } as any;
952
- }
953
- const message = response.message || response.Message || errorCode;
954
- response.message = message;
955
- delete response.Message;
956
- return Promise.reject(Object.assign(new Error(message), response));
957
- };
958
-
959
- export const deserializeAws_restJson1DescribeAlarmCommand = async (
960
- output: __HttpResponse,
961
- context: __SerdeContext
962
- ): Promise<DescribeAlarmCommandOutput> => {
963
- if (output.statusCode !== 200 && output.statusCode >= 300) {
964
- return deserializeAws_restJson1DescribeAlarmCommandError(output, context);
965
- }
966
- const contents: DescribeAlarmCommandOutput = {
967
- $metadata: deserializeMetadata(output),
968
- alarm: undefined,
969
- };
970
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
971
- if (data.alarm !== undefined && data.alarm !== null) {
972
- contents.alarm = deserializeAws_restJson1Alarm(data.alarm, context);
973
- }
974
- return Promise.resolve(contents);
975
- };
976
-
977
- const deserializeAws_restJson1DescribeAlarmCommandError = async (
978
- output: __HttpResponse,
979
- context: __SerdeContext
980
- ): Promise<DescribeAlarmCommandOutput> => {
981
- const parsedOutput: any = {
982
- ...output,
983
- body: await parseBody(output.body, context),
984
- };
985
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
986
- let errorCode: string = "UnknownError";
987
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
988
- switch (errorCode) {
989
- case "InternalFailureException":
990
- case "com.amazonaws.ioteventsdata#InternalFailureException":
991
- response = {
992
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
993
- name: errorCode,
994
- $metadata: deserializeMetadata(output),
995
- };
996
- break;
997
- case "InvalidRequestException":
998
- case "com.amazonaws.ioteventsdata#InvalidRequestException":
999
- response = {
1000
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
1001
- name: errorCode,
1002
- $metadata: deserializeMetadata(output),
1003
- };
1004
- break;
1005
- case "ResourceNotFoundException":
1006
- case "com.amazonaws.ioteventsdata#ResourceNotFoundException":
1007
- response = {
1008
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1009
- name: errorCode,
1010
- $metadata: deserializeMetadata(output),
1011
- };
1012
- break;
1013
- case "ServiceUnavailableException":
1014
- case "com.amazonaws.ioteventsdata#ServiceUnavailableException":
1015
- response = {
1016
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
1017
- name: errorCode,
1018
- $metadata: deserializeMetadata(output),
1019
- };
1020
- break;
1021
- case "ThrottlingException":
1022
- case "com.amazonaws.ioteventsdata#ThrottlingException":
1023
- response = {
1024
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1025
- name: errorCode,
1026
- $metadata: deserializeMetadata(output),
1027
- };
1028
- break;
1029
- default:
1030
- const parsedBody = parsedOutput.body;
1031
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1032
- response = {
1033
- ...parsedBody,
1034
- name: `${errorCode}`,
1035
- message: parsedBody.message || parsedBody.Message || errorCode,
1036
- $fault: "client",
1037
- $metadata: deserializeMetadata(output),
1038
- } as any;
1039
- }
1040
- const message = response.message || response.Message || errorCode;
1041
- response.message = message;
1042
- delete response.Message;
1043
- return Promise.reject(Object.assign(new Error(message), response));
1044
- };
1045
-
1046
- export const deserializeAws_restJson1DescribeDetectorCommand = async (
1047
- output: __HttpResponse,
1048
- context: __SerdeContext
1049
- ): Promise<DescribeDetectorCommandOutput> => {
1050
- if (output.statusCode !== 200 && output.statusCode >= 300) {
1051
- return deserializeAws_restJson1DescribeDetectorCommandError(output, context);
1052
- }
1053
- const contents: DescribeDetectorCommandOutput = {
1054
- $metadata: deserializeMetadata(output),
1055
- detector: undefined,
1056
- };
1057
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1058
- if (data.detector !== undefined && data.detector !== null) {
1059
- contents.detector = deserializeAws_restJson1Detector(data.detector, context);
1060
- }
1061
- return Promise.resolve(contents);
1062
- };
1063
-
1064
- const deserializeAws_restJson1DescribeDetectorCommandError = async (
1065
- output: __HttpResponse,
1066
- context: __SerdeContext
1067
- ): Promise<DescribeDetectorCommandOutput> => {
1068
- const parsedOutput: any = {
1069
- ...output,
1070
- body: await parseBody(output.body, context),
1071
- };
1072
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1073
- let errorCode: string = "UnknownError";
1074
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1075
- switch (errorCode) {
1076
- case "InternalFailureException":
1077
- case "com.amazonaws.ioteventsdata#InternalFailureException":
1078
- response = {
1079
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
1080
- name: errorCode,
1081
- $metadata: deserializeMetadata(output),
1082
- };
1083
- break;
1084
- case "InvalidRequestException":
1085
- case "com.amazonaws.ioteventsdata#InvalidRequestException":
1086
- response = {
1087
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
1088
- name: errorCode,
1089
- $metadata: deserializeMetadata(output),
1090
- };
1091
- break;
1092
- case "ResourceNotFoundException":
1093
- case "com.amazonaws.ioteventsdata#ResourceNotFoundException":
1094
- response = {
1095
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1096
- name: errorCode,
1097
- $metadata: deserializeMetadata(output),
1098
- };
1099
- break;
1100
- case "ServiceUnavailableException":
1101
- case "com.amazonaws.ioteventsdata#ServiceUnavailableException":
1102
- response = {
1103
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
1104
- name: errorCode,
1105
- $metadata: deserializeMetadata(output),
1106
- };
1107
- break;
1108
- case "ThrottlingException":
1109
- case "com.amazonaws.ioteventsdata#ThrottlingException":
1110
- response = {
1111
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1112
- name: errorCode,
1113
- $metadata: deserializeMetadata(output),
1114
- };
1115
- break;
1116
- default:
1117
- const parsedBody = parsedOutput.body;
1118
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1119
- response = {
1120
- ...parsedBody,
1121
- name: `${errorCode}`,
1122
- message: parsedBody.message || parsedBody.Message || errorCode,
1123
- $fault: "client",
1124
- $metadata: deserializeMetadata(output),
1125
- } as any;
1126
- }
1127
- const message = response.message || response.Message || errorCode;
1128
- response.message = message;
1129
- delete response.Message;
1130
- return Promise.reject(Object.assign(new Error(message), response));
1131
- };
1132
-
1133
- export const deserializeAws_restJson1ListAlarmsCommand = async (
1134
- output: __HttpResponse,
1135
- context: __SerdeContext
1136
- ): Promise<ListAlarmsCommandOutput> => {
1137
- if (output.statusCode !== 200 && output.statusCode >= 300) {
1138
- return deserializeAws_restJson1ListAlarmsCommandError(output, context);
1139
- }
1140
- const contents: ListAlarmsCommandOutput = {
1141
- $metadata: deserializeMetadata(output),
1142
- alarmSummaries: undefined,
1143
- nextToken: undefined,
1144
- };
1145
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1146
- if (data.alarmSummaries !== undefined && data.alarmSummaries !== null) {
1147
- contents.alarmSummaries = deserializeAws_restJson1AlarmSummaries(data.alarmSummaries, context);
1148
- }
1149
- if (data.nextToken !== undefined && data.nextToken !== null) {
1150
- contents.nextToken = __expectString(data.nextToken);
1151
- }
1152
- return Promise.resolve(contents);
1153
- };
1154
-
1155
- const deserializeAws_restJson1ListAlarmsCommandError = async (
1156
- output: __HttpResponse,
1157
- context: __SerdeContext
1158
- ): Promise<ListAlarmsCommandOutput> => {
1159
- const parsedOutput: any = {
1160
- ...output,
1161
- body: await parseBody(output.body, context),
1162
- };
1163
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1164
- let errorCode: string = "UnknownError";
1165
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1166
- switch (errorCode) {
1167
- case "InternalFailureException":
1168
- case "com.amazonaws.ioteventsdata#InternalFailureException":
1169
- response = {
1170
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
1171
- name: errorCode,
1172
- $metadata: deserializeMetadata(output),
1173
- };
1174
- break;
1175
- case "InvalidRequestException":
1176
- case "com.amazonaws.ioteventsdata#InvalidRequestException":
1177
- response = {
1178
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
1179
- name: errorCode,
1180
- $metadata: deserializeMetadata(output),
1181
- };
1182
- break;
1183
- case "ResourceNotFoundException":
1184
- case "com.amazonaws.ioteventsdata#ResourceNotFoundException":
1185
- response = {
1186
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1187
- name: errorCode,
1188
- $metadata: deserializeMetadata(output),
1189
- };
1190
- break;
1191
- case "ServiceUnavailableException":
1192
- case "com.amazonaws.ioteventsdata#ServiceUnavailableException":
1193
- response = {
1194
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
1195
- name: errorCode,
1196
- $metadata: deserializeMetadata(output),
1197
- };
1198
- break;
1199
- case "ThrottlingException":
1200
- case "com.amazonaws.ioteventsdata#ThrottlingException":
1201
- response = {
1202
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1203
- name: errorCode,
1204
- $metadata: deserializeMetadata(output),
1205
- };
1206
- break;
1207
- default:
1208
- const parsedBody = parsedOutput.body;
1209
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1210
- response = {
1211
- ...parsedBody,
1212
- name: `${errorCode}`,
1213
- message: parsedBody.message || parsedBody.Message || errorCode,
1214
- $fault: "client",
1215
- $metadata: deserializeMetadata(output),
1216
- } as any;
1217
- }
1218
- const message = response.message || response.Message || errorCode;
1219
- response.message = message;
1220
- delete response.Message;
1221
- return Promise.reject(Object.assign(new Error(message), response));
1222
- };
1223
-
1224
- export const deserializeAws_restJson1ListDetectorsCommand = async (
1225
- output: __HttpResponse,
1226
- context: __SerdeContext
1227
- ): Promise<ListDetectorsCommandOutput> => {
1228
- if (output.statusCode !== 200 && output.statusCode >= 300) {
1229
- return deserializeAws_restJson1ListDetectorsCommandError(output, context);
1230
- }
1231
- const contents: ListDetectorsCommandOutput = {
1232
- $metadata: deserializeMetadata(output),
1233
- detectorSummaries: undefined,
1234
- nextToken: undefined,
1235
- };
1236
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1237
- if (data.detectorSummaries !== undefined && data.detectorSummaries !== null) {
1238
- contents.detectorSummaries = deserializeAws_restJson1DetectorSummaries(data.detectorSummaries, context);
1239
- }
1240
- if (data.nextToken !== undefined && data.nextToken !== null) {
1241
- contents.nextToken = __expectString(data.nextToken);
1242
- }
1243
- return Promise.resolve(contents);
1244
- };
1245
-
1246
- const deserializeAws_restJson1ListDetectorsCommandError = async (
1247
- output: __HttpResponse,
1248
- context: __SerdeContext
1249
- ): Promise<ListDetectorsCommandOutput> => {
1250
- const parsedOutput: any = {
1251
- ...output,
1252
- body: await parseBody(output.body, context),
1253
- };
1254
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1255
- let errorCode: string = "UnknownError";
1256
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1257
- switch (errorCode) {
1258
- case "InternalFailureException":
1259
- case "com.amazonaws.ioteventsdata#InternalFailureException":
1260
- response = {
1261
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
1262
- name: errorCode,
1263
- $metadata: deserializeMetadata(output),
1264
- };
1265
- break;
1266
- case "InvalidRequestException":
1267
- case "com.amazonaws.ioteventsdata#InvalidRequestException":
1268
- response = {
1269
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
1270
- name: errorCode,
1271
- $metadata: deserializeMetadata(output),
1272
- };
1273
- break;
1274
- case "ResourceNotFoundException":
1275
- case "com.amazonaws.ioteventsdata#ResourceNotFoundException":
1276
- response = {
1277
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1278
- name: errorCode,
1279
- $metadata: deserializeMetadata(output),
1280
- };
1281
- break;
1282
- case "ServiceUnavailableException":
1283
- case "com.amazonaws.ioteventsdata#ServiceUnavailableException":
1284
- response = {
1285
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
1286
- name: errorCode,
1287
- $metadata: deserializeMetadata(output),
1288
- };
1289
- break;
1290
- case "ThrottlingException":
1291
- case "com.amazonaws.ioteventsdata#ThrottlingException":
1292
- response = {
1293
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1294
- name: errorCode,
1295
- $metadata: deserializeMetadata(output),
1296
- };
1297
- break;
1298
- default:
1299
- const parsedBody = parsedOutput.body;
1300
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1301
- response = {
1302
- ...parsedBody,
1303
- name: `${errorCode}`,
1304
- message: parsedBody.message || parsedBody.Message || errorCode,
1305
- $fault: "client",
1306
- $metadata: deserializeMetadata(output),
1307
- } as any;
1308
- }
1309
- const message = response.message || response.Message || errorCode;
1310
- response.message = message;
1311
- delete response.Message;
1312
- return Promise.reject(Object.assign(new Error(message), response));
1313
- };
1314
-
1315
- const deserializeAws_restJson1InternalFailureExceptionResponse = async (
1316
- parsedOutput: any,
1317
- context: __SerdeContext
1318
- ): Promise<InternalFailureException> => {
1319
- const contents: InternalFailureException = {
1320
- name: "InternalFailureException",
1321
- $fault: "server",
1322
- $metadata: deserializeMetadata(parsedOutput),
1323
- message: undefined,
1324
- };
1325
- const data: any = parsedOutput.body;
1326
- if (data.message !== undefined && data.message !== null) {
1327
- contents.message = __expectString(data.message);
1328
- }
1329
- return contents;
1330
- };
1331
-
1332
- const deserializeAws_restJson1InvalidRequestExceptionResponse = async (
1333
- parsedOutput: any,
1334
- context: __SerdeContext
1335
- ): Promise<InvalidRequestException> => {
1336
- const contents: InvalidRequestException = {
1337
- name: "InvalidRequestException",
1338
- $fault: "client",
1339
- $metadata: deserializeMetadata(parsedOutput),
1340
- message: undefined,
1341
- };
1342
- const data: any = parsedOutput.body;
1343
- if (data.message !== undefined && data.message !== null) {
1344
- contents.message = __expectString(data.message);
1345
- }
1346
- return contents;
1347
- };
1348
-
1349
- const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (
1350
- parsedOutput: any,
1351
- context: __SerdeContext
1352
- ): Promise<ResourceNotFoundException> => {
1353
- const contents: ResourceNotFoundException = {
1354
- name: "ResourceNotFoundException",
1355
- $fault: "client",
1356
- $metadata: deserializeMetadata(parsedOutput),
1357
- message: undefined,
1358
- };
1359
- const data: any = parsedOutput.body;
1360
- if (data.message !== undefined && data.message !== null) {
1361
- contents.message = __expectString(data.message);
1362
- }
1363
- return contents;
1364
- };
1365
-
1366
- const deserializeAws_restJson1ServiceUnavailableExceptionResponse = async (
1367
- parsedOutput: any,
1368
- context: __SerdeContext
1369
- ): Promise<ServiceUnavailableException> => {
1370
- const contents: ServiceUnavailableException = {
1371
- name: "ServiceUnavailableException",
1372
- $fault: "server",
1373
- $metadata: deserializeMetadata(parsedOutput),
1374
- message: undefined,
1375
- };
1376
- const data: any = parsedOutput.body;
1377
- if (data.message !== undefined && data.message !== null) {
1378
- contents.message = __expectString(data.message);
1379
- }
1380
- return contents;
1381
- };
1382
-
1383
- const deserializeAws_restJson1ThrottlingExceptionResponse = async (
1384
- parsedOutput: any,
1385
- context: __SerdeContext
1386
- ): Promise<ThrottlingException> => {
1387
- const contents: ThrottlingException = {
1388
- name: "ThrottlingException",
1389
- $fault: "client",
1390
- $metadata: deserializeMetadata(parsedOutput),
1391
- message: undefined,
1392
- };
1393
- const data: any = parsedOutput.body;
1394
- if (data.message !== undefined && data.message !== null) {
1395
- contents.message = __expectString(data.message);
1396
- }
1397
- return contents;
1398
- };
1399
-
1400
- const serializeAws_restJson1AcknowledgeAlarmActionRequest = (
1401
- input: AcknowledgeAlarmActionRequest,
1402
- context: __SerdeContext
1403
- ): any => {
1404
- return {
1405
- ...(input.alarmModelName !== undefined &&
1406
- input.alarmModelName !== null && { alarmModelName: input.alarmModelName }),
1407
- ...(input.keyValue !== undefined && input.keyValue !== null && { keyValue: input.keyValue }),
1408
- ...(input.note !== undefined && input.note !== null && { note: input.note }),
1409
- ...(input.requestId !== undefined && input.requestId !== null && { requestId: input.requestId }),
1410
- };
1411
- };
1412
-
1413
- const serializeAws_restJson1AcknowledgeAlarmActionRequests = (
1414
- input: AcknowledgeAlarmActionRequest[],
1415
- context: __SerdeContext
1416
- ): any => {
1417
- return input
1418
- .filter((e: any) => e != null)
1419
- .map((entry) => {
1420
- if (entry === null) {
1421
- return null as any;
1422
- }
1423
- return serializeAws_restJson1AcknowledgeAlarmActionRequest(entry, context);
1424
- });
1425
- };
1426
-
1427
- const serializeAws_restJson1DetectorStateDefinition = (
1428
- input: DetectorStateDefinition,
1429
- context: __SerdeContext
1430
- ): any => {
1431
- return {
1432
- ...(input.stateName !== undefined && input.stateName !== null && { stateName: input.stateName }),
1433
- ...(input.timers !== undefined &&
1434
- input.timers !== null && { timers: serializeAws_restJson1TimerDefinitions(input.timers, context) }),
1435
- ...(input.variables !== undefined &&
1436
- input.variables !== null && { variables: serializeAws_restJson1VariableDefinitions(input.variables, context) }),
1437
- };
1438
- };
1439
-
1440
- const serializeAws_restJson1DisableAlarmActionRequest = (
1441
- input: DisableAlarmActionRequest,
1442
- context: __SerdeContext
1443
- ): any => {
1444
- return {
1445
- ...(input.alarmModelName !== undefined &&
1446
- input.alarmModelName !== null && { alarmModelName: input.alarmModelName }),
1447
- ...(input.keyValue !== undefined && input.keyValue !== null && { keyValue: input.keyValue }),
1448
- ...(input.note !== undefined && input.note !== null && { note: input.note }),
1449
- ...(input.requestId !== undefined && input.requestId !== null && { requestId: input.requestId }),
1450
- };
1451
- };
1452
-
1453
- const serializeAws_restJson1DisableAlarmActionRequests = (
1454
- input: DisableAlarmActionRequest[],
1455
- context: __SerdeContext
1456
- ): any => {
1457
- return input
1458
- .filter((e: any) => e != null)
1459
- .map((entry) => {
1460
- if (entry === null) {
1461
- return null as any;
1462
- }
1463
- return serializeAws_restJson1DisableAlarmActionRequest(entry, context);
1464
- });
1465
- };
1466
-
1467
- const serializeAws_restJson1EnableAlarmActionRequest = (
1468
- input: EnableAlarmActionRequest,
1469
- context: __SerdeContext
1470
- ): any => {
1471
- return {
1472
- ...(input.alarmModelName !== undefined &&
1473
- input.alarmModelName !== null && { alarmModelName: input.alarmModelName }),
1474
- ...(input.keyValue !== undefined && input.keyValue !== null && { keyValue: input.keyValue }),
1475
- ...(input.note !== undefined && input.note !== null && { note: input.note }),
1476
- ...(input.requestId !== undefined && input.requestId !== null && { requestId: input.requestId }),
1477
- };
1478
- };
1479
-
1480
- const serializeAws_restJson1EnableAlarmActionRequests = (
1481
- input: EnableAlarmActionRequest[],
1482
- context: __SerdeContext
1483
- ): any => {
1484
- return input
1485
- .filter((e: any) => e != null)
1486
- .map((entry) => {
1487
- if (entry === null) {
1488
- return null as any;
1489
- }
1490
- return serializeAws_restJson1EnableAlarmActionRequest(entry, context);
1491
- });
1492
- };
1493
-
1494
- const serializeAws_restJson1Message = (input: Message, context: __SerdeContext): any => {
1495
- return {
1496
- ...(input.inputName !== undefined && input.inputName !== null && { inputName: input.inputName }),
1497
- ...(input.messageId !== undefined && input.messageId !== null && { messageId: input.messageId }),
1498
- ...(input.payload !== undefined && input.payload !== null && { payload: context.base64Encoder(input.payload) }),
1499
- ...(input.timestamp !== undefined &&
1500
- input.timestamp !== null && { timestamp: serializeAws_restJson1TimestampValue(input.timestamp, context) }),
1501
- };
1502
- };
1503
-
1504
- const serializeAws_restJson1Messages = (input: Message[], context: __SerdeContext): any => {
1505
- return input
1506
- .filter((e: any) => e != null)
1507
- .map((entry) => {
1508
- if (entry === null) {
1509
- return null as any;
1510
- }
1511
- return serializeAws_restJson1Message(entry, context);
1512
- });
1513
- };
1514
-
1515
- const serializeAws_restJson1ResetAlarmActionRequest = (
1516
- input: ResetAlarmActionRequest,
1517
- context: __SerdeContext
1518
- ): any => {
1519
- return {
1520
- ...(input.alarmModelName !== undefined &&
1521
- input.alarmModelName !== null && { alarmModelName: input.alarmModelName }),
1522
- ...(input.keyValue !== undefined && input.keyValue !== null && { keyValue: input.keyValue }),
1523
- ...(input.note !== undefined && input.note !== null && { note: input.note }),
1524
- ...(input.requestId !== undefined && input.requestId !== null && { requestId: input.requestId }),
1525
- };
1526
- };
1527
-
1528
- const serializeAws_restJson1ResetAlarmActionRequests = (
1529
- input: ResetAlarmActionRequest[],
1530
- context: __SerdeContext
1531
- ): any => {
1532
- return input
1533
- .filter((e: any) => e != null)
1534
- .map((entry) => {
1535
- if (entry === null) {
1536
- return null as any;
1537
- }
1538
- return serializeAws_restJson1ResetAlarmActionRequest(entry, context);
1539
- });
1540
- };
1541
-
1542
- const serializeAws_restJson1SnoozeAlarmActionRequest = (
1543
- input: SnoozeAlarmActionRequest,
1544
- context: __SerdeContext
1545
- ): any => {
1546
- return {
1547
- ...(input.alarmModelName !== undefined &&
1548
- input.alarmModelName !== null && { alarmModelName: input.alarmModelName }),
1549
- ...(input.keyValue !== undefined && input.keyValue !== null && { keyValue: input.keyValue }),
1550
- ...(input.note !== undefined && input.note !== null && { note: input.note }),
1551
- ...(input.requestId !== undefined && input.requestId !== null && { requestId: input.requestId }),
1552
- ...(input.snoozeDuration !== undefined &&
1553
- input.snoozeDuration !== null && { snoozeDuration: input.snoozeDuration }),
1554
- };
1555
- };
1556
-
1557
- const serializeAws_restJson1SnoozeAlarmActionRequests = (
1558
- input: SnoozeAlarmActionRequest[],
1559
- context: __SerdeContext
1560
- ): any => {
1561
- return input
1562
- .filter((e: any) => e != null)
1563
- .map((entry) => {
1564
- if (entry === null) {
1565
- return null as any;
1566
- }
1567
- return serializeAws_restJson1SnoozeAlarmActionRequest(entry, context);
1568
- });
1569
- };
1570
-
1571
- const serializeAws_restJson1TimerDefinition = (input: TimerDefinition, context: __SerdeContext): any => {
1572
- return {
1573
- ...(input.name !== undefined && input.name !== null && { name: input.name }),
1574
- ...(input.seconds !== undefined && input.seconds !== null && { seconds: input.seconds }),
1575
- };
1576
- };
1577
-
1578
- const serializeAws_restJson1TimerDefinitions = (input: TimerDefinition[], context: __SerdeContext): any => {
1579
- return input
1580
- .filter((e: any) => e != null)
1581
- .map((entry) => {
1582
- if (entry === null) {
1583
- return null as any;
1584
- }
1585
- return serializeAws_restJson1TimerDefinition(entry, context);
1586
- });
1587
- };
1588
-
1589
- const serializeAws_restJson1TimestampValue = (input: TimestampValue, context: __SerdeContext): any => {
1590
- return {
1591
- ...(input.timeInMillis !== undefined && input.timeInMillis !== null && { timeInMillis: input.timeInMillis }),
1592
- };
1593
- };
1594
-
1595
- const serializeAws_restJson1UpdateDetectorRequest = (input: UpdateDetectorRequest, context: __SerdeContext): any => {
1596
- return {
1597
- ...(input.detectorModelName !== undefined &&
1598
- input.detectorModelName !== null && { detectorModelName: input.detectorModelName }),
1599
- ...(input.keyValue !== undefined && input.keyValue !== null && { keyValue: input.keyValue }),
1600
- ...(input.messageId !== undefined && input.messageId !== null && { messageId: input.messageId }),
1601
- ...(input.state !== undefined &&
1602
- input.state !== null && { state: serializeAws_restJson1DetectorStateDefinition(input.state, context) }),
1603
- };
1604
- };
1605
-
1606
- const serializeAws_restJson1UpdateDetectorRequests = (input: UpdateDetectorRequest[], context: __SerdeContext): any => {
1607
- return input
1608
- .filter((e: any) => e != null)
1609
- .map((entry) => {
1610
- if (entry === null) {
1611
- return null as any;
1612
- }
1613
- return serializeAws_restJson1UpdateDetectorRequest(entry, context);
1614
- });
1615
- };
1616
-
1617
- const serializeAws_restJson1VariableDefinition = (input: VariableDefinition, context: __SerdeContext): any => {
1618
- return {
1619
- ...(input.name !== undefined && input.name !== null && { name: input.name }),
1620
- ...(input.value !== undefined && input.value !== null && { value: input.value }),
1621
- };
1622
- };
1623
-
1624
- const serializeAws_restJson1VariableDefinitions = (input: VariableDefinition[], context: __SerdeContext): any => {
1625
- return input
1626
- .filter((e: any) => e != null)
1627
- .map((entry) => {
1628
- if (entry === null) {
1629
- return null as any;
1630
- }
1631
- return serializeAws_restJson1VariableDefinition(entry, context);
1632
- });
1633
- };
1634
-
1635
- const deserializeAws_restJson1AcknowledgeActionConfiguration = (
1636
- output: any,
1637
- context: __SerdeContext
1638
- ): AcknowledgeActionConfiguration => {
1639
- return {
1640
- note: __expectString(output.note),
1641
- } as any;
1642
- };
1643
-
1644
- const deserializeAws_restJson1Alarm = (output: any, context: __SerdeContext): Alarm => {
1645
- return {
1646
- alarmModelName: __expectString(output.alarmModelName),
1647
- alarmModelVersion: __expectString(output.alarmModelVersion),
1648
- alarmState:
1649
- output.alarmState !== undefined && output.alarmState !== null
1650
- ? deserializeAws_restJson1AlarmState(output.alarmState, context)
1651
- : undefined,
1652
- creationTime:
1653
- output.creationTime !== undefined && output.creationTime !== null
1654
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.creationTime)))
1655
- : undefined,
1656
- keyValue: __expectString(output.keyValue),
1657
- lastUpdateTime:
1658
- output.lastUpdateTime !== undefined && output.lastUpdateTime !== null
1659
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.lastUpdateTime)))
1660
- : undefined,
1661
- severity: __expectInt32(output.severity),
1662
- } as any;
1663
- };
1664
-
1665
- const deserializeAws_restJson1AlarmState = (output: any, context: __SerdeContext): AlarmState => {
1666
- return {
1667
- customerAction:
1668
- output.customerAction !== undefined && output.customerAction !== null
1669
- ? deserializeAws_restJson1CustomerAction(output.customerAction, context)
1670
- : undefined,
1671
- ruleEvaluation:
1672
- output.ruleEvaluation !== undefined && output.ruleEvaluation !== null
1673
- ? deserializeAws_restJson1RuleEvaluation(output.ruleEvaluation, context)
1674
- : undefined,
1675
- stateName: __expectString(output.stateName),
1676
- systemEvent:
1677
- output.systemEvent !== undefined && output.systemEvent !== null
1678
- ? deserializeAws_restJson1SystemEvent(output.systemEvent, context)
1679
- : undefined,
1680
- } as any;
1681
- };
1682
-
1683
- const deserializeAws_restJson1AlarmSummaries = (output: any, context: __SerdeContext): AlarmSummary[] => {
1684
- return (output || [])
1685
- .filter((e: any) => e != null)
1686
- .map((entry: any) => {
1687
- if (entry === null) {
1688
- return null as any;
1689
- }
1690
- return deserializeAws_restJson1AlarmSummary(entry, context);
1691
- });
1692
- };
1693
-
1694
- const deserializeAws_restJson1AlarmSummary = (output: any, context: __SerdeContext): AlarmSummary => {
1695
- return {
1696
- alarmModelName: __expectString(output.alarmModelName),
1697
- alarmModelVersion: __expectString(output.alarmModelVersion),
1698
- creationTime:
1699
- output.creationTime !== undefined && output.creationTime !== null
1700
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.creationTime)))
1701
- : undefined,
1702
- keyValue: __expectString(output.keyValue),
1703
- lastUpdateTime:
1704
- output.lastUpdateTime !== undefined && output.lastUpdateTime !== null
1705
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.lastUpdateTime)))
1706
- : undefined,
1707
- stateName: __expectString(output.stateName),
1708
- } as any;
1709
- };
1710
-
1711
- const deserializeAws_restJson1BatchAlarmActionErrorEntries = (
1712
- output: any,
1713
- context: __SerdeContext
1714
- ): BatchAlarmActionErrorEntry[] => {
1715
- return (output || [])
1716
- .filter((e: any) => e != null)
1717
- .map((entry: any) => {
1718
- if (entry === null) {
1719
- return null as any;
1720
- }
1721
- return deserializeAws_restJson1BatchAlarmActionErrorEntry(entry, context);
1722
- });
1723
- };
1724
-
1725
- const deserializeAws_restJson1BatchAlarmActionErrorEntry = (
1726
- output: any,
1727
- context: __SerdeContext
1728
- ): BatchAlarmActionErrorEntry => {
1729
- return {
1730
- errorCode: __expectString(output.errorCode),
1731
- errorMessage: __expectString(output.errorMessage),
1732
- requestId: __expectString(output.requestId),
1733
- } as any;
1734
- };
1735
-
1736
- const deserializeAws_restJson1BatchPutMessageErrorEntries = (
1737
- output: any,
1738
- context: __SerdeContext
1739
- ): BatchPutMessageErrorEntry[] => {
1740
- return (output || [])
1741
- .filter((e: any) => e != null)
1742
- .map((entry: any) => {
1743
- if (entry === null) {
1744
- return null as any;
1745
- }
1746
- return deserializeAws_restJson1BatchPutMessageErrorEntry(entry, context);
1747
- });
1748
- };
1749
-
1750
- const deserializeAws_restJson1BatchPutMessageErrorEntry = (
1751
- output: any,
1752
- context: __SerdeContext
1753
- ): BatchPutMessageErrorEntry => {
1754
- return {
1755
- errorCode: __expectString(output.errorCode),
1756
- errorMessage: __expectString(output.errorMessage),
1757
- messageId: __expectString(output.messageId),
1758
- } as any;
1759
- };
1760
-
1761
- const deserializeAws_restJson1BatchUpdateDetectorErrorEntries = (
1762
- output: any,
1763
- context: __SerdeContext
1764
- ): BatchUpdateDetectorErrorEntry[] => {
1765
- return (output || [])
1766
- .filter((e: any) => e != null)
1767
- .map((entry: any) => {
1768
- if (entry === null) {
1769
- return null as any;
1770
- }
1771
- return deserializeAws_restJson1BatchUpdateDetectorErrorEntry(entry, context);
1772
- });
1773
- };
1774
-
1775
- const deserializeAws_restJson1BatchUpdateDetectorErrorEntry = (
1776
- output: any,
1777
- context: __SerdeContext
1778
- ): BatchUpdateDetectorErrorEntry => {
1779
- return {
1780
- errorCode: __expectString(output.errorCode),
1781
- errorMessage: __expectString(output.errorMessage),
1782
- messageId: __expectString(output.messageId),
1783
- } as any;
1784
- };
1785
-
1786
- const deserializeAws_restJson1CustomerAction = (output: any, context: __SerdeContext): CustomerAction => {
1787
- return {
1788
- acknowledgeActionConfiguration:
1789
- output.acknowledgeActionConfiguration !== undefined && output.acknowledgeActionConfiguration !== null
1790
- ? deserializeAws_restJson1AcknowledgeActionConfiguration(output.acknowledgeActionConfiguration, context)
1791
- : undefined,
1792
- actionName: __expectString(output.actionName),
1793
- disableActionConfiguration:
1794
- output.disableActionConfiguration !== undefined && output.disableActionConfiguration !== null
1795
- ? deserializeAws_restJson1DisableActionConfiguration(output.disableActionConfiguration, context)
1796
- : undefined,
1797
- enableActionConfiguration:
1798
- output.enableActionConfiguration !== undefined && output.enableActionConfiguration !== null
1799
- ? deserializeAws_restJson1EnableActionConfiguration(output.enableActionConfiguration, context)
1800
- : undefined,
1801
- resetActionConfiguration:
1802
- output.resetActionConfiguration !== undefined && output.resetActionConfiguration !== null
1803
- ? deserializeAws_restJson1ResetActionConfiguration(output.resetActionConfiguration, context)
1804
- : undefined,
1805
- snoozeActionConfiguration:
1806
- output.snoozeActionConfiguration !== undefined && output.snoozeActionConfiguration !== null
1807
- ? deserializeAws_restJson1SnoozeActionConfiguration(output.snoozeActionConfiguration, context)
1808
- : undefined,
1809
- } as any;
1810
- };
1811
-
1812
- const deserializeAws_restJson1Detector = (output: any, context: __SerdeContext): Detector => {
1813
- return {
1814
- creationTime:
1815
- output.creationTime !== undefined && output.creationTime !== null
1816
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.creationTime)))
1817
- : undefined,
1818
- detectorModelName: __expectString(output.detectorModelName),
1819
- detectorModelVersion: __expectString(output.detectorModelVersion),
1820
- keyValue: __expectString(output.keyValue),
1821
- lastUpdateTime:
1822
- output.lastUpdateTime !== undefined && output.lastUpdateTime !== null
1823
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.lastUpdateTime)))
1824
- : undefined,
1825
- state:
1826
- output.state !== undefined && output.state !== null
1827
- ? deserializeAws_restJson1DetectorState(output.state, context)
1828
- : undefined,
1829
- } as any;
1830
- };
1831
-
1832
- const deserializeAws_restJson1DetectorState = (output: any, context: __SerdeContext): DetectorState => {
1833
- return {
1834
- stateName: __expectString(output.stateName),
1835
- timers:
1836
- output.timers !== undefined && output.timers !== null
1837
- ? deserializeAws_restJson1Timers(output.timers, context)
1838
- : undefined,
1839
- variables:
1840
- output.variables !== undefined && output.variables !== null
1841
- ? deserializeAws_restJson1Variables(output.variables, context)
1842
- : undefined,
1843
- } as any;
1844
- };
1845
-
1846
- const deserializeAws_restJson1DetectorStateSummary = (output: any, context: __SerdeContext): DetectorStateSummary => {
1847
- return {
1848
- stateName: __expectString(output.stateName),
1849
- } as any;
1850
- };
1851
-
1852
- const deserializeAws_restJson1DetectorSummaries = (output: any, context: __SerdeContext): DetectorSummary[] => {
1853
- return (output || [])
1854
- .filter((e: any) => e != null)
1855
- .map((entry: any) => {
1856
- if (entry === null) {
1857
- return null as any;
1858
- }
1859
- return deserializeAws_restJson1DetectorSummary(entry, context);
1860
- });
1861
- };
1862
-
1863
- const deserializeAws_restJson1DetectorSummary = (output: any, context: __SerdeContext): DetectorSummary => {
1864
- return {
1865
- creationTime:
1866
- output.creationTime !== undefined && output.creationTime !== null
1867
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.creationTime)))
1868
- : undefined,
1869
- detectorModelName: __expectString(output.detectorModelName),
1870
- detectorModelVersion: __expectString(output.detectorModelVersion),
1871
- keyValue: __expectString(output.keyValue),
1872
- lastUpdateTime:
1873
- output.lastUpdateTime !== undefined && output.lastUpdateTime !== null
1874
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.lastUpdateTime)))
1875
- : undefined,
1876
- state:
1877
- output.state !== undefined && output.state !== null
1878
- ? deserializeAws_restJson1DetectorStateSummary(output.state, context)
1879
- : undefined,
1880
- } as any;
1881
- };
1882
-
1883
- const deserializeAws_restJson1DisableActionConfiguration = (
1884
- output: any,
1885
- context: __SerdeContext
1886
- ): DisableActionConfiguration => {
1887
- return {
1888
- note: __expectString(output.note),
1889
- } as any;
1890
- };
1891
-
1892
- const deserializeAws_restJson1EnableActionConfiguration = (
1893
- output: any,
1894
- context: __SerdeContext
1895
- ): EnableActionConfiguration => {
1896
- return {
1897
- note: __expectString(output.note),
1898
- } as any;
1899
- };
1900
-
1901
- const deserializeAws_restJson1ResetActionConfiguration = (
1902
- output: any,
1903
- context: __SerdeContext
1904
- ): ResetActionConfiguration => {
1905
- return {
1906
- note: __expectString(output.note),
1907
- } as any;
1908
- };
1909
-
1910
- const deserializeAws_restJson1RuleEvaluation = (output: any, context: __SerdeContext): RuleEvaluation => {
1911
- return {
1912
- simpleRuleEvaluation:
1913
- output.simpleRuleEvaluation !== undefined && output.simpleRuleEvaluation !== null
1914
- ? deserializeAws_restJson1SimpleRuleEvaluation(output.simpleRuleEvaluation, context)
1915
- : undefined,
1916
- } as any;
1917
- };
1918
-
1919
- const deserializeAws_restJson1SimpleRuleEvaluation = (output: any, context: __SerdeContext): SimpleRuleEvaluation => {
1920
- return {
1921
- inputPropertyValue: __expectString(output.inputPropertyValue),
1922
- operator: __expectString(output.operator),
1923
- thresholdValue: __expectString(output.thresholdValue),
1924
- } as any;
1925
- };
1926
-
1927
- const deserializeAws_restJson1SnoozeActionConfiguration = (
1928
- output: any,
1929
- context: __SerdeContext
1930
- ): SnoozeActionConfiguration => {
1931
- return {
1932
- note: __expectString(output.note),
1933
- snoozeDuration: __expectInt32(output.snoozeDuration),
1934
- } as any;
1935
- };
1936
-
1937
- const deserializeAws_restJson1StateChangeConfiguration = (
1938
- output: any,
1939
- context: __SerdeContext
1940
- ): StateChangeConfiguration => {
1941
- return {
1942
- triggerType: __expectString(output.triggerType),
1943
- } as any;
1944
- };
1945
-
1946
- const deserializeAws_restJson1SystemEvent = (output: any, context: __SerdeContext): SystemEvent => {
1947
- return {
1948
- eventType: __expectString(output.eventType),
1949
- stateChangeConfiguration:
1950
- output.stateChangeConfiguration !== undefined && output.stateChangeConfiguration !== null
1951
- ? deserializeAws_restJson1StateChangeConfiguration(output.stateChangeConfiguration, context)
1952
- : undefined,
1953
- } as any;
1954
- };
1955
-
1956
- const deserializeAws_restJson1Timer = (output: any, context: __SerdeContext): Timer => {
1957
- return {
1958
- name: __expectString(output.name),
1959
- timestamp:
1960
- output.timestamp !== undefined && output.timestamp !== null
1961
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.timestamp)))
1962
- : undefined,
1963
- } as any;
1964
- };
1965
-
1966
- const deserializeAws_restJson1Timers = (output: any, context: __SerdeContext): Timer[] => {
1967
- return (output || [])
1968
- .filter((e: any) => e != null)
1969
- .map((entry: any) => {
1970
- if (entry === null) {
1971
- return null as any;
1972
- }
1973
- return deserializeAws_restJson1Timer(entry, context);
1974
- });
1975
- };
1976
-
1977
- const deserializeAws_restJson1Variable = (output: any, context: __SerdeContext): Variable => {
1978
- return {
1979
- name: __expectString(output.name),
1980
- value: __expectString(output.value),
1981
- } as any;
1982
- };
1983
-
1984
- const deserializeAws_restJson1Variables = (output: any, context: __SerdeContext): Variable[] => {
1985
- return (output || [])
1986
- .filter((e: any) => e != null)
1987
- .map((entry: any) => {
1988
- if (entry === null) {
1989
- return null as any;
1990
- }
1991
- return deserializeAws_restJson1Variable(entry, context);
1992
- });
1993
- };
1994
-
1995
- const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
1996
- httpStatusCode: output.statusCode,
1997
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
1998
- extendedRequestId: output.headers["x-amz-id-2"],
1999
- cfId: output.headers["x-amz-cf-id"],
2000
- });
2001
-
2002
- // Collect low-level response body stream to Uint8Array.
2003
- const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
2004
- if (streamBody instanceof Uint8Array) {
2005
- return Promise.resolve(streamBody);
2006
- }
2007
- return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
2008
- };
2009
-
2010
- // Encode Uint8Array data into string with utf-8.
2011
- const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
2012
- collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
2013
-
2014
- const isSerializableHeaderValue = (value: any): boolean =>
2015
- value !== undefined &&
2016
- value !== null &&
2017
- value !== "" &&
2018
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
2019
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
2020
-
2021
- const parseBody = (streamBody: any, context: __SerdeContext): any =>
2022
- collectBodyString(streamBody, context).then((encoded) => {
2023
- if (encoded.length) {
2024
- return JSON.parse(encoded);
2025
- }
2026
- return {};
2027
- });
2028
-
2029
- /**
2030
- * Load an error code for the aws.rest-json-1.1 protocol.
2031
- */
2032
- const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => {
2033
- const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
2034
-
2035
- const sanitizeErrorCode = (rawValue: string): string => {
2036
- let cleanValue = rawValue;
2037
- if (cleanValue.indexOf(":") >= 0) {
2038
- cleanValue = cleanValue.split(":")[0];
2039
- }
2040
- if (cleanValue.indexOf("#") >= 0) {
2041
- cleanValue = cleanValue.split("#")[1];
2042
- }
2043
- return cleanValue;
2044
- };
2045
-
2046
- const headerKey = findKey(output.headers, "x-amzn-errortype");
2047
- if (headerKey !== undefined) {
2048
- return sanitizeErrorCode(output.headers[headerKey]);
2049
- }
2050
-
2051
- if (data.code !== undefined) {
2052
- return sanitizeErrorCode(data.code);
2053
- }
2054
-
2055
- if (data["__type"] !== undefined) {
2056
- return sanitizeErrorCode(data["__type"]);
2057
- }
2058
-
2059
- return "";
2060
- };