@aws-sdk/client-amp 3.35.0 → 3.36.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 (171) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist-cjs/Amp.js +0 -1
  3. package/dist-cjs/AmpClient.js +0 -1
  4. package/dist-cjs/commands/CreateAlertManagerDefinitionCommand.js +0 -1
  5. package/dist-cjs/commands/CreateRuleGroupsNamespaceCommand.js +0 -1
  6. package/dist-cjs/commands/CreateWorkspaceCommand.js +0 -1
  7. package/dist-cjs/commands/DeleteAlertManagerDefinitionCommand.js +0 -1
  8. package/dist-cjs/commands/DeleteRuleGroupsNamespaceCommand.js +0 -1
  9. package/dist-cjs/commands/DeleteWorkspaceCommand.js +0 -1
  10. package/dist-cjs/commands/DescribeAlertManagerDefinitionCommand.js +0 -1
  11. package/dist-cjs/commands/DescribeRuleGroupsNamespaceCommand.js +0 -1
  12. package/dist-cjs/commands/DescribeWorkspaceCommand.js +0 -1
  13. package/dist-cjs/commands/ListRuleGroupsNamespacesCommand.js +0 -1
  14. package/dist-cjs/commands/ListTagsForResourceCommand.js +0 -1
  15. package/dist-cjs/commands/ListWorkspacesCommand.js +0 -1
  16. package/dist-cjs/commands/PutAlertManagerDefinitionCommand.js +0 -1
  17. package/dist-cjs/commands/PutRuleGroupsNamespaceCommand.js +0 -1
  18. package/dist-cjs/commands/TagResourceCommand.js +0 -1
  19. package/dist-cjs/commands/UntagResourceCommand.js +0 -1
  20. package/dist-cjs/commands/UpdateWorkspaceAliasCommand.js +0 -1
  21. package/dist-cjs/endpoints.js +0 -1
  22. package/dist-cjs/index.js +0 -1
  23. package/dist-cjs/models/index.js +0 -1
  24. package/dist-cjs/models/models_0.js +0 -1
  25. package/dist-cjs/pagination/Interfaces.js +0 -1
  26. package/dist-cjs/pagination/ListRuleGroupsNamespacesPaginator.js +0 -1
  27. package/dist-cjs/pagination/ListWorkspacesPaginator.js +0 -1
  28. package/dist-cjs/protocols/Aws_restJson1.js +0 -1
  29. package/dist-cjs/runtimeConfig.browser.js +2 -3
  30. package/dist-cjs/runtimeConfig.js +3 -4
  31. package/dist-cjs/runtimeConfig.native.js +0 -1
  32. package/dist-cjs/runtimeConfig.shared.js +0 -1
  33. package/dist-cjs/waiters/waitForWorkspaceActive.js +0 -1
  34. package/dist-cjs/waiters/waitForWorkspaceDeleted.js +0 -1
  35. package/dist-es/Amp.js +0 -1
  36. package/dist-es/AmpClient.js +0 -1
  37. package/dist-es/commands/CreateAlertManagerDefinitionCommand.js +0 -1
  38. package/dist-es/commands/CreateRuleGroupsNamespaceCommand.js +0 -1
  39. package/dist-es/commands/CreateWorkspaceCommand.js +0 -1
  40. package/dist-es/commands/DeleteAlertManagerDefinitionCommand.js +0 -1
  41. package/dist-es/commands/DeleteRuleGroupsNamespaceCommand.js +0 -1
  42. package/dist-es/commands/DeleteWorkspaceCommand.js +0 -1
  43. package/dist-es/commands/DescribeAlertManagerDefinitionCommand.js +0 -1
  44. package/dist-es/commands/DescribeRuleGroupsNamespaceCommand.js +0 -1
  45. package/dist-es/commands/DescribeWorkspaceCommand.js +0 -1
  46. package/dist-es/commands/ListRuleGroupsNamespacesCommand.js +0 -1
  47. package/dist-es/commands/ListTagsForResourceCommand.js +0 -1
  48. package/dist-es/commands/ListWorkspacesCommand.js +0 -1
  49. package/dist-es/commands/PutAlertManagerDefinitionCommand.js +0 -1
  50. package/dist-es/commands/PutRuleGroupsNamespaceCommand.js +0 -1
  51. package/dist-es/commands/TagResourceCommand.js +0 -1
  52. package/dist-es/commands/UntagResourceCommand.js +0 -1
  53. package/dist-es/commands/UpdateWorkspaceAliasCommand.js +0 -1
  54. package/dist-es/endpoints.js +0 -1
  55. package/dist-es/index.js +0 -1
  56. package/dist-es/models/index.js +0 -1
  57. package/dist-es/models/models_0.js +0 -1
  58. package/dist-es/pagination/Interfaces.js +0 -1
  59. package/dist-es/pagination/ListRuleGroupsNamespacesPaginator.js +0 -1
  60. package/dist-es/pagination/ListWorkspacesPaginator.js +0 -1
  61. package/dist-es/protocols/Aws_restJson1.js +0 -1
  62. package/dist-es/runtimeConfig.browser.js +1 -2
  63. package/dist-es/runtimeConfig.js +2 -3
  64. package/dist-es/runtimeConfig.native.js +0 -1
  65. package/dist-es/runtimeConfig.shared.js +0 -1
  66. package/dist-es/waiters/waitForWorkspaceActive.js +0 -1
  67. package/dist-es/waiters/waitForWorkspaceDeleted.js +0 -1
  68. package/package.json +34 -31
  69. package/dist-cjs/Amp.js.map +0 -1
  70. package/dist-cjs/AmpClient.js.map +0 -1
  71. package/dist-cjs/commands/CreateAlertManagerDefinitionCommand.js.map +0 -1
  72. package/dist-cjs/commands/CreateRuleGroupsNamespaceCommand.js.map +0 -1
  73. package/dist-cjs/commands/CreateWorkspaceCommand.js.map +0 -1
  74. package/dist-cjs/commands/DeleteAlertManagerDefinitionCommand.js.map +0 -1
  75. package/dist-cjs/commands/DeleteRuleGroupsNamespaceCommand.js.map +0 -1
  76. package/dist-cjs/commands/DeleteWorkspaceCommand.js.map +0 -1
  77. package/dist-cjs/commands/DescribeAlertManagerDefinitionCommand.js.map +0 -1
  78. package/dist-cjs/commands/DescribeRuleGroupsNamespaceCommand.js.map +0 -1
  79. package/dist-cjs/commands/DescribeWorkspaceCommand.js.map +0 -1
  80. package/dist-cjs/commands/ListRuleGroupsNamespacesCommand.js.map +0 -1
  81. package/dist-cjs/commands/ListTagsForResourceCommand.js.map +0 -1
  82. package/dist-cjs/commands/ListWorkspacesCommand.js.map +0 -1
  83. package/dist-cjs/commands/PutAlertManagerDefinitionCommand.js.map +0 -1
  84. package/dist-cjs/commands/PutRuleGroupsNamespaceCommand.js.map +0 -1
  85. package/dist-cjs/commands/TagResourceCommand.js.map +0 -1
  86. package/dist-cjs/commands/UntagResourceCommand.js.map +0 -1
  87. package/dist-cjs/commands/UpdateWorkspaceAliasCommand.js.map +0 -1
  88. package/dist-cjs/endpoints.js.map +0 -1
  89. package/dist-cjs/index.js.map +0 -1
  90. package/dist-cjs/models/index.js.map +0 -1
  91. package/dist-cjs/models/models_0.js.map +0 -1
  92. package/dist-cjs/pagination/Interfaces.js.map +0 -1
  93. package/dist-cjs/pagination/ListRuleGroupsNamespacesPaginator.js.map +0 -1
  94. package/dist-cjs/pagination/ListWorkspacesPaginator.js.map +0 -1
  95. package/dist-cjs/protocols/Aws_restJson1.js.map +0 -1
  96. package/dist-cjs/runtimeConfig.browser.js.map +0 -1
  97. package/dist-cjs/runtimeConfig.js.map +0 -1
  98. package/dist-cjs/runtimeConfig.native.js.map +0 -1
  99. package/dist-cjs/runtimeConfig.shared.js.map +0 -1
  100. package/dist-cjs/waiters/waitForWorkspaceActive.js.map +0 -1
  101. package/dist-cjs/waiters/waitForWorkspaceDeleted.js.map +0 -1
  102. package/dist-es/Amp.js.map +0 -1
  103. package/dist-es/AmpClient.js.map +0 -1
  104. package/dist-es/commands/CreateAlertManagerDefinitionCommand.js.map +0 -1
  105. package/dist-es/commands/CreateRuleGroupsNamespaceCommand.js.map +0 -1
  106. package/dist-es/commands/CreateWorkspaceCommand.js.map +0 -1
  107. package/dist-es/commands/DeleteAlertManagerDefinitionCommand.js.map +0 -1
  108. package/dist-es/commands/DeleteRuleGroupsNamespaceCommand.js.map +0 -1
  109. package/dist-es/commands/DeleteWorkspaceCommand.js.map +0 -1
  110. package/dist-es/commands/DescribeAlertManagerDefinitionCommand.js.map +0 -1
  111. package/dist-es/commands/DescribeRuleGroupsNamespaceCommand.js.map +0 -1
  112. package/dist-es/commands/DescribeWorkspaceCommand.js.map +0 -1
  113. package/dist-es/commands/ListRuleGroupsNamespacesCommand.js.map +0 -1
  114. package/dist-es/commands/ListTagsForResourceCommand.js.map +0 -1
  115. package/dist-es/commands/ListWorkspacesCommand.js.map +0 -1
  116. package/dist-es/commands/PutAlertManagerDefinitionCommand.js.map +0 -1
  117. package/dist-es/commands/PutRuleGroupsNamespaceCommand.js.map +0 -1
  118. package/dist-es/commands/TagResourceCommand.js.map +0 -1
  119. package/dist-es/commands/UntagResourceCommand.js.map +0 -1
  120. package/dist-es/commands/UpdateWorkspaceAliasCommand.js.map +0 -1
  121. package/dist-es/endpoints.js.map +0 -1
  122. package/dist-es/index.js.map +0 -1
  123. package/dist-es/models/index.js.map +0 -1
  124. package/dist-es/models/models_0.js.map +0 -1
  125. package/dist-es/pagination/Interfaces.js.map +0 -1
  126. package/dist-es/pagination/ListRuleGroupsNamespacesPaginator.js.map +0 -1
  127. package/dist-es/pagination/ListWorkspacesPaginator.js.map +0 -1
  128. package/dist-es/protocols/Aws_restJson1.js.map +0 -1
  129. package/dist-es/runtimeConfig.browser.js.map +0 -1
  130. package/dist-es/runtimeConfig.js.map +0 -1
  131. package/dist-es/runtimeConfig.native.js.map +0 -1
  132. package/dist-es/runtimeConfig.shared.js.map +0 -1
  133. package/dist-es/waiters/waitForWorkspaceActive.js.map +0 -1
  134. package/dist-es/waiters/waitForWorkspaceDeleted.js.map +0 -1
  135. package/jest.config.js +0 -4
  136. package/src/Amp.ts +0 -627
  137. package/src/AmpClient.ts +0 -320
  138. package/src/commands/CreateAlertManagerDefinitionCommand.ts +0 -100
  139. package/src/commands/CreateRuleGroupsNamespaceCommand.ts +0 -98
  140. package/src/commands/CreateWorkspaceCommand.ts +0 -95
  141. package/src/commands/DeleteAlertManagerDefinitionCommand.ts +0 -98
  142. package/src/commands/DeleteRuleGroupsNamespaceCommand.ts +0 -98
  143. package/src/commands/DeleteWorkspaceCommand.ts +0 -95
  144. package/src/commands/DescribeAlertManagerDefinitionCommand.ts +0 -103
  145. package/src/commands/DescribeRuleGroupsNamespaceCommand.ts +0 -100
  146. package/src/commands/DescribeWorkspaceCommand.ts +0 -95
  147. package/src/commands/ListRuleGroupsNamespacesCommand.ts +0 -95
  148. package/src/commands/ListTagsForResourceCommand.ts +0 -95
  149. package/src/commands/ListWorkspacesCommand.ts +0 -95
  150. package/src/commands/PutAlertManagerDefinitionCommand.ts +0 -98
  151. package/src/commands/PutRuleGroupsNamespaceCommand.ts +0 -95
  152. package/src/commands/TagResourceCommand.ts +0 -95
  153. package/src/commands/UntagResourceCommand.ts +0 -95
  154. package/src/commands/UpdateWorkspaceAliasCommand.ts +0 -95
  155. package/src/endpoints.ts +0 -57
  156. package/src/index.ts +0 -25
  157. package/src/models/index.ts +0 -1
  158. package/src/models/models_0.ts +0 -1347
  159. package/src/pagination/Interfaces.ts +0 -8
  160. package/src/pagination/ListRuleGroupsNamespacesPaginator.ts +0 -59
  161. package/src/pagination/ListWorkspacesPaginator.ts +0 -59
  162. package/src/protocols/Aws_restJson1.ts +0 -2735
  163. package/src/runtimeConfig.browser.ts +0 -41
  164. package/src/runtimeConfig.native.ts +0 -17
  165. package/src/runtimeConfig.shared.ts +0 -17
  166. package/src/runtimeConfig.ts +0 -46
  167. package/src/waiters/waitForWorkspaceActive.ts +0 -63
  168. package/src/waiters/waitForWorkspaceDeleted.ts +0 -50
  169. package/tsconfig.es.json +0 -10
  170. package/tsconfig.json +0 -33
  171. package/tsconfig.types.json +0 -9
@@ -1,2735 +0,0 @@
1
- import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
2
- import {
3
- expectNonNull as __expectNonNull,
4
- expectNumber as __expectNumber,
5
- expectObject as __expectObject,
6
- expectString as __expectString,
7
- extendedEncodeURIComponent as __extendedEncodeURIComponent,
8
- parseEpochTimestamp as __parseEpochTimestamp,
9
- strictParseInt32 as __strictParseInt32,
10
- } from "@aws-sdk/smithy-client";
11
- import {
12
- Endpoint as __Endpoint,
13
- MetadataBearer as __MetadataBearer,
14
- ResponseMetadata as __ResponseMetadata,
15
- SerdeContext as __SerdeContext,
16
- SmithyException as __SmithyException,
17
- } from "@aws-sdk/types";
18
- import { v4 as generateIdempotencyToken } from "uuid";
19
-
20
- import {
21
- CreateAlertManagerDefinitionCommandInput,
22
- CreateAlertManagerDefinitionCommandOutput,
23
- } from "../commands/CreateAlertManagerDefinitionCommand";
24
- import {
25
- CreateRuleGroupsNamespaceCommandInput,
26
- CreateRuleGroupsNamespaceCommandOutput,
27
- } from "../commands/CreateRuleGroupsNamespaceCommand";
28
- import { CreateWorkspaceCommandInput, CreateWorkspaceCommandOutput } from "../commands/CreateWorkspaceCommand";
29
- import {
30
- DeleteAlertManagerDefinitionCommandInput,
31
- DeleteAlertManagerDefinitionCommandOutput,
32
- } from "../commands/DeleteAlertManagerDefinitionCommand";
33
- import {
34
- DeleteRuleGroupsNamespaceCommandInput,
35
- DeleteRuleGroupsNamespaceCommandOutput,
36
- } from "../commands/DeleteRuleGroupsNamespaceCommand";
37
- import { DeleteWorkspaceCommandInput, DeleteWorkspaceCommandOutput } from "../commands/DeleteWorkspaceCommand";
38
- import {
39
- DescribeAlertManagerDefinitionCommandInput,
40
- DescribeAlertManagerDefinitionCommandOutput,
41
- } from "../commands/DescribeAlertManagerDefinitionCommand";
42
- import {
43
- DescribeRuleGroupsNamespaceCommandInput,
44
- DescribeRuleGroupsNamespaceCommandOutput,
45
- } from "../commands/DescribeRuleGroupsNamespaceCommand";
46
- import { DescribeWorkspaceCommandInput, DescribeWorkspaceCommandOutput } from "../commands/DescribeWorkspaceCommand";
47
- import {
48
- ListRuleGroupsNamespacesCommandInput,
49
- ListRuleGroupsNamespacesCommandOutput,
50
- } from "../commands/ListRuleGroupsNamespacesCommand";
51
- import {
52
- ListTagsForResourceCommandInput,
53
- ListTagsForResourceCommandOutput,
54
- } from "../commands/ListTagsForResourceCommand";
55
- import { ListWorkspacesCommandInput, ListWorkspacesCommandOutput } from "../commands/ListWorkspacesCommand";
56
- import {
57
- PutAlertManagerDefinitionCommandInput,
58
- PutAlertManagerDefinitionCommandOutput,
59
- } from "../commands/PutAlertManagerDefinitionCommand";
60
- import {
61
- PutRuleGroupsNamespaceCommandInput,
62
- PutRuleGroupsNamespaceCommandOutput,
63
- } from "../commands/PutRuleGroupsNamespaceCommand";
64
- import { TagResourceCommandInput, TagResourceCommandOutput } from "../commands/TagResourceCommand";
65
- import { UntagResourceCommandInput, UntagResourceCommandOutput } from "../commands/UntagResourceCommand";
66
- import {
67
- UpdateWorkspaceAliasCommandInput,
68
- UpdateWorkspaceAliasCommandOutput,
69
- } from "../commands/UpdateWorkspaceAliasCommand";
70
- import {
71
- AccessDeniedException,
72
- AlertManagerDefinitionDescription,
73
- AlertManagerDefinitionStatus,
74
- ConflictException,
75
- InternalServerException,
76
- ResourceNotFoundException,
77
- RuleGroupsNamespaceDescription,
78
- RuleGroupsNamespaceStatus,
79
- RuleGroupsNamespaceSummary,
80
- ServiceQuotaExceededException,
81
- ThrottlingException,
82
- ValidationException,
83
- ValidationExceptionField,
84
- WorkspaceDescription,
85
- WorkspaceStatus,
86
- WorkspaceSummary,
87
- } from "../models/models_0";
88
-
89
- export const serializeAws_restJson1CreateAlertManagerDefinitionCommand = async (
90
- input: CreateAlertManagerDefinitionCommandInput,
91
- context: __SerdeContext
92
- ): Promise<__HttpRequest> => {
93
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
94
- const headers: any = {
95
- "content-type": "application/json",
96
- };
97
- let resolvedPath =
98
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
99
- "/workspaces/{workspaceId}/alertmanager/definition";
100
- if (input.workspaceId !== undefined) {
101
- const labelValue: string = input.workspaceId;
102
- if (labelValue.length <= 0) {
103
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
104
- }
105
- resolvedPath = resolvedPath.replace("{workspaceId}", __extendedEncodeURIComponent(labelValue));
106
- } else {
107
- throw new Error("No value provided for input HTTP label: workspaceId.");
108
- }
109
- let body: any;
110
- body = JSON.stringify({
111
- clientToken: input.clientToken ?? generateIdempotencyToken(),
112
- ...(input.data !== undefined && input.data !== null && { data: context.base64Encoder(input.data) }),
113
- });
114
- return new __HttpRequest({
115
- protocol,
116
- hostname,
117
- port,
118
- method: "POST",
119
- headers,
120
- path: resolvedPath,
121
- body,
122
- });
123
- };
124
-
125
- export const serializeAws_restJson1CreateRuleGroupsNamespaceCommand = async (
126
- input: CreateRuleGroupsNamespaceCommandInput,
127
- context: __SerdeContext
128
- ): Promise<__HttpRequest> => {
129
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
130
- const headers: any = {
131
- "content-type": "application/json",
132
- };
133
- let resolvedPath =
134
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
135
- "/workspaces/{workspaceId}/rulegroupsnamespaces";
136
- if (input.workspaceId !== undefined) {
137
- const labelValue: string = input.workspaceId;
138
- if (labelValue.length <= 0) {
139
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
140
- }
141
- resolvedPath = resolvedPath.replace("{workspaceId}", __extendedEncodeURIComponent(labelValue));
142
- } else {
143
- throw new Error("No value provided for input HTTP label: workspaceId.");
144
- }
145
- let body: any;
146
- body = JSON.stringify({
147
- clientToken: input.clientToken ?? generateIdempotencyToken(),
148
- ...(input.data !== undefined && input.data !== null && { data: context.base64Encoder(input.data) }),
149
- ...(input.name !== undefined && input.name !== null && { name: input.name }),
150
- ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }),
151
- });
152
- return new __HttpRequest({
153
- protocol,
154
- hostname,
155
- port,
156
- method: "POST",
157
- headers,
158
- path: resolvedPath,
159
- body,
160
- });
161
- };
162
-
163
- export const serializeAws_restJson1CreateWorkspaceCommand = async (
164
- input: CreateWorkspaceCommandInput,
165
- context: __SerdeContext
166
- ): Promise<__HttpRequest> => {
167
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
168
- const headers: any = {
169
- "content-type": "application/json",
170
- };
171
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces";
172
- let body: any;
173
- body = JSON.stringify({
174
- ...(input.alias !== undefined && input.alias !== null && { alias: input.alias }),
175
- clientToken: input.clientToken ?? generateIdempotencyToken(),
176
- ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }),
177
- });
178
- return new __HttpRequest({
179
- protocol,
180
- hostname,
181
- port,
182
- method: "POST",
183
- headers,
184
- path: resolvedPath,
185
- body,
186
- });
187
- };
188
-
189
- export const serializeAws_restJson1DeleteAlertManagerDefinitionCommand = async (
190
- input: DeleteAlertManagerDefinitionCommandInput,
191
- context: __SerdeContext
192
- ): Promise<__HttpRequest> => {
193
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
194
- const headers: any = {};
195
- let resolvedPath =
196
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
197
- "/workspaces/{workspaceId}/alertmanager/definition";
198
- if (input.workspaceId !== undefined) {
199
- const labelValue: string = input.workspaceId;
200
- if (labelValue.length <= 0) {
201
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
202
- }
203
- resolvedPath = resolvedPath.replace("{workspaceId}", __extendedEncodeURIComponent(labelValue));
204
- } else {
205
- throw new Error("No value provided for input HTTP label: workspaceId.");
206
- }
207
- const query: any = {
208
- ...(input.clientToken !== undefined && { clientToken: input.clientToken }),
209
- };
210
- let body: any;
211
- return new __HttpRequest({
212
- protocol,
213
- hostname,
214
- port,
215
- method: "DELETE",
216
- headers,
217
- path: resolvedPath,
218
- query,
219
- body,
220
- });
221
- };
222
-
223
- export const serializeAws_restJson1DeleteRuleGroupsNamespaceCommand = async (
224
- input: DeleteRuleGroupsNamespaceCommandInput,
225
- context: __SerdeContext
226
- ): Promise<__HttpRequest> => {
227
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
228
- const headers: any = {};
229
- let resolvedPath =
230
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
231
- "/workspaces/{workspaceId}/rulegroupsnamespaces/{name}";
232
- if (input.workspaceId !== undefined) {
233
- const labelValue: string = input.workspaceId;
234
- if (labelValue.length <= 0) {
235
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
236
- }
237
- resolvedPath = resolvedPath.replace("{workspaceId}", __extendedEncodeURIComponent(labelValue));
238
- } else {
239
- throw new Error("No value provided for input HTTP label: workspaceId.");
240
- }
241
- if (input.name !== undefined) {
242
- const labelValue: string = input.name;
243
- if (labelValue.length <= 0) {
244
- throw new Error("Empty value provided for input HTTP label: name.");
245
- }
246
- resolvedPath = resolvedPath.replace("{name}", __extendedEncodeURIComponent(labelValue));
247
- } else {
248
- throw new Error("No value provided for input HTTP label: name.");
249
- }
250
- const query: any = {
251
- ...(input.clientToken !== undefined && { clientToken: input.clientToken }),
252
- };
253
- let body: any;
254
- return new __HttpRequest({
255
- protocol,
256
- hostname,
257
- port,
258
- method: "DELETE",
259
- headers,
260
- path: resolvedPath,
261
- query,
262
- body,
263
- });
264
- };
265
-
266
- export const serializeAws_restJson1DeleteWorkspaceCommand = async (
267
- input: DeleteWorkspaceCommandInput,
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 || ""}` + "/workspaces/{workspaceId}";
274
- if (input.workspaceId !== undefined) {
275
- const labelValue: string = input.workspaceId;
276
- if (labelValue.length <= 0) {
277
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
278
- }
279
- resolvedPath = resolvedPath.replace("{workspaceId}", __extendedEncodeURIComponent(labelValue));
280
- } else {
281
- throw new Error("No value provided for input HTTP label: workspaceId.");
282
- }
283
- const query: any = {
284
- ...(input.clientToken !== undefined && { clientToken: input.clientToken }),
285
- };
286
- let body: any;
287
- return new __HttpRequest({
288
- protocol,
289
- hostname,
290
- port,
291
- method: "DELETE",
292
- headers,
293
- path: resolvedPath,
294
- query,
295
- body,
296
- });
297
- };
298
-
299
- export const serializeAws_restJson1DescribeAlertManagerDefinitionCommand = async (
300
- input: DescribeAlertManagerDefinitionCommandInput,
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 || ""}` +
307
- "/workspaces/{workspaceId}/alertmanager/definition";
308
- if (input.workspaceId !== undefined) {
309
- const labelValue: string = input.workspaceId;
310
- if (labelValue.length <= 0) {
311
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
312
- }
313
- resolvedPath = resolvedPath.replace("{workspaceId}", __extendedEncodeURIComponent(labelValue));
314
- } else {
315
- throw new Error("No value provided for input HTTP label: workspaceId.");
316
- }
317
- let body: any;
318
- return new __HttpRequest({
319
- protocol,
320
- hostname,
321
- port,
322
- method: "GET",
323
- headers,
324
- path: resolvedPath,
325
- body,
326
- });
327
- };
328
-
329
- export const serializeAws_restJson1DescribeRuleGroupsNamespaceCommand = async (
330
- input: DescribeRuleGroupsNamespaceCommandInput,
331
- context: __SerdeContext
332
- ): Promise<__HttpRequest> => {
333
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
334
- const headers: any = {};
335
- let resolvedPath =
336
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
337
- "/workspaces/{workspaceId}/rulegroupsnamespaces/{name}";
338
- if (input.workspaceId !== undefined) {
339
- const labelValue: string = input.workspaceId;
340
- if (labelValue.length <= 0) {
341
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
342
- }
343
- resolvedPath = resolvedPath.replace("{workspaceId}", __extendedEncodeURIComponent(labelValue));
344
- } else {
345
- throw new Error("No value provided for input HTTP label: workspaceId.");
346
- }
347
- if (input.name !== undefined) {
348
- const labelValue: string = input.name;
349
- if (labelValue.length <= 0) {
350
- throw new Error("Empty value provided for input HTTP label: name.");
351
- }
352
- resolvedPath = resolvedPath.replace("{name}", __extendedEncodeURIComponent(labelValue));
353
- } else {
354
- throw new Error("No value provided for input HTTP label: name.");
355
- }
356
- let body: any;
357
- return new __HttpRequest({
358
- protocol,
359
- hostname,
360
- port,
361
- method: "GET",
362
- headers,
363
- path: resolvedPath,
364
- body,
365
- });
366
- };
367
-
368
- export const serializeAws_restJson1DescribeWorkspaceCommand = async (
369
- input: DescribeWorkspaceCommandInput,
370
- context: __SerdeContext
371
- ): Promise<__HttpRequest> => {
372
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
373
- const headers: any = {};
374
- let resolvedPath =
375
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces/{workspaceId}";
376
- if (input.workspaceId !== undefined) {
377
- const labelValue: string = input.workspaceId;
378
- if (labelValue.length <= 0) {
379
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
380
- }
381
- resolvedPath = resolvedPath.replace("{workspaceId}", __extendedEncodeURIComponent(labelValue));
382
- } else {
383
- throw new Error("No value provided for input HTTP label: workspaceId.");
384
- }
385
- let body: any;
386
- return new __HttpRequest({
387
- protocol,
388
- hostname,
389
- port,
390
- method: "GET",
391
- headers,
392
- path: resolvedPath,
393
- body,
394
- });
395
- };
396
-
397
- export const serializeAws_restJson1ListRuleGroupsNamespacesCommand = async (
398
- input: ListRuleGroupsNamespacesCommandInput,
399
- context: __SerdeContext
400
- ): Promise<__HttpRequest> => {
401
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
402
- const headers: any = {};
403
- let resolvedPath =
404
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
405
- "/workspaces/{workspaceId}/rulegroupsnamespaces";
406
- if (input.workspaceId !== undefined) {
407
- const labelValue: string = input.workspaceId;
408
- if (labelValue.length <= 0) {
409
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
410
- }
411
- resolvedPath = resolvedPath.replace("{workspaceId}", __extendedEncodeURIComponent(labelValue));
412
- } else {
413
- throw new Error("No value provided for input HTTP label: workspaceId.");
414
- }
415
- const query: any = {
416
- ...(input.name !== undefined && { name: input.name }),
417
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
418
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
419
- };
420
- let body: any;
421
- return new __HttpRequest({
422
- protocol,
423
- hostname,
424
- port,
425
- method: "GET",
426
- headers,
427
- path: resolvedPath,
428
- query,
429
- body,
430
- });
431
- };
432
-
433
- export const serializeAws_restJson1ListTagsForResourceCommand = async (
434
- input: ListTagsForResourceCommandInput,
435
- context: __SerdeContext
436
- ): Promise<__HttpRequest> => {
437
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
438
- const headers: any = {};
439
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
440
- if (input.resourceArn !== undefined) {
441
- const labelValue: string = input.resourceArn;
442
- if (labelValue.length <= 0) {
443
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
444
- }
445
- resolvedPath = resolvedPath.replace("{resourceArn}", __extendedEncodeURIComponent(labelValue));
446
- } else {
447
- throw new Error("No value provided for input HTTP label: resourceArn.");
448
- }
449
- let body: any;
450
- return new __HttpRequest({
451
- protocol,
452
- hostname,
453
- port,
454
- method: "GET",
455
- headers,
456
- path: resolvedPath,
457
- body,
458
- });
459
- };
460
-
461
- export const serializeAws_restJson1ListWorkspacesCommand = async (
462
- input: ListWorkspacesCommandInput,
463
- context: __SerdeContext
464
- ): Promise<__HttpRequest> => {
465
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
466
- const headers: any = {};
467
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces";
468
- const query: any = {
469
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
470
- ...(input.alias !== undefined && { alias: input.alias }),
471
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
472
- };
473
- let body: any;
474
- return new __HttpRequest({
475
- protocol,
476
- hostname,
477
- port,
478
- method: "GET",
479
- headers,
480
- path: resolvedPath,
481
- query,
482
- body,
483
- });
484
- };
485
-
486
- export const serializeAws_restJson1PutAlertManagerDefinitionCommand = async (
487
- input: PutAlertManagerDefinitionCommandInput,
488
- context: __SerdeContext
489
- ): Promise<__HttpRequest> => {
490
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
491
- const headers: any = {
492
- "content-type": "application/json",
493
- };
494
- let resolvedPath =
495
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
496
- "/workspaces/{workspaceId}/alertmanager/definition";
497
- if (input.workspaceId !== undefined) {
498
- const labelValue: string = input.workspaceId;
499
- if (labelValue.length <= 0) {
500
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
501
- }
502
- resolvedPath = resolvedPath.replace("{workspaceId}", __extendedEncodeURIComponent(labelValue));
503
- } else {
504
- throw new Error("No value provided for input HTTP label: workspaceId.");
505
- }
506
- let body: any;
507
- body = JSON.stringify({
508
- clientToken: input.clientToken ?? generateIdempotencyToken(),
509
- ...(input.data !== undefined && input.data !== null && { data: context.base64Encoder(input.data) }),
510
- });
511
- return new __HttpRequest({
512
- protocol,
513
- hostname,
514
- port,
515
- method: "PUT",
516
- headers,
517
- path: resolvedPath,
518
- body,
519
- });
520
- };
521
-
522
- export const serializeAws_restJson1PutRuleGroupsNamespaceCommand = async (
523
- input: PutRuleGroupsNamespaceCommandInput,
524
- context: __SerdeContext
525
- ): Promise<__HttpRequest> => {
526
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
527
- const headers: any = {
528
- "content-type": "application/json",
529
- };
530
- let resolvedPath =
531
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
532
- "/workspaces/{workspaceId}/rulegroupsnamespaces/{name}";
533
- if (input.workspaceId !== undefined) {
534
- const labelValue: string = input.workspaceId;
535
- if (labelValue.length <= 0) {
536
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
537
- }
538
- resolvedPath = resolvedPath.replace("{workspaceId}", __extendedEncodeURIComponent(labelValue));
539
- } else {
540
- throw new Error("No value provided for input HTTP label: workspaceId.");
541
- }
542
- if (input.name !== undefined) {
543
- const labelValue: string = input.name;
544
- if (labelValue.length <= 0) {
545
- throw new Error("Empty value provided for input HTTP label: name.");
546
- }
547
- resolvedPath = resolvedPath.replace("{name}", __extendedEncodeURIComponent(labelValue));
548
- } else {
549
- throw new Error("No value provided for input HTTP label: name.");
550
- }
551
- let body: any;
552
- body = JSON.stringify({
553
- clientToken: input.clientToken ?? generateIdempotencyToken(),
554
- ...(input.data !== undefined && input.data !== null && { data: context.base64Encoder(input.data) }),
555
- });
556
- return new __HttpRequest({
557
- protocol,
558
- hostname,
559
- port,
560
- method: "PUT",
561
- headers,
562
- path: resolvedPath,
563
- body,
564
- });
565
- };
566
-
567
- export const serializeAws_restJson1TagResourceCommand = async (
568
- input: TagResourceCommandInput,
569
- context: __SerdeContext
570
- ): Promise<__HttpRequest> => {
571
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
572
- const headers: any = {
573
- "content-type": "application/json",
574
- };
575
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
576
- if (input.resourceArn !== undefined) {
577
- const labelValue: string = input.resourceArn;
578
- if (labelValue.length <= 0) {
579
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
580
- }
581
- resolvedPath = resolvedPath.replace("{resourceArn}", __extendedEncodeURIComponent(labelValue));
582
- } else {
583
- throw new Error("No value provided for input HTTP label: resourceArn.");
584
- }
585
- let body: any;
586
- body = JSON.stringify({
587
- ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }),
588
- });
589
- return new __HttpRequest({
590
- protocol,
591
- hostname,
592
- port,
593
- method: "POST",
594
- headers,
595
- path: resolvedPath,
596
- body,
597
- });
598
- };
599
-
600
- export const serializeAws_restJson1UntagResourceCommand = async (
601
- input: UntagResourceCommandInput,
602
- context: __SerdeContext
603
- ): Promise<__HttpRequest> => {
604
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
605
- const headers: any = {};
606
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
607
- if (input.resourceArn !== undefined) {
608
- const labelValue: string = input.resourceArn;
609
- if (labelValue.length <= 0) {
610
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
611
- }
612
- resolvedPath = resolvedPath.replace("{resourceArn}", __extendedEncodeURIComponent(labelValue));
613
- } else {
614
- throw new Error("No value provided for input HTTP label: resourceArn.");
615
- }
616
- const query: any = {
617
- ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry as any) }),
618
- };
619
- let body: any;
620
- return new __HttpRequest({
621
- protocol,
622
- hostname,
623
- port,
624
- method: "DELETE",
625
- headers,
626
- path: resolvedPath,
627
- query,
628
- body,
629
- });
630
- };
631
-
632
- export const serializeAws_restJson1UpdateWorkspaceAliasCommand = async (
633
- input: UpdateWorkspaceAliasCommandInput,
634
- context: __SerdeContext
635
- ): Promise<__HttpRequest> => {
636
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
637
- const headers: any = {
638
- "content-type": "application/json",
639
- };
640
- let resolvedPath =
641
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces/{workspaceId}/alias";
642
- if (input.workspaceId !== undefined) {
643
- const labelValue: string = input.workspaceId;
644
- if (labelValue.length <= 0) {
645
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
646
- }
647
- resolvedPath = resolvedPath.replace("{workspaceId}", __extendedEncodeURIComponent(labelValue));
648
- } else {
649
- throw new Error("No value provided for input HTTP label: workspaceId.");
650
- }
651
- let body: any;
652
- body = JSON.stringify({
653
- ...(input.alias !== undefined && input.alias !== null && { alias: input.alias }),
654
- clientToken: input.clientToken ?? generateIdempotencyToken(),
655
- });
656
- return new __HttpRequest({
657
- protocol,
658
- hostname,
659
- port,
660
- method: "POST",
661
- headers,
662
- path: resolvedPath,
663
- body,
664
- });
665
- };
666
-
667
- export const deserializeAws_restJson1CreateAlertManagerDefinitionCommand = async (
668
- output: __HttpResponse,
669
- context: __SerdeContext
670
- ): Promise<CreateAlertManagerDefinitionCommandOutput> => {
671
- if (output.statusCode !== 202 && output.statusCode >= 300) {
672
- return deserializeAws_restJson1CreateAlertManagerDefinitionCommandError(output, context);
673
- }
674
- const contents: CreateAlertManagerDefinitionCommandOutput = {
675
- $metadata: deserializeMetadata(output),
676
- status: undefined,
677
- };
678
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
679
- if (data.status !== undefined && data.status !== null) {
680
- contents.status = deserializeAws_restJson1AlertManagerDefinitionStatus(data.status, context);
681
- }
682
- return Promise.resolve(contents);
683
- };
684
-
685
- const deserializeAws_restJson1CreateAlertManagerDefinitionCommandError = async (
686
- output: __HttpResponse,
687
- context: __SerdeContext
688
- ): Promise<CreateAlertManagerDefinitionCommandOutput> => {
689
- const parsedOutput: any = {
690
- ...output,
691
- body: await parseBody(output.body, context),
692
- };
693
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
694
- let errorCode = "UnknownError";
695
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
696
- switch (errorCode) {
697
- case "AccessDeniedException":
698
- case "com.amazonaws.amp#AccessDeniedException":
699
- response = {
700
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
701
- name: errorCode,
702
- $metadata: deserializeMetadata(output),
703
- };
704
- break;
705
- case "ConflictException":
706
- case "com.amazonaws.amp#ConflictException":
707
- response = {
708
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
709
- name: errorCode,
710
- $metadata: deserializeMetadata(output),
711
- };
712
- break;
713
- case "InternalServerException":
714
- case "com.amazonaws.amp#InternalServerException":
715
- response = {
716
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
717
- name: errorCode,
718
- $metadata: deserializeMetadata(output),
719
- };
720
- break;
721
- case "ResourceNotFoundException":
722
- case "com.amazonaws.amp#ResourceNotFoundException":
723
- response = {
724
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
725
- name: errorCode,
726
- $metadata: deserializeMetadata(output),
727
- };
728
- break;
729
- case "ServiceQuotaExceededException":
730
- case "com.amazonaws.amp#ServiceQuotaExceededException":
731
- response = {
732
- ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
733
- name: errorCode,
734
- $metadata: deserializeMetadata(output),
735
- };
736
- break;
737
- case "ThrottlingException":
738
- case "com.amazonaws.amp#ThrottlingException":
739
- response = {
740
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
741
- name: errorCode,
742
- $metadata: deserializeMetadata(output),
743
- };
744
- break;
745
- case "ValidationException":
746
- case "com.amazonaws.amp#ValidationException":
747
- response = {
748
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
749
- name: errorCode,
750
- $metadata: deserializeMetadata(output),
751
- };
752
- break;
753
- default:
754
- const parsedBody = parsedOutput.body;
755
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
756
- response = {
757
- ...parsedBody,
758
- name: `${errorCode}`,
759
- message: parsedBody.message || parsedBody.Message || errorCode,
760
- $fault: "client",
761
- $metadata: deserializeMetadata(output),
762
- } as any;
763
- }
764
- const message = response.message || response.Message || errorCode;
765
- response.message = message;
766
- delete response.Message;
767
- return Promise.reject(Object.assign(new Error(message), response));
768
- };
769
-
770
- export const deserializeAws_restJson1CreateRuleGroupsNamespaceCommand = async (
771
- output: __HttpResponse,
772
- context: __SerdeContext
773
- ): Promise<CreateRuleGroupsNamespaceCommandOutput> => {
774
- if (output.statusCode !== 202 && output.statusCode >= 300) {
775
- return deserializeAws_restJson1CreateRuleGroupsNamespaceCommandError(output, context);
776
- }
777
- const contents: CreateRuleGroupsNamespaceCommandOutput = {
778
- $metadata: deserializeMetadata(output),
779
- arn: undefined,
780
- name: undefined,
781
- status: undefined,
782
- tags: undefined,
783
- };
784
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
785
- if (data.arn !== undefined && data.arn !== null) {
786
- contents.arn = __expectString(data.arn);
787
- }
788
- if (data.name !== undefined && data.name !== null) {
789
- contents.name = __expectString(data.name);
790
- }
791
- if (data.status !== undefined && data.status !== null) {
792
- contents.status = deserializeAws_restJson1RuleGroupsNamespaceStatus(data.status, context);
793
- }
794
- if (data.tags !== undefined && data.tags !== null) {
795
- contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
796
- }
797
- return Promise.resolve(contents);
798
- };
799
-
800
- const deserializeAws_restJson1CreateRuleGroupsNamespaceCommandError = async (
801
- output: __HttpResponse,
802
- context: __SerdeContext
803
- ): Promise<CreateRuleGroupsNamespaceCommandOutput> => {
804
- const parsedOutput: any = {
805
- ...output,
806
- body: await parseBody(output.body, context),
807
- };
808
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
809
- let errorCode = "UnknownError";
810
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
811
- switch (errorCode) {
812
- case "AccessDeniedException":
813
- case "com.amazonaws.amp#AccessDeniedException":
814
- response = {
815
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
816
- name: errorCode,
817
- $metadata: deserializeMetadata(output),
818
- };
819
- break;
820
- case "ConflictException":
821
- case "com.amazonaws.amp#ConflictException":
822
- response = {
823
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
824
- name: errorCode,
825
- $metadata: deserializeMetadata(output),
826
- };
827
- break;
828
- case "InternalServerException":
829
- case "com.amazonaws.amp#InternalServerException":
830
- response = {
831
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
832
- name: errorCode,
833
- $metadata: deserializeMetadata(output),
834
- };
835
- break;
836
- case "ResourceNotFoundException":
837
- case "com.amazonaws.amp#ResourceNotFoundException":
838
- response = {
839
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
840
- name: errorCode,
841
- $metadata: deserializeMetadata(output),
842
- };
843
- break;
844
- case "ServiceQuotaExceededException":
845
- case "com.amazonaws.amp#ServiceQuotaExceededException":
846
- response = {
847
- ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
848
- name: errorCode,
849
- $metadata: deserializeMetadata(output),
850
- };
851
- break;
852
- case "ThrottlingException":
853
- case "com.amazonaws.amp#ThrottlingException":
854
- response = {
855
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
856
- name: errorCode,
857
- $metadata: deserializeMetadata(output),
858
- };
859
- break;
860
- case "ValidationException":
861
- case "com.amazonaws.amp#ValidationException":
862
- response = {
863
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
864
- name: errorCode,
865
- $metadata: deserializeMetadata(output),
866
- };
867
- break;
868
- default:
869
- const parsedBody = parsedOutput.body;
870
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
871
- response = {
872
- ...parsedBody,
873
- name: `${errorCode}`,
874
- message: parsedBody.message || parsedBody.Message || errorCode,
875
- $fault: "client",
876
- $metadata: deserializeMetadata(output),
877
- } as any;
878
- }
879
- const message = response.message || response.Message || errorCode;
880
- response.message = message;
881
- delete response.Message;
882
- return Promise.reject(Object.assign(new Error(message), response));
883
- };
884
-
885
- export const deserializeAws_restJson1CreateWorkspaceCommand = async (
886
- output: __HttpResponse,
887
- context: __SerdeContext
888
- ): Promise<CreateWorkspaceCommandOutput> => {
889
- if (output.statusCode !== 202 && output.statusCode >= 300) {
890
- return deserializeAws_restJson1CreateWorkspaceCommandError(output, context);
891
- }
892
- const contents: CreateWorkspaceCommandOutput = {
893
- $metadata: deserializeMetadata(output),
894
- arn: undefined,
895
- status: undefined,
896
- tags: undefined,
897
- workspaceId: undefined,
898
- };
899
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
900
- if (data.arn !== undefined && data.arn !== null) {
901
- contents.arn = __expectString(data.arn);
902
- }
903
- if (data.status !== undefined && data.status !== null) {
904
- contents.status = deserializeAws_restJson1WorkspaceStatus(data.status, context);
905
- }
906
- if (data.tags !== undefined && data.tags !== null) {
907
- contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
908
- }
909
- if (data.workspaceId !== undefined && data.workspaceId !== null) {
910
- contents.workspaceId = __expectString(data.workspaceId);
911
- }
912
- return Promise.resolve(contents);
913
- };
914
-
915
- const deserializeAws_restJson1CreateWorkspaceCommandError = async (
916
- output: __HttpResponse,
917
- context: __SerdeContext
918
- ): Promise<CreateWorkspaceCommandOutput> => {
919
- const parsedOutput: any = {
920
- ...output,
921
- body: await parseBody(output.body, context),
922
- };
923
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
924
- let errorCode = "UnknownError";
925
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
926
- switch (errorCode) {
927
- case "AccessDeniedException":
928
- case "com.amazonaws.amp#AccessDeniedException":
929
- response = {
930
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
931
- name: errorCode,
932
- $metadata: deserializeMetadata(output),
933
- };
934
- break;
935
- case "ConflictException":
936
- case "com.amazonaws.amp#ConflictException":
937
- response = {
938
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
939
- name: errorCode,
940
- $metadata: deserializeMetadata(output),
941
- };
942
- break;
943
- case "InternalServerException":
944
- case "com.amazonaws.amp#InternalServerException":
945
- response = {
946
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
947
- name: errorCode,
948
- $metadata: deserializeMetadata(output),
949
- };
950
- break;
951
- case "ServiceQuotaExceededException":
952
- case "com.amazonaws.amp#ServiceQuotaExceededException":
953
- response = {
954
- ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
955
- name: errorCode,
956
- $metadata: deserializeMetadata(output),
957
- };
958
- break;
959
- case "ThrottlingException":
960
- case "com.amazonaws.amp#ThrottlingException":
961
- response = {
962
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
963
- name: errorCode,
964
- $metadata: deserializeMetadata(output),
965
- };
966
- break;
967
- case "ValidationException":
968
- case "com.amazonaws.amp#ValidationException":
969
- response = {
970
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
971
- name: errorCode,
972
- $metadata: deserializeMetadata(output),
973
- };
974
- break;
975
- default:
976
- const parsedBody = parsedOutput.body;
977
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
978
- response = {
979
- ...parsedBody,
980
- name: `${errorCode}`,
981
- message: parsedBody.message || parsedBody.Message || errorCode,
982
- $fault: "client",
983
- $metadata: deserializeMetadata(output),
984
- } as any;
985
- }
986
- const message = response.message || response.Message || errorCode;
987
- response.message = message;
988
- delete response.Message;
989
- return Promise.reject(Object.assign(new Error(message), response));
990
- };
991
-
992
- export const deserializeAws_restJson1DeleteAlertManagerDefinitionCommand = async (
993
- output: __HttpResponse,
994
- context: __SerdeContext
995
- ): Promise<DeleteAlertManagerDefinitionCommandOutput> => {
996
- if (output.statusCode !== 202 && output.statusCode >= 300) {
997
- return deserializeAws_restJson1DeleteAlertManagerDefinitionCommandError(output, context);
998
- }
999
- const contents: DeleteAlertManagerDefinitionCommandOutput = {
1000
- $metadata: deserializeMetadata(output),
1001
- };
1002
- await collectBody(output.body, context);
1003
- return Promise.resolve(contents);
1004
- };
1005
-
1006
- const deserializeAws_restJson1DeleteAlertManagerDefinitionCommandError = async (
1007
- output: __HttpResponse,
1008
- context: __SerdeContext
1009
- ): Promise<DeleteAlertManagerDefinitionCommandOutput> => {
1010
- const parsedOutput: any = {
1011
- ...output,
1012
- body: await parseBody(output.body, context),
1013
- };
1014
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1015
- let errorCode = "UnknownError";
1016
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1017
- switch (errorCode) {
1018
- case "AccessDeniedException":
1019
- case "com.amazonaws.amp#AccessDeniedException":
1020
- response = {
1021
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1022
- name: errorCode,
1023
- $metadata: deserializeMetadata(output),
1024
- };
1025
- break;
1026
- case "ConflictException":
1027
- case "com.amazonaws.amp#ConflictException":
1028
- response = {
1029
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
1030
- name: errorCode,
1031
- $metadata: deserializeMetadata(output),
1032
- };
1033
- break;
1034
- case "InternalServerException":
1035
- case "com.amazonaws.amp#InternalServerException":
1036
- response = {
1037
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1038
- name: errorCode,
1039
- $metadata: deserializeMetadata(output),
1040
- };
1041
- break;
1042
- case "ResourceNotFoundException":
1043
- case "com.amazonaws.amp#ResourceNotFoundException":
1044
- response = {
1045
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1046
- name: errorCode,
1047
- $metadata: deserializeMetadata(output),
1048
- };
1049
- break;
1050
- case "ThrottlingException":
1051
- case "com.amazonaws.amp#ThrottlingException":
1052
- response = {
1053
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1054
- name: errorCode,
1055
- $metadata: deserializeMetadata(output),
1056
- };
1057
- break;
1058
- case "ValidationException":
1059
- case "com.amazonaws.amp#ValidationException":
1060
- response = {
1061
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1062
- name: errorCode,
1063
- $metadata: deserializeMetadata(output),
1064
- };
1065
- break;
1066
- default:
1067
- const parsedBody = parsedOutput.body;
1068
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1069
- response = {
1070
- ...parsedBody,
1071
- name: `${errorCode}`,
1072
- message: parsedBody.message || parsedBody.Message || errorCode,
1073
- $fault: "client",
1074
- $metadata: deserializeMetadata(output),
1075
- } as any;
1076
- }
1077
- const message = response.message || response.Message || errorCode;
1078
- response.message = message;
1079
- delete response.Message;
1080
- return Promise.reject(Object.assign(new Error(message), response));
1081
- };
1082
-
1083
- export const deserializeAws_restJson1DeleteRuleGroupsNamespaceCommand = async (
1084
- output: __HttpResponse,
1085
- context: __SerdeContext
1086
- ): Promise<DeleteRuleGroupsNamespaceCommandOutput> => {
1087
- if (output.statusCode !== 202 && output.statusCode >= 300) {
1088
- return deserializeAws_restJson1DeleteRuleGroupsNamespaceCommandError(output, context);
1089
- }
1090
- const contents: DeleteRuleGroupsNamespaceCommandOutput = {
1091
- $metadata: deserializeMetadata(output),
1092
- };
1093
- await collectBody(output.body, context);
1094
- return Promise.resolve(contents);
1095
- };
1096
-
1097
- const deserializeAws_restJson1DeleteRuleGroupsNamespaceCommandError = async (
1098
- output: __HttpResponse,
1099
- context: __SerdeContext
1100
- ): Promise<DeleteRuleGroupsNamespaceCommandOutput> => {
1101
- const parsedOutput: any = {
1102
- ...output,
1103
- body: await parseBody(output.body, context),
1104
- };
1105
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1106
- let errorCode = "UnknownError";
1107
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1108
- switch (errorCode) {
1109
- case "AccessDeniedException":
1110
- case "com.amazonaws.amp#AccessDeniedException":
1111
- response = {
1112
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1113
- name: errorCode,
1114
- $metadata: deserializeMetadata(output),
1115
- };
1116
- break;
1117
- case "ConflictException":
1118
- case "com.amazonaws.amp#ConflictException":
1119
- response = {
1120
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
1121
- name: errorCode,
1122
- $metadata: deserializeMetadata(output),
1123
- };
1124
- break;
1125
- case "InternalServerException":
1126
- case "com.amazonaws.amp#InternalServerException":
1127
- response = {
1128
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1129
- name: errorCode,
1130
- $metadata: deserializeMetadata(output),
1131
- };
1132
- break;
1133
- case "ResourceNotFoundException":
1134
- case "com.amazonaws.amp#ResourceNotFoundException":
1135
- response = {
1136
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1137
- name: errorCode,
1138
- $metadata: deserializeMetadata(output),
1139
- };
1140
- break;
1141
- case "ThrottlingException":
1142
- case "com.amazonaws.amp#ThrottlingException":
1143
- response = {
1144
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1145
- name: errorCode,
1146
- $metadata: deserializeMetadata(output),
1147
- };
1148
- break;
1149
- case "ValidationException":
1150
- case "com.amazonaws.amp#ValidationException":
1151
- response = {
1152
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1153
- name: errorCode,
1154
- $metadata: deserializeMetadata(output),
1155
- };
1156
- break;
1157
- default:
1158
- const parsedBody = parsedOutput.body;
1159
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1160
- response = {
1161
- ...parsedBody,
1162
- name: `${errorCode}`,
1163
- message: parsedBody.message || parsedBody.Message || errorCode,
1164
- $fault: "client",
1165
- $metadata: deserializeMetadata(output),
1166
- } as any;
1167
- }
1168
- const message = response.message || response.Message || errorCode;
1169
- response.message = message;
1170
- delete response.Message;
1171
- return Promise.reject(Object.assign(new Error(message), response));
1172
- };
1173
-
1174
- export const deserializeAws_restJson1DeleteWorkspaceCommand = async (
1175
- output: __HttpResponse,
1176
- context: __SerdeContext
1177
- ): Promise<DeleteWorkspaceCommandOutput> => {
1178
- if (output.statusCode !== 202 && output.statusCode >= 300) {
1179
- return deserializeAws_restJson1DeleteWorkspaceCommandError(output, context);
1180
- }
1181
- const contents: DeleteWorkspaceCommandOutput = {
1182
- $metadata: deserializeMetadata(output),
1183
- };
1184
- await collectBody(output.body, context);
1185
- return Promise.resolve(contents);
1186
- };
1187
-
1188
- const deserializeAws_restJson1DeleteWorkspaceCommandError = async (
1189
- output: __HttpResponse,
1190
- context: __SerdeContext
1191
- ): Promise<DeleteWorkspaceCommandOutput> => {
1192
- const parsedOutput: any = {
1193
- ...output,
1194
- body: await parseBody(output.body, context),
1195
- };
1196
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1197
- let errorCode = "UnknownError";
1198
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1199
- switch (errorCode) {
1200
- case "AccessDeniedException":
1201
- case "com.amazonaws.amp#AccessDeniedException":
1202
- response = {
1203
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1204
- name: errorCode,
1205
- $metadata: deserializeMetadata(output),
1206
- };
1207
- break;
1208
- case "ConflictException":
1209
- case "com.amazonaws.amp#ConflictException":
1210
- response = {
1211
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
1212
- name: errorCode,
1213
- $metadata: deserializeMetadata(output),
1214
- };
1215
- break;
1216
- case "InternalServerException":
1217
- case "com.amazonaws.amp#InternalServerException":
1218
- response = {
1219
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1220
- name: errorCode,
1221
- $metadata: deserializeMetadata(output),
1222
- };
1223
- break;
1224
- case "ResourceNotFoundException":
1225
- case "com.amazonaws.amp#ResourceNotFoundException":
1226
- response = {
1227
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1228
- name: errorCode,
1229
- $metadata: deserializeMetadata(output),
1230
- };
1231
- break;
1232
- case "ThrottlingException":
1233
- case "com.amazonaws.amp#ThrottlingException":
1234
- response = {
1235
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1236
- name: errorCode,
1237
- $metadata: deserializeMetadata(output),
1238
- };
1239
- break;
1240
- case "ValidationException":
1241
- case "com.amazonaws.amp#ValidationException":
1242
- response = {
1243
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1244
- name: errorCode,
1245
- $metadata: deserializeMetadata(output),
1246
- };
1247
- break;
1248
- default:
1249
- const parsedBody = parsedOutput.body;
1250
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1251
- response = {
1252
- ...parsedBody,
1253
- name: `${errorCode}`,
1254
- message: parsedBody.message || parsedBody.Message || errorCode,
1255
- $fault: "client",
1256
- $metadata: deserializeMetadata(output),
1257
- } as any;
1258
- }
1259
- const message = response.message || response.Message || errorCode;
1260
- response.message = message;
1261
- delete response.Message;
1262
- return Promise.reject(Object.assign(new Error(message), response));
1263
- };
1264
-
1265
- export const deserializeAws_restJson1DescribeAlertManagerDefinitionCommand = async (
1266
- output: __HttpResponse,
1267
- context: __SerdeContext
1268
- ): Promise<DescribeAlertManagerDefinitionCommandOutput> => {
1269
- if (output.statusCode !== 200 && output.statusCode >= 300) {
1270
- return deserializeAws_restJson1DescribeAlertManagerDefinitionCommandError(output, context);
1271
- }
1272
- const contents: DescribeAlertManagerDefinitionCommandOutput = {
1273
- $metadata: deserializeMetadata(output),
1274
- alertManagerDefinition: undefined,
1275
- };
1276
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1277
- if (data.alertManagerDefinition !== undefined && data.alertManagerDefinition !== null) {
1278
- contents.alertManagerDefinition = deserializeAws_restJson1AlertManagerDefinitionDescription(
1279
- data.alertManagerDefinition,
1280
- context
1281
- );
1282
- }
1283
- return Promise.resolve(contents);
1284
- };
1285
-
1286
- const deserializeAws_restJson1DescribeAlertManagerDefinitionCommandError = async (
1287
- output: __HttpResponse,
1288
- context: __SerdeContext
1289
- ): Promise<DescribeAlertManagerDefinitionCommandOutput> => {
1290
- const parsedOutput: any = {
1291
- ...output,
1292
- body: await parseBody(output.body, context),
1293
- };
1294
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1295
- let errorCode = "UnknownError";
1296
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1297
- switch (errorCode) {
1298
- case "AccessDeniedException":
1299
- case "com.amazonaws.amp#AccessDeniedException":
1300
- response = {
1301
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1302
- name: errorCode,
1303
- $metadata: deserializeMetadata(output),
1304
- };
1305
- break;
1306
- case "InternalServerException":
1307
- case "com.amazonaws.amp#InternalServerException":
1308
- response = {
1309
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1310
- name: errorCode,
1311
- $metadata: deserializeMetadata(output),
1312
- };
1313
- break;
1314
- case "ResourceNotFoundException":
1315
- case "com.amazonaws.amp#ResourceNotFoundException":
1316
- response = {
1317
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1318
- name: errorCode,
1319
- $metadata: deserializeMetadata(output),
1320
- };
1321
- break;
1322
- case "ThrottlingException":
1323
- case "com.amazonaws.amp#ThrottlingException":
1324
- response = {
1325
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1326
- name: errorCode,
1327
- $metadata: deserializeMetadata(output),
1328
- };
1329
- break;
1330
- case "ValidationException":
1331
- case "com.amazonaws.amp#ValidationException":
1332
- response = {
1333
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1334
- name: errorCode,
1335
- $metadata: deserializeMetadata(output),
1336
- };
1337
- break;
1338
- default:
1339
- const parsedBody = parsedOutput.body;
1340
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1341
- response = {
1342
- ...parsedBody,
1343
- name: `${errorCode}`,
1344
- message: parsedBody.message || parsedBody.Message || errorCode,
1345
- $fault: "client",
1346
- $metadata: deserializeMetadata(output),
1347
- } as any;
1348
- }
1349
- const message = response.message || response.Message || errorCode;
1350
- response.message = message;
1351
- delete response.Message;
1352
- return Promise.reject(Object.assign(new Error(message), response));
1353
- };
1354
-
1355
- export const deserializeAws_restJson1DescribeRuleGroupsNamespaceCommand = async (
1356
- output: __HttpResponse,
1357
- context: __SerdeContext
1358
- ): Promise<DescribeRuleGroupsNamespaceCommandOutput> => {
1359
- if (output.statusCode !== 200 && output.statusCode >= 300) {
1360
- return deserializeAws_restJson1DescribeRuleGroupsNamespaceCommandError(output, context);
1361
- }
1362
- const contents: DescribeRuleGroupsNamespaceCommandOutput = {
1363
- $metadata: deserializeMetadata(output),
1364
- ruleGroupsNamespace: undefined,
1365
- };
1366
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1367
- if (data.ruleGroupsNamespace !== undefined && data.ruleGroupsNamespace !== null) {
1368
- contents.ruleGroupsNamespace = deserializeAws_restJson1RuleGroupsNamespaceDescription(
1369
- data.ruleGroupsNamespace,
1370
- context
1371
- );
1372
- }
1373
- return Promise.resolve(contents);
1374
- };
1375
-
1376
- const deserializeAws_restJson1DescribeRuleGroupsNamespaceCommandError = async (
1377
- output: __HttpResponse,
1378
- context: __SerdeContext
1379
- ): Promise<DescribeRuleGroupsNamespaceCommandOutput> => {
1380
- const parsedOutput: any = {
1381
- ...output,
1382
- body: await parseBody(output.body, context),
1383
- };
1384
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1385
- let errorCode = "UnknownError";
1386
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1387
- switch (errorCode) {
1388
- case "AccessDeniedException":
1389
- case "com.amazonaws.amp#AccessDeniedException":
1390
- response = {
1391
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1392
- name: errorCode,
1393
- $metadata: deserializeMetadata(output),
1394
- };
1395
- break;
1396
- case "InternalServerException":
1397
- case "com.amazonaws.amp#InternalServerException":
1398
- response = {
1399
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1400
- name: errorCode,
1401
- $metadata: deserializeMetadata(output),
1402
- };
1403
- break;
1404
- case "ResourceNotFoundException":
1405
- case "com.amazonaws.amp#ResourceNotFoundException":
1406
- response = {
1407
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1408
- name: errorCode,
1409
- $metadata: deserializeMetadata(output),
1410
- };
1411
- break;
1412
- case "ThrottlingException":
1413
- case "com.amazonaws.amp#ThrottlingException":
1414
- response = {
1415
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1416
- name: errorCode,
1417
- $metadata: deserializeMetadata(output),
1418
- };
1419
- break;
1420
- case "ValidationException":
1421
- case "com.amazonaws.amp#ValidationException":
1422
- response = {
1423
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1424
- name: errorCode,
1425
- $metadata: deserializeMetadata(output),
1426
- };
1427
- break;
1428
- default:
1429
- const parsedBody = parsedOutput.body;
1430
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1431
- response = {
1432
- ...parsedBody,
1433
- name: `${errorCode}`,
1434
- message: parsedBody.message || parsedBody.Message || errorCode,
1435
- $fault: "client",
1436
- $metadata: deserializeMetadata(output),
1437
- } as any;
1438
- }
1439
- const message = response.message || response.Message || errorCode;
1440
- response.message = message;
1441
- delete response.Message;
1442
- return Promise.reject(Object.assign(new Error(message), response));
1443
- };
1444
-
1445
- export const deserializeAws_restJson1DescribeWorkspaceCommand = async (
1446
- output: __HttpResponse,
1447
- context: __SerdeContext
1448
- ): Promise<DescribeWorkspaceCommandOutput> => {
1449
- if (output.statusCode !== 200 && output.statusCode >= 300) {
1450
- return deserializeAws_restJson1DescribeWorkspaceCommandError(output, context);
1451
- }
1452
- const contents: DescribeWorkspaceCommandOutput = {
1453
- $metadata: deserializeMetadata(output),
1454
- workspace: undefined,
1455
- };
1456
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1457
- if (data.workspace !== undefined && data.workspace !== null) {
1458
- contents.workspace = deserializeAws_restJson1WorkspaceDescription(data.workspace, context);
1459
- }
1460
- return Promise.resolve(contents);
1461
- };
1462
-
1463
- const deserializeAws_restJson1DescribeWorkspaceCommandError = async (
1464
- output: __HttpResponse,
1465
- context: __SerdeContext
1466
- ): Promise<DescribeWorkspaceCommandOutput> => {
1467
- const parsedOutput: any = {
1468
- ...output,
1469
- body: await parseBody(output.body, context),
1470
- };
1471
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1472
- let errorCode = "UnknownError";
1473
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1474
- switch (errorCode) {
1475
- case "AccessDeniedException":
1476
- case "com.amazonaws.amp#AccessDeniedException":
1477
- response = {
1478
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1479
- name: errorCode,
1480
- $metadata: deserializeMetadata(output),
1481
- };
1482
- break;
1483
- case "InternalServerException":
1484
- case "com.amazonaws.amp#InternalServerException":
1485
- response = {
1486
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1487
- name: errorCode,
1488
- $metadata: deserializeMetadata(output),
1489
- };
1490
- break;
1491
- case "ResourceNotFoundException":
1492
- case "com.amazonaws.amp#ResourceNotFoundException":
1493
- response = {
1494
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1495
- name: errorCode,
1496
- $metadata: deserializeMetadata(output),
1497
- };
1498
- break;
1499
- case "ThrottlingException":
1500
- case "com.amazonaws.amp#ThrottlingException":
1501
- response = {
1502
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1503
- name: errorCode,
1504
- $metadata: deserializeMetadata(output),
1505
- };
1506
- break;
1507
- case "ValidationException":
1508
- case "com.amazonaws.amp#ValidationException":
1509
- response = {
1510
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1511
- name: errorCode,
1512
- $metadata: deserializeMetadata(output),
1513
- };
1514
- break;
1515
- default:
1516
- const parsedBody = parsedOutput.body;
1517
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1518
- response = {
1519
- ...parsedBody,
1520
- name: `${errorCode}`,
1521
- message: parsedBody.message || parsedBody.Message || errorCode,
1522
- $fault: "client",
1523
- $metadata: deserializeMetadata(output),
1524
- } as any;
1525
- }
1526
- const message = response.message || response.Message || errorCode;
1527
- response.message = message;
1528
- delete response.Message;
1529
- return Promise.reject(Object.assign(new Error(message), response));
1530
- };
1531
-
1532
- export const deserializeAws_restJson1ListRuleGroupsNamespacesCommand = async (
1533
- output: __HttpResponse,
1534
- context: __SerdeContext
1535
- ): Promise<ListRuleGroupsNamespacesCommandOutput> => {
1536
- if (output.statusCode !== 200 && output.statusCode >= 300) {
1537
- return deserializeAws_restJson1ListRuleGroupsNamespacesCommandError(output, context);
1538
- }
1539
- const contents: ListRuleGroupsNamespacesCommandOutput = {
1540
- $metadata: deserializeMetadata(output),
1541
- nextToken: undefined,
1542
- ruleGroupsNamespaces: undefined,
1543
- };
1544
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1545
- if (data.nextToken !== undefined && data.nextToken !== null) {
1546
- contents.nextToken = __expectString(data.nextToken);
1547
- }
1548
- if (data.ruleGroupsNamespaces !== undefined && data.ruleGroupsNamespaces !== null) {
1549
- contents.ruleGroupsNamespaces = deserializeAws_restJson1RuleGroupsNamespaceSummaryList(
1550
- data.ruleGroupsNamespaces,
1551
- context
1552
- );
1553
- }
1554
- return Promise.resolve(contents);
1555
- };
1556
-
1557
- const deserializeAws_restJson1ListRuleGroupsNamespacesCommandError = async (
1558
- output: __HttpResponse,
1559
- context: __SerdeContext
1560
- ): Promise<ListRuleGroupsNamespacesCommandOutput> => {
1561
- const parsedOutput: any = {
1562
- ...output,
1563
- body: await parseBody(output.body, context),
1564
- };
1565
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1566
- let errorCode = "UnknownError";
1567
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1568
- switch (errorCode) {
1569
- case "AccessDeniedException":
1570
- case "com.amazonaws.amp#AccessDeniedException":
1571
- response = {
1572
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1573
- name: errorCode,
1574
- $metadata: deserializeMetadata(output),
1575
- };
1576
- break;
1577
- case "InternalServerException":
1578
- case "com.amazonaws.amp#InternalServerException":
1579
- response = {
1580
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1581
- name: errorCode,
1582
- $metadata: deserializeMetadata(output),
1583
- };
1584
- break;
1585
- case "ResourceNotFoundException":
1586
- case "com.amazonaws.amp#ResourceNotFoundException":
1587
- response = {
1588
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1589
- name: errorCode,
1590
- $metadata: deserializeMetadata(output),
1591
- };
1592
- break;
1593
- case "ThrottlingException":
1594
- case "com.amazonaws.amp#ThrottlingException":
1595
- response = {
1596
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1597
- name: errorCode,
1598
- $metadata: deserializeMetadata(output),
1599
- };
1600
- break;
1601
- case "ValidationException":
1602
- case "com.amazonaws.amp#ValidationException":
1603
- response = {
1604
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1605
- name: errorCode,
1606
- $metadata: deserializeMetadata(output),
1607
- };
1608
- break;
1609
- default:
1610
- const parsedBody = parsedOutput.body;
1611
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1612
- response = {
1613
- ...parsedBody,
1614
- name: `${errorCode}`,
1615
- message: parsedBody.message || parsedBody.Message || errorCode,
1616
- $fault: "client",
1617
- $metadata: deserializeMetadata(output),
1618
- } as any;
1619
- }
1620
- const message = response.message || response.Message || errorCode;
1621
- response.message = message;
1622
- delete response.Message;
1623
- return Promise.reject(Object.assign(new Error(message), response));
1624
- };
1625
-
1626
- export const deserializeAws_restJson1ListTagsForResourceCommand = async (
1627
- output: __HttpResponse,
1628
- context: __SerdeContext
1629
- ): Promise<ListTagsForResourceCommandOutput> => {
1630
- if (output.statusCode !== 200 && output.statusCode >= 300) {
1631
- return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
1632
- }
1633
- const contents: ListTagsForResourceCommandOutput = {
1634
- $metadata: deserializeMetadata(output),
1635
- tags: undefined,
1636
- };
1637
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1638
- if (data.tags !== undefined && data.tags !== null) {
1639
- contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
1640
- }
1641
- return Promise.resolve(contents);
1642
- };
1643
-
1644
- const deserializeAws_restJson1ListTagsForResourceCommandError = async (
1645
- output: __HttpResponse,
1646
- context: __SerdeContext
1647
- ): Promise<ListTagsForResourceCommandOutput> => {
1648
- const parsedOutput: any = {
1649
- ...output,
1650
- body: await parseBody(output.body, context),
1651
- };
1652
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1653
- let errorCode = "UnknownError";
1654
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1655
- switch (errorCode) {
1656
- case "AccessDeniedException":
1657
- case "com.amazonaws.amp#AccessDeniedException":
1658
- response = {
1659
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1660
- name: errorCode,
1661
- $metadata: deserializeMetadata(output),
1662
- };
1663
- break;
1664
- case "InternalServerException":
1665
- case "com.amazonaws.amp#InternalServerException":
1666
- response = {
1667
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1668
- name: errorCode,
1669
- $metadata: deserializeMetadata(output),
1670
- };
1671
- break;
1672
- case "ResourceNotFoundException":
1673
- case "com.amazonaws.amp#ResourceNotFoundException":
1674
- response = {
1675
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1676
- name: errorCode,
1677
- $metadata: deserializeMetadata(output),
1678
- };
1679
- break;
1680
- case "ThrottlingException":
1681
- case "com.amazonaws.amp#ThrottlingException":
1682
- response = {
1683
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1684
- name: errorCode,
1685
- $metadata: deserializeMetadata(output),
1686
- };
1687
- break;
1688
- case "ValidationException":
1689
- case "com.amazonaws.amp#ValidationException":
1690
- response = {
1691
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1692
- name: errorCode,
1693
- $metadata: deserializeMetadata(output),
1694
- };
1695
- break;
1696
- default:
1697
- const parsedBody = parsedOutput.body;
1698
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1699
- response = {
1700
- ...parsedBody,
1701
- name: `${errorCode}`,
1702
- message: parsedBody.message || parsedBody.Message || errorCode,
1703
- $fault: "client",
1704
- $metadata: deserializeMetadata(output),
1705
- } as any;
1706
- }
1707
- const message = response.message || response.Message || errorCode;
1708
- response.message = message;
1709
- delete response.Message;
1710
- return Promise.reject(Object.assign(new Error(message), response));
1711
- };
1712
-
1713
- export const deserializeAws_restJson1ListWorkspacesCommand = async (
1714
- output: __HttpResponse,
1715
- context: __SerdeContext
1716
- ): Promise<ListWorkspacesCommandOutput> => {
1717
- if (output.statusCode !== 200 && output.statusCode >= 300) {
1718
- return deserializeAws_restJson1ListWorkspacesCommandError(output, context);
1719
- }
1720
- const contents: ListWorkspacesCommandOutput = {
1721
- $metadata: deserializeMetadata(output),
1722
- nextToken: undefined,
1723
- workspaces: undefined,
1724
- };
1725
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1726
- if (data.nextToken !== undefined && data.nextToken !== null) {
1727
- contents.nextToken = __expectString(data.nextToken);
1728
- }
1729
- if (data.workspaces !== undefined && data.workspaces !== null) {
1730
- contents.workspaces = deserializeAws_restJson1WorkspaceSummaryList(data.workspaces, context);
1731
- }
1732
- return Promise.resolve(contents);
1733
- };
1734
-
1735
- const deserializeAws_restJson1ListWorkspacesCommandError = async (
1736
- output: __HttpResponse,
1737
- context: __SerdeContext
1738
- ): Promise<ListWorkspacesCommandOutput> => {
1739
- const parsedOutput: any = {
1740
- ...output,
1741
- body: await parseBody(output.body, context),
1742
- };
1743
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1744
- let errorCode = "UnknownError";
1745
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1746
- switch (errorCode) {
1747
- case "AccessDeniedException":
1748
- case "com.amazonaws.amp#AccessDeniedException":
1749
- response = {
1750
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1751
- name: errorCode,
1752
- $metadata: deserializeMetadata(output),
1753
- };
1754
- break;
1755
- case "InternalServerException":
1756
- case "com.amazonaws.amp#InternalServerException":
1757
- response = {
1758
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1759
- name: errorCode,
1760
- $metadata: deserializeMetadata(output),
1761
- };
1762
- break;
1763
- case "ThrottlingException":
1764
- case "com.amazonaws.amp#ThrottlingException":
1765
- response = {
1766
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1767
- name: errorCode,
1768
- $metadata: deserializeMetadata(output),
1769
- };
1770
- break;
1771
- case "ValidationException":
1772
- case "com.amazonaws.amp#ValidationException":
1773
- response = {
1774
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1775
- name: errorCode,
1776
- $metadata: deserializeMetadata(output),
1777
- };
1778
- break;
1779
- default:
1780
- const parsedBody = parsedOutput.body;
1781
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1782
- response = {
1783
- ...parsedBody,
1784
- name: `${errorCode}`,
1785
- message: parsedBody.message || parsedBody.Message || errorCode,
1786
- $fault: "client",
1787
- $metadata: deserializeMetadata(output),
1788
- } as any;
1789
- }
1790
- const message = response.message || response.Message || errorCode;
1791
- response.message = message;
1792
- delete response.Message;
1793
- return Promise.reject(Object.assign(new Error(message), response));
1794
- };
1795
-
1796
- export const deserializeAws_restJson1PutAlertManagerDefinitionCommand = async (
1797
- output: __HttpResponse,
1798
- context: __SerdeContext
1799
- ): Promise<PutAlertManagerDefinitionCommandOutput> => {
1800
- if (output.statusCode !== 202 && output.statusCode >= 300) {
1801
- return deserializeAws_restJson1PutAlertManagerDefinitionCommandError(output, context);
1802
- }
1803
- const contents: PutAlertManagerDefinitionCommandOutput = {
1804
- $metadata: deserializeMetadata(output),
1805
- status: undefined,
1806
- };
1807
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1808
- if (data.status !== undefined && data.status !== null) {
1809
- contents.status = deserializeAws_restJson1AlertManagerDefinitionStatus(data.status, context);
1810
- }
1811
- return Promise.resolve(contents);
1812
- };
1813
-
1814
- const deserializeAws_restJson1PutAlertManagerDefinitionCommandError = async (
1815
- output: __HttpResponse,
1816
- context: __SerdeContext
1817
- ): Promise<PutAlertManagerDefinitionCommandOutput> => {
1818
- const parsedOutput: any = {
1819
- ...output,
1820
- body: await parseBody(output.body, context),
1821
- };
1822
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1823
- let errorCode = "UnknownError";
1824
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1825
- switch (errorCode) {
1826
- case "AccessDeniedException":
1827
- case "com.amazonaws.amp#AccessDeniedException":
1828
- response = {
1829
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1830
- name: errorCode,
1831
- $metadata: deserializeMetadata(output),
1832
- };
1833
- break;
1834
- case "ConflictException":
1835
- case "com.amazonaws.amp#ConflictException":
1836
- response = {
1837
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
1838
- name: errorCode,
1839
- $metadata: deserializeMetadata(output),
1840
- };
1841
- break;
1842
- case "InternalServerException":
1843
- case "com.amazonaws.amp#InternalServerException":
1844
- response = {
1845
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1846
- name: errorCode,
1847
- $metadata: deserializeMetadata(output),
1848
- };
1849
- break;
1850
- case "ResourceNotFoundException":
1851
- case "com.amazonaws.amp#ResourceNotFoundException":
1852
- response = {
1853
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1854
- name: errorCode,
1855
- $metadata: deserializeMetadata(output),
1856
- };
1857
- break;
1858
- case "ServiceQuotaExceededException":
1859
- case "com.amazonaws.amp#ServiceQuotaExceededException":
1860
- response = {
1861
- ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
1862
- name: errorCode,
1863
- $metadata: deserializeMetadata(output),
1864
- };
1865
- break;
1866
- case "ThrottlingException":
1867
- case "com.amazonaws.amp#ThrottlingException":
1868
- response = {
1869
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1870
- name: errorCode,
1871
- $metadata: deserializeMetadata(output),
1872
- };
1873
- break;
1874
- case "ValidationException":
1875
- case "com.amazonaws.amp#ValidationException":
1876
- response = {
1877
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1878
- name: errorCode,
1879
- $metadata: deserializeMetadata(output),
1880
- };
1881
- break;
1882
- default:
1883
- const parsedBody = parsedOutput.body;
1884
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1885
- response = {
1886
- ...parsedBody,
1887
- name: `${errorCode}`,
1888
- message: parsedBody.message || parsedBody.Message || errorCode,
1889
- $fault: "client",
1890
- $metadata: deserializeMetadata(output),
1891
- } as any;
1892
- }
1893
- const message = response.message || response.Message || errorCode;
1894
- response.message = message;
1895
- delete response.Message;
1896
- return Promise.reject(Object.assign(new Error(message), response));
1897
- };
1898
-
1899
- export const deserializeAws_restJson1PutRuleGroupsNamespaceCommand = async (
1900
- output: __HttpResponse,
1901
- context: __SerdeContext
1902
- ): Promise<PutRuleGroupsNamespaceCommandOutput> => {
1903
- if (output.statusCode !== 202 && output.statusCode >= 300) {
1904
- return deserializeAws_restJson1PutRuleGroupsNamespaceCommandError(output, context);
1905
- }
1906
- const contents: PutRuleGroupsNamespaceCommandOutput = {
1907
- $metadata: deserializeMetadata(output),
1908
- arn: undefined,
1909
- name: undefined,
1910
- status: undefined,
1911
- tags: undefined,
1912
- };
1913
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1914
- if (data.arn !== undefined && data.arn !== null) {
1915
- contents.arn = __expectString(data.arn);
1916
- }
1917
- if (data.name !== undefined && data.name !== null) {
1918
- contents.name = __expectString(data.name);
1919
- }
1920
- if (data.status !== undefined && data.status !== null) {
1921
- contents.status = deserializeAws_restJson1RuleGroupsNamespaceStatus(data.status, context);
1922
- }
1923
- if (data.tags !== undefined && data.tags !== null) {
1924
- contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
1925
- }
1926
- return Promise.resolve(contents);
1927
- };
1928
-
1929
- const deserializeAws_restJson1PutRuleGroupsNamespaceCommandError = async (
1930
- output: __HttpResponse,
1931
- context: __SerdeContext
1932
- ): Promise<PutRuleGroupsNamespaceCommandOutput> => {
1933
- const parsedOutput: any = {
1934
- ...output,
1935
- body: await parseBody(output.body, context),
1936
- };
1937
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
1938
- let errorCode = "UnknownError";
1939
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1940
- switch (errorCode) {
1941
- case "AccessDeniedException":
1942
- case "com.amazonaws.amp#AccessDeniedException":
1943
- response = {
1944
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1945
- name: errorCode,
1946
- $metadata: deserializeMetadata(output),
1947
- };
1948
- break;
1949
- case "ConflictException":
1950
- case "com.amazonaws.amp#ConflictException":
1951
- response = {
1952
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
1953
- name: errorCode,
1954
- $metadata: deserializeMetadata(output),
1955
- };
1956
- break;
1957
- case "InternalServerException":
1958
- case "com.amazonaws.amp#InternalServerException":
1959
- response = {
1960
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1961
- name: errorCode,
1962
- $metadata: deserializeMetadata(output),
1963
- };
1964
- break;
1965
- case "ResourceNotFoundException":
1966
- case "com.amazonaws.amp#ResourceNotFoundException":
1967
- response = {
1968
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1969
- name: errorCode,
1970
- $metadata: deserializeMetadata(output),
1971
- };
1972
- break;
1973
- case "ServiceQuotaExceededException":
1974
- case "com.amazonaws.amp#ServiceQuotaExceededException":
1975
- response = {
1976
- ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
1977
- name: errorCode,
1978
- $metadata: deserializeMetadata(output),
1979
- };
1980
- break;
1981
- case "ThrottlingException":
1982
- case "com.amazonaws.amp#ThrottlingException":
1983
- response = {
1984
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1985
- name: errorCode,
1986
- $metadata: deserializeMetadata(output),
1987
- };
1988
- break;
1989
- case "ValidationException":
1990
- case "com.amazonaws.amp#ValidationException":
1991
- response = {
1992
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1993
- name: errorCode,
1994
- $metadata: deserializeMetadata(output),
1995
- };
1996
- break;
1997
- default:
1998
- const parsedBody = parsedOutput.body;
1999
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2000
- response = {
2001
- ...parsedBody,
2002
- name: `${errorCode}`,
2003
- message: parsedBody.message || parsedBody.Message || errorCode,
2004
- $fault: "client",
2005
- $metadata: deserializeMetadata(output),
2006
- } as any;
2007
- }
2008
- const message = response.message || response.Message || errorCode;
2009
- response.message = message;
2010
- delete response.Message;
2011
- return Promise.reject(Object.assign(new Error(message), response));
2012
- };
2013
-
2014
- export const deserializeAws_restJson1TagResourceCommand = async (
2015
- output: __HttpResponse,
2016
- context: __SerdeContext
2017
- ): Promise<TagResourceCommandOutput> => {
2018
- if (output.statusCode !== 200 && output.statusCode >= 300) {
2019
- return deserializeAws_restJson1TagResourceCommandError(output, context);
2020
- }
2021
- const contents: TagResourceCommandOutput = {
2022
- $metadata: deserializeMetadata(output),
2023
- };
2024
- await collectBody(output.body, context);
2025
- return Promise.resolve(contents);
2026
- };
2027
-
2028
- const deserializeAws_restJson1TagResourceCommandError = async (
2029
- output: __HttpResponse,
2030
- context: __SerdeContext
2031
- ): Promise<TagResourceCommandOutput> => {
2032
- const parsedOutput: any = {
2033
- ...output,
2034
- body: await parseBody(output.body, context),
2035
- };
2036
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
2037
- let errorCode = "UnknownError";
2038
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2039
- switch (errorCode) {
2040
- case "AccessDeniedException":
2041
- case "com.amazonaws.amp#AccessDeniedException":
2042
- response = {
2043
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2044
- name: errorCode,
2045
- $metadata: deserializeMetadata(output),
2046
- };
2047
- break;
2048
- case "InternalServerException":
2049
- case "com.amazonaws.amp#InternalServerException":
2050
- response = {
2051
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2052
- name: errorCode,
2053
- $metadata: deserializeMetadata(output),
2054
- };
2055
- break;
2056
- case "ResourceNotFoundException":
2057
- case "com.amazonaws.amp#ResourceNotFoundException":
2058
- response = {
2059
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2060
- name: errorCode,
2061
- $metadata: deserializeMetadata(output),
2062
- };
2063
- break;
2064
- case "ThrottlingException":
2065
- case "com.amazonaws.amp#ThrottlingException":
2066
- response = {
2067
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2068
- name: errorCode,
2069
- $metadata: deserializeMetadata(output),
2070
- };
2071
- break;
2072
- case "ValidationException":
2073
- case "com.amazonaws.amp#ValidationException":
2074
- response = {
2075
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2076
- name: errorCode,
2077
- $metadata: deserializeMetadata(output),
2078
- };
2079
- break;
2080
- default:
2081
- const parsedBody = parsedOutput.body;
2082
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2083
- response = {
2084
- ...parsedBody,
2085
- name: `${errorCode}`,
2086
- message: parsedBody.message || parsedBody.Message || errorCode,
2087
- $fault: "client",
2088
- $metadata: deserializeMetadata(output),
2089
- } as any;
2090
- }
2091
- const message = response.message || response.Message || errorCode;
2092
- response.message = message;
2093
- delete response.Message;
2094
- return Promise.reject(Object.assign(new Error(message), response));
2095
- };
2096
-
2097
- export const deserializeAws_restJson1UntagResourceCommand = async (
2098
- output: __HttpResponse,
2099
- context: __SerdeContext
2100
- ): Promise<UntagResourceCommandOutput> => {
2101
- if (output.statusCode !== 200 && output.statusCode >= 300) {
2102
- return deserializeAws_restJson1UntagResourceCommandError(output, context);
2103
- }
2104
- const contents: UntagResourceCommandOutput = {
2105
- $metadata: deserializeMetadata(output),
2106
- };
2107
- await collectBody(output.body, context);
2108
- return Promise.resolve(contents);
2109
- };
2110
-
2111
- const deserializeAws_restJson1UntagResourceCommandError = async (
2112
- output: __HttpResponse,
2113
- context: __SerdeContext
2114
- ): Promise<UntagResourceCommandOutput> => {
2115
- const parsedOutput: any = {
2116
- ...output,
2117
- body: await parseBody(output.body, context),
2118
- };
2119
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
2120
- let errorCode = "UnknownError";
2121
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2122
- switch (errorCode) {
2123
- case "AccessDeniedException":
2124
- case "com.amazonaws.amp#AccessDeniedException":
2125
- response = {
2126
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2127
- name: errorCode,
2128
- $metadata: deserializeMetadata(output),
2129
- };
2130
- break;
2131
- case "InternalServerException":
2132
- case "com.amazonaws.amp#InternalServerException":
2133
- response = {
2134
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2135
- name: errorCode,
2136
- $metadata: deserializeMetadata(output),
2137
- };
2138
- break;
2139
- case "ResourceNotFoundException":
2140
- case "com.amazonaws.amp#ResourceNotFoundException":
2141
- response = {
2142
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2143
- name: errorCode,
2144
- $metadata: deserializeMetadata(output),
2145
- };
2146
- break;
2147
- case "ThrottlingException":
2148
- case "com.amazonaws.amp#ThrottlingException":
2149
- response = {
2150
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2151
- name: errorCode,
2152
- $metadata: deserializeMetadata(output),
2153
- };
2154
- break;
2155
- case "ValidationException":
2156
- case "com.amazonaws.amp#ValidationException":
2157
- response = {
2158
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2159
- name: errorCode,
2160
- $metadata: deserializeMetadata(output),
2161
- };
2162
- break;
2163
- default:
2164
- const parsedBody = parsedOutput.body;
2165
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2166
- response = {
2167
- ...parsedBody,
2168
- name: `${errorCode}`,
2169
- message: parsedBody.message || parsedBody.Message || errorCode,
2170
- $fault: "client",
2171
- $metadata: deserializeMetadata(output),
2172
- } as any;
2173
- }
2174
- const message = response.message || response.Message || errorCode;
2175
- response.message = message;
2176
- delete response.Message;
2177
- return Promise.reject(Object.assign(new Error(message), response));
2178
- };
2179
-
2180
- export const deserializeAws_restJson1UpdateWorkspaceAliasCommand = async (
2181
- output: __HttpResponse,
2182
- context: __SerdeContext
2183
- ): Promise<UpdateWorkspaceAliasCommandOutput> => {
2184
- if (output.statusCode !== 204 && output.statusCode >= 300) {
2185
- return deserializeAws_restJson1UpdateWorkspaceAliasCommandError(output, context);
2186
- }
2187
- const contents: UpdateWorkspaceAliasCommandOutput = {
2188
- $metadata: deserializeMetadata(output),
2189
- };
2190
- await collectBody(output.body, context);
2191
- return Promise.resolve(contents);
2192
- };
2193
-
2194
- const deserializeAws_restJson1UpdateWorkspaceAliasCommandError = async (
2195
- output: __HttpResponse,
2196
- context: __SerdeContext
2197
- ): Promise<UpdateWorkspaceAliasCommandOutput> => {
2198
- const parsedOutput: any = {
2199
- ...output,
2200
- body: await parseBody(output.body, context),
2201
- };
2202
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
2203
- let errorCode = "UnknownError";
2204
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2205
- switch (errorCode) {
2206
- case "AccessDeniedException":
2207
- case "com.amazonaws.amp#AccessDeniedException":
2208
- response = {
2209
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2210
- name: errorCode,
2211
- $metadata: deserializeMetadata(output),
2212
- };
2213
- break;
2214
- case "ConflictException":
2215
- case "com.amazonaws.amp#ConflictException":
2216
- response = {
2217
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
2218
- name: errorCode,
2219
- $metadata: deserializeMetadata(output),
2220
- };
2221
- break;
2222
- case "InternalServerException":
2223
- case "com.amazonaws.amp#InternalServerException":
2224
- response = {
2225
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2226
- name: errorCode,
2227
- $metadata: deserializeMetadata(output),
2228
- };
2229
- break;
2230
- case "ResourceNotFoundException":
2231
- case "com.amazonaws.amp#ResourceNotFoundException":
2232
- response = {
2233
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2234
- name: errorCode,
2235
- $metadata: deserializeMetadata(output),
2236
- };
2237
- break;
2238
- case "ServiceQuotaExceededException":
2239
- case "com.amazonaws.amp#ServiceQuotaExceededException":
2240
- response = {
2241
- ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
2242
- name: errorCode,
2243
- $metadata: deserializeMetadata(output),
2244
- };
2245
- break;
2246
- case "ThrottlingException":
2247
- case "com.amazonaws.amp#ThrottlingException":
2248
- response = {
2249
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2250
- name: errorCode,
2251
- $metadata: deserializeMetadata(output),
2252
- };
2253
- break;
2254
- case "ValidationException":
2255
- case "com.amazonaws.amp#ValidationException":
2256
- response = {
2257
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2258
- name: errorCode,
2259
- $metadata: deserializeMetadata(output),
2260
- };
2261
- break;
2262
- default:
2263
- const parsedBody = parsedOutput.body;
2264
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2265
- response = {
2266
- ...parsedBody,
2267
- name: `${errorCode}`,
2268
- message: parsedBody.message || parsedBody.Message || errorCode,
2269
- $fault: "client",
2270
- $metadata: deserializeMetadata(output),
2271
- } as any;
2272
- }
2273
- const message = response.message || response.Message || errorCode;
2274
- response.message = message;
2275
- delete response.Message;
2276
- return Promise.reject(Object.assign(new Error(message), response));
2277
- };
2278
-
2279
- const deserializeAws_restJson1AccessDeniedExceptionResponse = async (
2280
- parsedOutput: any,
2281
- context: __SerdeContext
2282
- ): Promise<AccessDeniedException> => {
2283
- const contents: AccessDeniedException = {
2284
- name: "AccessDeniedException",
2285
- $fault: "client",
2286
- $metadata: deserializeMetadata(parsedOutput),
2287
- message: undefined,
2288
- };
2289
- const data: any = parsedOutput.body;
2290
- if (data.message !== undefined && data.message !== null) {
2291
- contents.message = __expectString(data.message);
2292
- }
2293
- return contents;
2294
- };
2295
-
2296
- const deserializeAws_restJson1ConflictExceptionResponse = async (
2297
- parsedOutput: any,
2298
- context: __SerdeContext
2299
- ): Promise<ConflictException> => {
2300
- const contents: ConflictException = {
2301
- name: "ConflictException",
2302
- $fault: "client",
2303
- $metadata: deserializeMetadata(parsedOutput),
2304
- message: undefined,
2305
- resourceId: undefined,
2306
- resourceType: undefined,
2307
- };
2308
- const data: any = parsedOutput.body;
2309
- if (data.message !== undefined && data.message !== null) {
2310
- contents.message = __expectString(data.message);
2311
- }
2312
- if (data.resourceId !== undefined && data.resourceId !== null) {
2313
- contents.resourceId = __expectString(data.resourceId);
2314
- }
2315
- if (data.resourceType !== undefined && data.resourceType !== null) {
2316
- contents.resourceType = __expectString(data.resourceType);
2317
- }
2318
- return contents;
2319
- };
2320
-
2321
- const deserializeAws_restJson1InternalServerExceptionResponse = async (
2322
- parsedOutput: any,
2323
- context: __SerdeContext
2324
- ): Promise<InternalServerException> => {
2325
- const contents: InternalServerException = {
2326
- name: "InternalServerException",
2327
- $fault: "server",
2328
- $retryable: {},
2329
- $metadata: deserializeMetadata(parsedOutput),
2330
- message: undefined,
2331
- retryAfterSeconds: undefined,
2332
- };
2333
- if (parsedOutput.headers["retry-after"] !== undefined) {
2334
- contents.retryAfterSeconds = __strictParseInt32(parsedOutput.headers["retry-after"]);
2335
- }
2336
- const data: any = parsedOutput.body;
2337
- if (data.message !== undefined && data.message !== null) {
2338
- contents.message = __expectString(data.message);
2339
- }
2340
- return contents;
2341
- };
2342
-
2343
- const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (
2344
- parsedOutput: any,
2345
- context: __SerdeContext
2346
- ): Promise<ResourceNotFoundException> => {
2347
- const contents: ResourceNotFoundException = {
2348
- name: "ResourceNotFoundException",
2349
- $fault: "client",
2350
- $metadata: deserializeMetadata(parsedOutput),
2351
- message: undefined,
2352
- resourceId: undefined,
2353
- resourceType: undefined,
2354
- };
2355
- const data: any = parsedOutput.body;
2356
- if (data.message !== undefined && data.message !== null) {
2357
- contents.message = __expectString(data.message);
2358
- }
2359
- if (data.resourceId !== undefined && data.resourceId !== null) {
2360
- contents.resourceId = __expectString(data.resourceId);
2361
- }
2362
- if (data.resourceType !== undefined && data.resourceType !== null) {
2363
- contents.resourceType = __expectString(data.resourceType);
2364
- }
2365
- return contents;
2366
- };
2367
-
2368
- const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (
2369
- parsedOutput: any,
2370
- context: __SerdeContext
2371
- ): Promise<ServiceQuotaExceededException> => {
2372
- const contents: ServiceQuotaExceededException = {
2373
- name: "ServiceQuotaExceededException",
2374
- $fault: "client",
2375
- $metadata: deserializeMetadata(parsedOutput),
2376
- message: undefined,
2377
- quotaCode: undefined,
2378
- resourceId: undefined,
2379
- resourceType: undefined,
2380
- serviceCode: undefined,
2381
- };
2382
- const data: any = parsedOutput.body;
2383
- if (data.message !== undefined && data.message !== null) {
2384
- contents.message = __expectString(data.message);
2385
- }
2386
- if (data.quotaCode !== undefined && data.quotaCode !== null) {
2387
- contents.quotaCode = __expectString(data.quotaCode);
2388
- }
2389
- if (data.resourceId !== undefined && data.resourceId !== null) {
2390
- contents.resourceId = __expectString(data.resourceId);
2391
- }
2392
- if (data.resourceType !== undefined && data.resourceType !== null) {
2393
- contents.resourceType = __expectString(data.resourceType);
2394
- }
2395
- if (data.serviceCode !== undefined && data.serviceCode !== null) {
2396
- contents.serviceCode = __expectString(data.serviceCode);
2397
- }
2398
- return contents;
2399
- };
2400
-
2401
- const deserializeAws_restJson1ThrottlingExceptionResponse = async (
2402
- parsedOutput: any,
2403
- context: __SerdeContext
2404
- ): Promise<ThrottlingException> => {
2405
- const contents: ThrottlingException = {
2406
- name: "ThrottlingException",
2407
- $fault: "client",
2408
- $retryable: {},
2409
- $metadata: deserializeMetadata(parsedOutput),
2410
- message: undefined,
2411
- quotaCode: undefined,
2412
- retryAfterSeconds: undefined,
2413
- serviceCode: undefined,
2414
- };
2415
- if (parsedOutput.headers["retry-after"] !== undefined) {
2416
- contents.retryAfterSeconds = __strictParseInt32(parsedOutput.headers["retry-after"]);
2417
- }
2418
- const data: any = parsedOutput.body;
2419
- if (data.message !== undefined && data.message !== null) {
2420
- contents.message = __expectString(data.message);
2421
- }
2422
- if (data.quotaCode !== undefined && data.quotaCode !== null) {
2423
- contents.quotaCode = __expectString(data.quotaCode);
2424
- }
2425
- if (data.serviceCode !== undefined && data.serviceCode !== null) {
2426
- contents.serviceCode = __expectString(data.serviceCode);
2427
- }
2428
- return contents;
2429
- };
2430
-
2431
- const deserializeAws_restJson1ValidationExceptionResponse = async (
2432
- parsedOutput: any,
2433
- context: __SerdeContext
2434
- ): Promise<ValidationException> => {
2435
- const contents: ValidationException = {
2436
- name: "ValidationException",
2437
- $fault: "client",
2438
- $metadata: deserializeMetadata(parsedOutput),
2439
- fieldList: undefined,
2440
- message: undefined,
2441
- reason: undefined,
2442
- };
2443
- const data: any = parsedOutput.body;
2444
- if (data.fieldList !== undefined && data.fieldList !== null) {
2445
- contents.fieldList = deserializeAws_restJson1ValidationExceptionFieldList(data.fieldList, context);
2446
- }
2447
- if (data.message !== undefined && data.message !== null) {
2448
- contents.message = __expectString(data.message);
2449
- }
2450
- if (data.reason !== undefined && data.reason !== null) {
2451
- contents.reason = __expectString(data.reason);
2452
- }
2453
- return contents;
2454
- };
2455
-
2456
- const serializeAws_restJson1TagMap = (input: { [key: string]: string }, context: __SerdeContext): any => {
2457
- return Object.entries(input).reduce((acc: { [key: string]: any }, [key, value]: [string, any]) => {
2458
- if (value === null) {
2459
- return acc;
2460
- }
2461
- return {
2462
- ...acc,
2463
- [key]: value,
2464
- };
2465
- }, {});
2466
- };
2467
-
2468
- const deserializeAws_restJson1AlertManagerDefinitionDescription = (
2469
- output: any,
2470
- context: __SerdeContext
2471
- ): AlertManagerDefinitionDescription => {
2472
- return {
2473
- createdAt:
2474
- output.createdAt !== undefined && output.createdAt !== null
2475
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt)))
2476
- : undefined,
2477
- data: output.data !== undefined && output.data !== null ? context.base64Decoder(output.data) : undefined,
2478
- modifiedAt:
2479
- output.modifiedAt !== undefined && output.modifiedAt !== null
2480
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.modifiedAt)))
2481
- : undefined,
2482
- status:
2483
- output.status !== undefined && output.status !== null
2484
- ? deserializeAws_restJson1AlertManagerDefinitionStatus(output.status, context)
2485
- : undefined,
2486
- } as any;
2487
- };
2488
-
2489
- const deserializeAws_restJson1AlertManagerDefinitionStatus = (
2490
- output: any,
2491
- context: __SerdeContext
2492
- ): AlertManagerDefinitionStatus => {
2493
- return {
2494
- statusCode: __expectString(output.statusCode),
2495
- statusReason: __expectString(output.statusReason),
2496
- } as any;
2497
- };
2498
-
2499
- const deserializeAws_restJson1RuleGroupsNamespaceDescription = (
2500
- output: any,
2501
- context: __SerdeContext
2502
- ): RuleGroupsNamespaceDescription => {
2503
- return {
2504
- arn: __expectString(output.arn),
2505
- createdAt:
2506
- output.createdAt !== undefined && output.createdAt !== null
2507
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt)))
2508
- : undefined,
2509
- data: output.data !== undefined && output.data !== null ? context.base64Decoder(output.data) : undefined,
2510
- modifiedAt:
2511
- output.modifiedAt !== undefined && output.modifiedAt !== null
2512
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.modifiedAt)))
2513
- : undefined,
2514
- name: __expectString(output.name),
2515
- status:
2516
- output.status !== undefined && output.status !== null
2517
- ? deserializeAws_restJson1RuleGroupsNamespaceStatus(output.status, context)
2518
- : undefined,
2519
- tags:
2520
- output.tags !== undefined && output.tags !== null
2521
- ? deserializeAws_restJson1TagMap(output.tags, context)
2522
- : undefined,
2523
- } as any;
2524
- };
2525
-
2526
- const deserializeAws_restJson1RuleGroupsNamespaceStatus = (
2527
- output: any,
2528
- context: __SerdeContext
2529
- ): RuleGroupsNamespaceStatus => {
2530
- return {
2531
- statusCode: __expectString(output.statusCode),
2532
- statusReason: __expectString(output.statusReason),
2533
- } as any;
2534
- };
2535
-
2536
- const deserializeAws_restJson1RuleGroupsNamespaceSummary = (
2537
- output: any,
2538
- context: __SerdeContext
2539
- ): RuleGroupsNamespaceSummary => {
2540
- return {
2541
- arn: __expectString(output.arn),
2542
- createdAt:
2543
- output.createdAt !== undefined && output.createdAt !== null
2544
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt)))
2545
- : undefined,
2546
- modifiedAt:
2547
- output.modifiedAt !== undefined && output.modifiedAt !== null
2548
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.modifiedAt)))
2549
- : undefined,
2550
- name: __expectString(output.name),
2551
- status:
2552
- output.status !== undefined && output.status !== null
2553
- ? deserializeAws_restJson1RuleGroupsNamespaceStatus(output.status, context)
2554
- : undefined,
2555
- tags:
2556
- output.tags !== undefined && output.tags !== null
2557
- ? deserializeAws_restJson1TagMap(output.tags, context)
2558
- : undefined,
2559
- } as any;
2560
- };
2561
-
2562
- const deserializeAws_restJson1RuleGroupsNamespaceSummaryList = (
2563
- output: any,
2564
- context: __SerdeContext
2565
- ): RuleGroupsNamespaceSummary[] => {
2566
- return (output || [])
2567
- .filter((e: any) => e != null)
2568
- .map((entry: any) => {
2569
- if (entry === null) {
2570
- return null as any;
2571
- }
2572
- return deserializeAws_restJson1RuleGroupsNamespaceSummary(entry, context);
2573
- });
2574
- };
2575
-
2576
- const deserializeAws_restJson1TagMap = (output: any, context: __SerdeContext): { [key: string]: string } => {
2577
- return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => {
2578
- if (value === null) {
2579
- return acc;
2580
- }
2581
- return {
2582
- ...acc,
2583
- [key]: __expectString(value) as any,
2584
- };
2585
- }, {});
2586
- };
2587
-
2588
- const deserializeAws_restJson1ValidationExceptionField = (
2589
- output: any,
2590
- context: __SerdeContext
2591
- ): ValidationExceptionField => {
2592
- return {
2593
- message: __expectString(output.message),
2594
- name: __expectString(output.name),
2595
- } as any;
2596
- };
2597
-
2598
- const deserializeAws_restJson1ValidationExceptionFieldList = (
2599
- output: any,
2600
- context: __SerdeContext
2601
- ): ValidationExceptionField[] => {
2602
- return (output || [])
2603
- .filter((e: any) => e != null)
2604
- .map((entry: any) => {
2605
- if (entry === null) {
2606
- return null as any;
2607
- }
2608
- return deserializeAws_restJson1ValidationExceptionField(entry, context);
2609
- });
2610
- };
2611
-
2612
- const deserializeAws_restJson1WorkspaceDescription = (output: any, context: __SerdeContext): WorkspaceDescription => {
2613
- return {
2614
- alias: __expectString(output.alias),
2615
- arn: __expectString(output.arn),
2616
- createdAt:
2617
- output.createdAt !== undefined && output.createdAt !== null
2618
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt)))
2619
- : undefined,
2620
- prometheusEndpoint: __expectString(output.prometheusEndpoint),
2621
- status:
2622
- output.status !== undefined && output.status !== null
2623
- ? deserializeAws_restJson1WorkspaceStatus(output.status, context)
2624
- : undefined,
2625
- tags:
2626
- output.tags !== undefined && output.tags !== null
2627
- ? deserializeAws_restJson1TagMap(output.tags, context)
2628
- : undefined,
2629
- workspaceId: __expectString(output.workspaceId),
2630
- } as any;
2631
- };
2632
-
2633
- const deserializeAws_restJson1WorkspaceStatus = (output: any, context: __SerdeContext): WorkspaceStatus => {
2634
- return {
2635
- statusCode: __expectString(output.statusCode),
2636
- } as any;
2637
- };
2638
-
2639
- const deserializeAws_restJson1WorkspaceSummary = (output: any, context: __SerdeContext): WorkspaceSummary => {
2640
- return {
2641
- alias: __expectString(output.alias),
2642
- arn: __expectString(output.arn),
2643
- createdAt:
2644
- output.createdAt !== undefined && output.createdAt !== null
2645
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt)))
2646
- : undefined,
2647
- status:
2648
- output.status !== undefined && output.status !== null
2649
- ? deserializeAws_restJson1WorkspaceStatus(output.status, context)
2650
- : undefined,
2651
- tags:
2652
- output.tags !== undefined && output.tags !== null
2653
- ? deserializeAws_restJson1TagMap(output.tags, context)
2654
- : undefined,
2655
- workspaceId: __expectString(output.workspaceId),
2656
- } as any;
2657
- };
2658
-
2659
- const deserializeAws_restJson1WorkspaceSummaryList = (output: any, context: __SerdeContext): WorkspaceSummary[] => {
2660
- return (output || [])
2661
- .filter((e: any) => e != null)
2662
- .map((entry: any) => {
2663
- if (entry === null) {
2664
- return null as any;
2665
- }
2666
- return deserializeAws_restJson1WorkspaceSummary(entry, context);
2667
- });
2668
- };
2669
-
2670
- const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
2671
- httpStatusCode: output.statusCode,
2672
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
2673
- extendedRequestId: output.headers["x-amz-id-2"],
2674
- cfId: output.headers["x-amz-cf-id"],
2675
- });
2676
-
2677
- // Collect low-level response body stream to Uint8Array.
2678
- const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
2679
- if (streamBody instanceof Uint8Array) {
2680
- return Promise.resolve(streamBody);
2681
- }
2682
- return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
2683
- };
2684
-
2685
- // Encode Uint8Array data into string with utf-8.
2686
- const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
2687
- collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
2688
-
2689
- const isSerializableHeaderValue = (value: any): boolean =>
2690
- value !== undefined &&
2691
- value !== null &&
2692
- value !== "" &&
2693
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
2694
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
2695
-
2696
- const parseBody = (streamBody: any, context: __SerdeContext): any =>
2697
- collectBodyString(streamBody, context).then((encoded) => {
2698
- if (encoded.length) {
2699
- return JSON.parse(encoded);
2700
- }
2701
- return {};
2702
- });
2703
-
2704
- /**
2705
- * Load an error code for the aws.rest-json-1.1 protocol.
2706
- */
2707
- const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => {
2708
- const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
2709
-
2710
- const sanitizeErrorCode = (rawValue: string): string => {
2711
- let cleanValue = rawValue;
2712
- if (cleanValue.indexOf(":") >= 0) {
2713
- cleanValue = cleanValue.split(":")[0];
2714
- }
2715
- if (cleanValue.indexOf("#") >= 0) {
2716
- cleanValue = cleanValue.split("#")[1];
2717
- }
2718
- return cleanValue;
2719
- };
2720
-
2721
- const headerKey = findKey(output.headers, "x-amzn-errortype");
2722
- if (headerKey !== undefined) {
2723
- return sanitizeErrorCode(output.headers[headerKey]);
2724
- }
2725
-
2726
- if (data.code !== undefined) {
2727
- return sanitizeErrorCode(data.code);
2728
- }
2729
-
2730
- if (data["__type"] !== undefined) {
2731
- return sanitizeErrorCode(data["__type"]);
2732
- }
2733
-
2734
- return "";
2735
- };