@aws-sdk/client-arc-zonal-shift 3.219.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 (103) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +219 -0
  3. package/dist-cjs/ARCZonalShift.js +97 -0
  4. package/dist-cjs/ARCZonalShiftClient.js +40 -0
  5. package/dist-cjs/commands/CancelZonalShiftCommand.js +46 -0
  6. package/dist-cjs/commands/GetManagedResourceCommand.js +46 -0
  7. package/dist-cjs/commands/ListManagedResourcesCommand.js +46 -0
  8. package/dist-cjs/commands/ListZonalShiftsCommand.js +46 -0
  9. package/dist-cjs/commands/StartZonalShiftCommand.js +46 -0
  10. package/dist-cjs/commands/UpdateZonalShiftCommand.js +46 -0
  11. package/dist-cjs/commands/index.js +9 -0
  12. package/dist-cjs/endpoint/EndpointParameters.js +12 -0
  13. package/dist-cjs/endpoint/endpointResolver.js +12 -0
  14. package/dist-cjs/endpoint/ruleset.js +312 -0
  15. package/dist-cjs/index.js +11 -0
  16. package/dist-cjs/models/ARCZonalShiftServiceException.js +11 -0
  17. package/dist-cjs/models/index.js +4 -0
  18. package/dist-cjs/models/models_0.js +164 -0
  19. package/dist-cjs/pagination/Interfaces.js +2 -0
  20. package/dist-cjs/pagination/ListManagedResourcesPaginator.js +36 -0
  21. package/dist-cjs/pagination/ListZonalShiftsPaginator.js +36 -0
  22. package/dist-cjs/pagination/index.js +6 -0
  23. package/dist-cjs/protocols/Aws_restJson1.js +703 -0
  24. package/dist-cjs/runtimeConfig.browser.js +42 -0
  25. package/dist-cjs/runtimeConfig.js +50 -0
  26. package/dist-cjs/runtimeConfig.native.js +15 -0
  27. package/dist-cjs/runtimeConfig.shared.js +18 -0
  28. package/dist-es/ARCZonalShift.js +93 -0
  29. package/dist-es/ARCZonalShiftClient.js +36 -0
  30. package/dist-es/commands/CancelZonalShiftCommand.js +42 -0
  31. package/dist-es/commands/GetManagedResourceCommand.js +42 -0
  32. package/dist-es/commands/ListManagedResourcesCommand.js +42 -0
  33. package/dist-es/commands/ListZonalShiftsCommand.js +42 -0
  34. package/dist-es/commands/StartZonalShiftCommand.js +42 -0
  35. package/dist-es/commands/UpdateZonalShiftCommand.js +42 -0
  36. package/dist-es/commands/index.js +6 -0
  37. package/dist-es/endpoint/EndpointParameters.js +8 -0
  38. package/dist-es/endpoint/endpointResolver.js +8 -0
  39. package/dist-es/endpoint/ruleset.js +309 -0
  40. package/dist-es/index.js +6 -0
  41. package/dist-es/models/ARCZonalShiftServiceException.js +7 -0
  42. package/dist-es/models/index.js +1 -0
  43. package/dist-es/models/models_0.js +142 -0
  44. package/dist-es/pagination/Interfaces.js +1 -0
  45. package/dist-es/pagination/ListManagedResourcesPaginator.js +32 -0
  46. package/dist-es/pagination/ListZonalShiftsPaginator.js +32 -0
  47. package/dist-es/pagination/index.js +3 -0
  48. package/dist-es/protocols/Aws_restJson1.js +688 -0
  49. package/dist-es/runtimeConfig.browser.js +37 -0
  50. package/dist-es/runtimeConfig.js +45 -0
  51. package/dist-es/runtimeConfig.native.js +11 -0
  52. package/dist-es/runtimeConfig.shared.js +14 -0
  53. package/dist-types/ARCZonalShift.d.ts +77 -0
  54. package/dist-types/ARCZonalShiftClient.d.ts +161 -0
  55. package/dist-types/commands/CancelZonalShiftCommand.d.ts +37 -0
  56. package/dist-types/commands/GetManagedResourceCommand.d.ts +39 -0
  57. package/dist-types/commands/ListManagedResourcesCommand.d.ts +39 -0
  58. package/dist-types/commands/ListZonalShiftsCommand.d.ts +37 -0
  59. package/dist-types/commands/StartZonalShiftCommand.d.ts +46 -0
  60. package/dist-types/commands/UpdateZonalShiftCommand.d.ts +38 -0
  61. package/dist-types/commands/index.d.ts +6 -0
  62. package/dist-types/endpoint/EndpointParameters.d.ts +19 -0
  63. package/dist-types/endpoint/endpointResolver.d.ts +5 -0
  64. package/dist-types/endpoint/ruleset.d.ts +2 -0
  65. package/dist-types/index.d.ts +6 -0
  66. package/dist-types/models/ARCZonalShiftServiceException.d.ts +10 -0
  67. package/dist-types/models/index.d.ts +1 -0
  68. package/dist-types/models/models_0.d.ts +503 -0
  69. package/dist-types/pagination/Interfaces.d.ts +6 -0
  70. package/dist-types/pagination/ListManagedResourcesPaginator.d.ts +4 -0
  71. package/dist-types/pagination/ListZonalShiftsPaginator.d.ts +4 -0
  72. package/dist-types/pagination/index.d.ts +3 -0
  73. package/dist-types/protocols/Aws_restJson1.d.ts +20 -0
  74. package/dist-types/runtimeConfig.browser.d.ts +42 -0
  75. package/dist-types/runtimeConfig.d.ts +42 -0
  76. package/dist-types/runtimeConfig.native.d.ts +41 -0
  77. package/dist-types/runtimeConfig.shared.d.ts +16 -0
  78. package/dist-types/ts3.4/ARCZonalShift.d.ts +106 -0
  79. package/dist-types/ts3.4/ARCZonalShiftClient.d.ts +148 -0
  80. package/dist-types/ts3.4/commands/CancelZonalShiftCommand.d.ts +34 -0
  81. package/dist-types/ts3.4/commands/GetManagedResourceCommand.d.ts +38 -0
  82. package/dist-types/ts3.4/commands/ListManagedResourcesCommand.d.ts +41 -0
  83. package/dist-types/ts3.4/commands/ListZonalShiftsCommand.d.ts +37 -0
  84. package/dist-types/ts3.4/commands/StartZonalShiftCommand.d.ts +34 -0
  85. package/dist-types/ts3.4/commands/UpdateZonalShiftCommand.d.ts +34 -0
  86. package/dist-types/ts3.4/commands/index.d.ts +6 -0
  87. package/dist-types/ts3.4/endpoint/EndpointParameters.d.ts +34 -0
  88. package/dist-types/ts3.4/endpoint/endpointResolver.d.ts +8 -0
  89. package/dist-types/ts3.4/endpoint/ruleset.d.ts +2 -0
  90. package/dist-types/ts3.4/index.d.ts +6 -0
  91. package/dist-types/ts3.4/models/ARCZonalShiftServiceException.d.ts +7 -0
  92. package/dist-types/ts3.4/models/index.d.ts +1 -0
  93. package/dist-types/ts3.4/models/models_0.d.ts +177 -0
  94. package/dist-types/ts3.4/pagination/Interfaces.d.ts +7 -0
  95. package/dist-types/ts3.4/pagination/ListManagedResourcesPaginator.d.ts +11 -0
  96. package/dist-types/ts3.4/pagination/ListZonalShiftsPaginator.d.ts +11 -0
  97. package/dist-types/ts3.4/pagination/index.d.ts +3 -0
  98. package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +77 -0
  99. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +88 -0
  100. package/dist-types/ts3.4/runtimeConfig.d.ts +88 -0
  101. package/dist-types/ts3.4/runtimeConfig.native.d.ts +77 -0
  102. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +16 -0
  103. package/package.json +101 -0
@@ -0,0 +1,688 @@
1
+ import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
+ import { decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, limitedParseFloat32 as __limitedParseFloat32, map as __map, parseEpochTimestamp as __parseEpochTimestamp, resolvedPath as __resolvedPath, throwDefaultError, } from "@aws-sdk/smithy-client";
3
+ import { ARCZonalShiftServiceException as __BaseException } from "../models/ARCZonalShiftServiceException";
4
+ import { AccessDeniedException, ConflictException, InternalServerException, ResourceNotFoundException, ThrottlingException, ValidationException, } from "../models/models_0";
5
+ export const serializeAws_restJson1CancelZonalShiftCommand = async (input, context) => {
6
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
7
+ const headers = {};
8
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/zonalshifts/{zonalShiftId}";
9
+ resolvedPath = __resolvedPath(resolvedPath, input, "zonalShiftId", () => input.zonalShiftId, "{zonalShiftId}", false);
10
+ let body;
11
+ return new __HttpRequest({
12
+ protocol,
13
+ hostname,
14
+ port,
15
+ method: "DELETE",
16
+ headers,
17
+ path: resolvedPath,
18
+ body,
19
+ });
20
+ };
21
+ export const serializeAws_restJson1GetManagedResourceCommand = async (input, context) => {
22
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
23
+ const headers = {};
24
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/managedresources/{resourceIdentifier}";
25
+ resolvedPath = __resolvedPath(resolvedPath, input, "resourceIdentifier", () => input.resourceIdentifier, "{resourceIdentifier}", false);
26
+ let body;
27
+ return new __HttpRequest({
28
+ protocol,
29
+ hostname,
30
+ port,
31
+ method: "GET",
32
+ headers,
33
+ path: resolvedPath,
34
+ body,
35
+ });
36
+ };
37
+ export const serializeAws_restJson1ListManagedResourcesCommand = async (input, context) => {
38
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
39
+ const headers = {};
40
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/managedresources";
41
+ const query = map({
42
+ nextToken: [, input.nextToken],
43
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
44
+ });
45
+ let body;
46
+ return new __HttpRequest({
47
+ protocol,
48
+ hostname,
49
+ port,
50
+ method: "GET",
51
+ headers,
52
+ path: resolvedPath,
53
+ query,
54
+ body,
55
+ });
56
+ };
57
+ export const serializeAws_restJson1ListZonalShiftsCommand = async (input, context) => {
58
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
59
+ const headers = {};
60
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/zonalshifts";
61
+ const query = map({
62
+ nextToken: [, input.nextToken],
63
+ status: [, input.status],
64
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
65
+ });
66
+ let body;
67
+ return new __HttpRequest({
68
+ protocol,
69
+ hostname,
70
+ port,
71
+ method: "GET",
72
+ headers,
73
+ path: resolvedPath,
74
+ query,
75
+ body,
76
+ });
77
+ };
78
+ export const serializeAws_restJson1StartZonalShiftCommand = async (input, context) => {
79
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
80
+ const headers = {
81
+ "content-type": "application/json",
82
+ };
83
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/zonalshifts";
84
+ let body;
85
+ body = JSON.stringify({
86
+ ...(input.awayFrom != null && { awayFrom: input.awayFrom }),
87
+ ...(input.comment != null && { comment: input.comment }),
88
+ ...(input.expiresIn != null && { expiresIn: input.expiresIn }),
89
+ ...(input.resourceIdentifier != null && { resourceIdentifier: input.resourceIdentifier }),
90
+ });
91
+ return new __HttpRequest({
92
+ protocol,
93
+ hostname,
94
+ port,
95
+ method: "POST",
96
+ headers,
97
+ path: resolvedPath,
98
+ body,
99
+ });
100
+ };
101
+ export const serializeAws_restJson1UpdateZonalShiftCommand = async (input, context) => {
102
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
103
+ const headers = {
104
+ "content-type": "application/json",
105
+ };
106
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/zonalshifts/{zonalShiftId}";
107
+ resolvedPath = __resolvedPath(resolvedPath, input, "zonalShiftId", () => input.zonalShiftId, "{zonalShiftId}", false);
108
+ let body;
109
+ body = JSON.stringify({
110
+ ...(input.comment != null && { comment: input.comment }),
111
+ ...(input.expiresIn != null && { expiresIn: input.expiresIn }),
112
+ });
113
+ return new __HttpRequest({
114
+ protocol,
115
+ hostname,
116
+ port,
117
+ method: "PATCH",
118
+ headers,
119
+ path: resolvedPath,
120
+ body,
121
+ });
122
+ };
123
+ export const deserializeAws_restJson1CancelZonalShiftCommand = async (output, context) => {
124
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
125
+ return deserializeAws_restJson1CancelZonalShiftCommandError(output, context);
126
+ }
127
+ const contents = map({
128
+ $metadata: deserializeMetadata(output),
129
+ });
130
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
131
+ if (data.awayFrom != null) {
132
+ contents.awayFrom = __expectString(data.awayFrom);
133
+ }
134
+ if (data.comment != null) {
135
+ contents.comment = __expectString(data.comment);
136
+ }
137
+ if (data.expiryTime != null) {
138
+ contents.expiryTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.expiryTime)));
139
+ }
140
+ if (data.resourceIdentifier != null) {
141
+ contents.resourceIdentifier = __expectString(data.resourceIdentifier);
142
+ }
143
+ if (data.startTime != null) {
144
+ contents.startTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.startTime)));
145
+ }
146
+ if (data.status != null) {
147
+ contents.status = __expectString(data.status);
148
+ }
149
+ if (data.zonalShiftId != null) {
150
+ contents.zonalShiftId = __expectString(data.zonalShiftId);
151
+ }
152
+ return contents;
153
+ };
154
+ const deserializeAws_restJson1CancelZonalShiftCommandError = async (output, context) => {
155
+ const parsedOutput = {
156
+ ...output,
157
+ body: await parseErrorBody(output.body, context),
158
+ };
159
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
160
+ switch (errorCode) {
161
+ case "AccessDeniedException":
162
+ case "com.amazonaws.arczonalshift#AccessDeniedException":
163
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
164
+ case "ConflictException":
165
+ case "com.amazonaws.arczonalshift#ConflictException":
166
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
167
+ case "InternalServerException":
168
+ case "com.amazonaws.arczonalshift#InternalServerException":
169
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
170
+ case "ResourceNotFoundException":
171
+ case "com.amazonaws.arczonalshift#ResourceNotFoundException":
172
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
173
+ case "ThrottlingException":
174
+ case "com.amazonaws.arczonalshift#ThrottlingException":
175
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
176
+ case "ValidationException":
177
+ case "com.amazonaws.arczonalshift#ValidationException":
178
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
179
+ default:
180
+ const parsedBody = parsedOutput.body;
181
+ throwDefaultError({
182
+ output,
183
+ parsedBody,
184
+ exceptionCtor: __BaseException,
185
+ errorCode,
186
+ });
187
+ }
188
+ };
189
+ export const deserializeAws_restJson1GetManagedResourceCommand = async (output, context) => {
190
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
191
+ return deserializeAws_restJson1GetManagedResourceCommandError(output, context);
192
+ }
193
+ const contents = map({
194
+ $metadata: deserializeMetadata(output),
195
+ });
196
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
197
+ if (data.appliedWeights != null) {
198
+ contents.appliedWeights = deserializeAws_restJson1AppliedWeights(data.appliedWeights, context);
199
+ }
200
+ if (data.arn != null) {
201
+ contents.arn = __expectString(data.arn);
202
+ }
203
+ if (data.name != null) {
204
+ contents.name = __expectString(data.name);
205
+ }
206
+ if (data.zonalShifts != null) {
207
+ contents.zonalShifts = deserializeAws_restJson1ZonalShiftsInResource(data.zonalShifts, context);
208
+ }
209
+ return contents;
210
+ };
211
+ const deserializeAws_restJson1GetManagedResourceCommandError = async (output, context) => {
212
+ const parsedOutput = {
213
+ ...output,
214
+ body: await parseErrorBody(output.body, context),
215
+ };
216
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
217
+ switch (errorCode) {
218
+ case "AccessDeniedException":
219
+ case "com.amazonaws.arczonalshift#AccessDeniedException":
220
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
221
+ case "InternalServerException":
222
+ case "com.amazonaws.arczonalshift#InternalServerException":
223
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
224
+ case "ResourceNotFoundException":
225
+ case "com.amazonaws.arczonalshift#ResourceNotFoundException":
226
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
227
+ case "ThrottlingException":
228
+ case "com.amazonaws.arczonalshift#ThrottlingException":
229
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
230
+ case "ValidationException":
231
+ case "com.amazonaws.arczonalshift#ValidationException":
232
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
233
+ default:
234
+ const parsedBody = parsedOutput.body;
235
+ throwDefaultError({
236
+ output,
237
+ parsedBody,
238
+ exceptionCtor: __BaseException,
239
+ errorCode,
240
+ });
241
+ }
242
+ };
243
+ export const deserializeAws_restJson1ListManagedResourcesCommand = async (output, context) => {
244
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
245
+ return deserializeAws_restJson1ListManagedResourcesCommandError(output, context);
246
+ }
247
+ const contents = map({
248
+ $metadata: deserializeMetadata(output),
249
+ });
250
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
251
+ if (data.items != null) {
252
+ contents.items = deserializeAws_restJson1ManagedResourceSummaries(data.items, context);
253
+ }
254
+ if (data.nextToken != null) {
255
+ contents.nextToken = __expectString(data.nextToken);
256
+ }
257
+ return contents;
258
+ };
259
+ const deserializeAws_restJson1ListManagedResourcesCommandError = async (output, context) => {
260
+ const parsedOutput = {
261
+ ...output,
262
+ body: await parseErrorBody(output.body, context),
263
+ };
264
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
265
+ switch (errorCode) {
266
+ case "AccessDeniedException":
267
+ case "com.amazonaws.arczonalshift#AccessDeniedException":
268
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
269
+ case "InternalServerException":
270
+ case "com.amazonaws.arczonalshift#InternalServerException":
271
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
272
+ case "ThrottlingException":
273
+ case "com.amazonaws.arczonalshift#ThrottlingException":
274
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
275
+ case "ValidationException":
276
+ case "com.amazonaws.arczonalshift#ValidationException":
277
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
278
+ default:
279
+ const parsedBody = parsedOutput.body;
280
+ throwDefaultError({
281
+ output,
282
+ parsedBody,
283
+ exceptionCtor: __BaseException,
284
+ errorCode,
285
+ });
286
+ }
287
+ };
288
+ export const deserializeAws_restJson1ListZonalShiftsCommand = async (output, context) => {
289
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
290
+ return deserializeAws_restJson1ListZonalShiftsCommandError(output, context);
291
+ }
292
+ const contents = map({
293
+ $metadata: deserializeMetadata(output),
294
+ });
295
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
296
+ if (data.items != null) {
297
+ contents.items = deserializeAws_restJson1ZonalShiftSummaries(data.items, context);
298
+ }
299
+ if (data.nextToken != null) {
300
+ contents.nextToken = __expectString(data.nextToken);
301
+ }
302
+ return contents;
303
+ };
304
+ const deserializeAws_restJson1ListZonalShiftsCommandError = async (output, context) => {
305
+ const parsedOutput = {
306
+ ...output,
307
+ body: await parseErrorBody(output.body, context),
308
+ };
309
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
310
+ switch (errorCode) {
311
+ case "AccessDeniedException":
312
+ case "com.amazonaws.arczonalshift#AccessDeniedException":
313
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
314
+ case "InternalServerException":
315
+ case "com.amazonaws.arczonalshift#InternalServerException":
316
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
317
+ case "ThrottlingException":
318
+ case "com.amazonaws.arczonalshift#ThrottlingException":
319
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
320
+ case "ValidationException":
321
+ case "com.amazonaws.arczonalshift#ValidationException":
322
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
323
+ default:
324
+ const parsedBody = parsedOutput.body;
325
+ throwDefaultError({
326
+ output,
327
+ parsedBody,
328
+ exceptionCtor: __BaseException,
329
+ errorCode,
330
+ });
331
+ }
332
+ };
333
+ export const deserializeAws_restJson1StartZonalShiftCommand = async (output, context) => {
334
+ if (output.statusCode !== 201 && output.statusCode >= 300) {
335
+ return deserializeAws_restJson1StartZonalShiftCommandError(output, context);
336
+ }
337
+ const contents = map({
338
+ $metadata: deserializeMetadata(output),
339
+ });
340
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
341
+ if (data.awayFrom != null) {
342
+ contents.awayFrom = __expectString(data.awayFrom);
343
+ }
344
+ if (data.comment != null) {
345
+ contents.comment = __expectString(data.comment);
346
+ }
347
+ if (data.expiryTime != null) {
348
+ contents.expiryTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.expiryTime)));
349
+ }
350
+ if (data.resourceIdentifier != null) {
351
+ contents.resourceIdentifier = __expectString(data.resourceIdentifier);
352
+ }
353
+ if (data.startTime != null) {
354
+ contents.startTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.startTime)));
355
+ }
356
+ if (data.status != null) {
357
+ contents.status = __expectString(data.status);
358
+ }
359
+ if (data.zonalShiftId != null) {
360
+ contents.zonalShiftId = __expectString(data.zonalShiftId);
361
+ }
362
+ return contents;
363
+ };
364
+ const deserializeAws_restJson1StartZonalShiftCommandError = async (output, context) => {
365
+ const parsedOutput = {
366
+ ...output,
367
+ body: await parseErrorBody(output.body, context),
368
+ };
369
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
370
+ switch (errorCode) {
371
+ case "AccessDeniedException":
372
+ case "com.amazonaws.arczonalshift#AccessDeniedException":
373
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
374
+ case "ConflictException":
375
+ case "com.amazonaws.arczonalshift#ConflictException":
376
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
377
+ case "InternalServerException":
378
+ case "com.amazonaws.arczonalshift#InternalServerException":
379
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
380
+ case "ResourceNotFoundException":
381
+ case "com.amazonaws.arczonalshift#ResourceNotFoundException":
382
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
383
+ case "ThrottlingException":
384
+ case "com.amazonaws.arczonalshift#ThrottlingException":
385
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
386
+ case "ValidationException":
387
+ case "com.amazonaws.arczonalshift#ValidationException":
388
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
389
+ default:
390
+ const parsedBody = parsedOutput.body;
391
+ throwDefaultError({
392
+ output,
393
+ parsedBody,
394
+ exceptionCtor: __BaseException,
395
+ errorCode,
396
+ });
397
+ }
398
+ };
399
+ export const deserializeAws_restJson1UpdateZonalShiftCommand = async (output, context) => {
400
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
401
+ return deserializeAws_restJson1UpdateZonalShiftCommandError(output, context);
402
+ }
403
+ const contents = map({
404
+ $metadata: deserializeMetadata(output),
405
+ });
406
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
407
+ if (data.awayFrom != null) {
408
+ contents.awayFrom = __expectString(data.awayFrom);
409
+ }
410
+ if (data.comment != null) {
411
+ contents.comment = __expectString(data.comment);
412
+ }
413
+ if (data.expiryTime != null) {
414
+ contents.expiryTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.expiryTime)));
415
+ }
416
+ if (data.resourceIdentifier != null) {
417
+ contents.resourceIdentifier = __expectString(data.resourceIdentifier);
418
+ }
419
+ if (data.startTime != null) {
420
+ contents.startTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.startTime)));
421
+ }
422
+ if (data.status != null) {
423
+ contents.status = __expectString(data.status);
424
+ }
425
+ if (data.zonalShiftId != null) {
426
+ contents.zonalShiftId = __expectString(data.zonalShiftId);
427
+ }
428
+ return contents;
429
+ };
430
+ const deserializeAws_restJson1UpdateZonalShiftCommandError = async (output, context) => {
431
+ const parsedOutput = {
432
+ ...output,
433
+ body: await parseErrorBody(output.body, context),
434
+ };
435
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
436
+ switch (errorCode) {
437
+ case "AccessDeniedException":
438
+ case "com.amazonaws.arczonalshift#AccessDeniedException":
439
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
440
+ case "ConflictException":
441
+ case "com.amazonaws.arczonalshift#ConflictException":
442
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
443
+ case "InternalServerException":
444
+ case "com.amazonaws.arczonalshift#InternalServerException":
445
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
446
+ case "ResourceNotFoundException":
447
+ case "com.amazonaws.arczonalshift#ResourceNotFoundException":
448
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
449
+ case "ThrottlingException":
450
+ case "com.amazonaws.arczonalshift#ThrottlingException":
451
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
452
+ case "ValidationException":
453
+ case "com.amazonaws.arczonalshift#ValidationException":
454
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
455
+ default:
456
+ const parsedBody = parsedOutput.body;
457
+ throwDefaultError({
458
+ output,
459
+ parsedBody,
460
+ exceptionCtor: __BaseException,
461
+ errorCode,
462
+ });
463
+ }
464
+ };
465
+ const map = __map;
466
+ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
467
+ const contents = map({});
468
+ const data = parsedOutput.body;
469
+ if (data.message != null) {
470
+ contents.message = __expectString(data.message);
471
+ }
472
+ const exception = new AccessDeniedException({
473
+ $metadata: deserializeMetadata(parsedOutput),
474
+ ...contents,
475
+ });
476
+ return __decorateServiceException(exception, parsedOutput.body);
477
+ };
478
+ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
479
+ const contents = map({});
480
+ const data = parsedOutput.body;
481
+ if (data.message != null) {
482
+ contents.message = __expectString(data.message);
483
+ }
484
+ if (data.reason != null) {
485
+ contents.reason = __expectString(data.reason);
486
+ }
487
+ if (data.zonalShiftId != null) {
488
+ contents.zonalShiftId = __expectString(data.zonalShiftId);
489
+ }
490
+ const exception = new ConflictException({
491
+ $metadata: deserializeMetadata(parsedOutput),
492
+ ...contents,
493
+ });
494
+ return __decorateServiceException(exception, parsedOutput.body);
495
+ };
496
+ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
497
+ const contents = map({});
498
+ const data = parsedOutput.body;
499
+ if (data.message != null) {
500
+ contents.message = __expectString(data.message);
501
+ }
502
+ const exception = new InternalServerException({
503
+ $metadata: deserializeMetadata(parsedOutput),
504
+ ...contents,
505
+ });
506
+ return __decorateServiceException(exception, parsedOutput.body);
507
+ };
508
+ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
509
+ const contents = map({});
510
+ const data = parsedOutput.body;
511
+ if (data.message != null) {
512
+ contents.message = __expectString(data.message);
513
+ }
514
+ const exception = new ResourceNotFoundException({
515
+ $metadata: deserializeMetadata(parsedOutput),
516
+ ...contents,
517
+ });
518
+ return __decorateServiceException(exception, parsedOutput.body);
519
+ };
520
+ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
521
+ const contents = map({});
522
+ const data = parsedOutput.body;
523
+ if (data.message != null) {
524
+ contents.message = __expectString(data.message);
525
+ }
526
+ const exception = new ThrottlingException({
527
+ $metadata: deserializeMetadata(parsedOutput),
528
+ ...contents,
529
+ });
530
+ return __decorateServiceException(exception, parsedOutput.body);
531
+ };
532
+ const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
533
+ const contents = map({});
534
+ const data = parsedOutput.body;
535
+ if (data.message != null) {
536
+ contents.message = __expectString(data.message);
537
+ }
538
+ if (data.reason != null) {
539
+ contents.reason = __expectString(data.reason);
540
+ }
541
+ const exception = new ValidationException({
542
+ $metadata: deserializeMetadata(parsedOutput),
543
+ ...contents,
544
+ });
545
+ return __decorateServiceException(exception, parsedOutput.body);
546
+ };
547
+ const deserializeAws_restJson1AppliedWeights = (output, context) => {
548
+ return Object.entries(output).reduce((acc, [key, value]) => {
549
+ if (value === null) {
550
+ return acc;
551
+ }
552
+ acc[key] = __limitedParseFloat32(value);
553
+ return acc;
554
+ }, {});
555
+ };
556
+ const deserializeAws_restJson1AvailabilityZones = (output, context) => {
557
+ const retVal = (output || [])
558
+ .filter((e) => e != null)
559
+ .map((entry) => {
560
+ if (entry === null) {
561
+ return null;
562
+ }
563
+ return __expectString(entry);
564
+ });
565
+ return retVal;
566
+ };
567
+ const deserializeAws_restJson1ManagedResourceSummaries = (output, context) => {
568
+ const retVal = (output || [])
569
+ .filter((e) => e != null)
570
+ .map((entry) => {
571
+ if (entry === null) {
572
+ return null;
573
+ }
574
+ return deserializeAws_restJson1ManagedResourceSummary(entry, context);
575
+ });
576
+ return retVal;
577
+ };
578
+ const deserializeAws_restJson1ManagedResourceSummary = (output, context) => {
579
+ return {
580
+ arn: __expectString(output.arn),
581
+ availabilityZones: output.availabilityZones != null
582
+ ? deserializeAws_restJson1AvailabilityZones(output.availabilityZones, context)
583
+ : undefined,
584
+ name: __expectString(output.name),
585
+ };
586
+ };
587
+ const deserializeAws_restJson1ZonalShiftInResource = (output, context) => {
588
+ return {
589
+ appliedStatus: __expectString(output.appliedStatus),
590
+ awayFrom: __expectString(output.awayFrom),
591
+ comment: __expectString(output.comment),
592
+ expiryTime: output.expiryTime != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.expiryTime))) : undefined,
593
+ resourceIdentifier: __expectString(output.resourceIdentifier),
594
+ startTime: output.startTime != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.startTime))) : undefined,
595
+ zonalShiftId: __expectString(output.zonalShiftId),
596
+ };
597
+ };
598
+ const deserializeAws_restJson1ZonalShiftsInResource = (output, context) => {
599
+ const retVal = (output || [])
600
+ .filter((e) => e != null)
601
+ .map((entry) => {
602
+ if (entry === null) {
603
+ return null;
604
+ }
605
+ return deserializeAws_restJson1ZonalShiftInResource(entry, context);
606
+ });
607
+ return retVal;
608
+ };
609
+ const deserializeAws_restJson1ZonalShiftSummaries = (output, context) => {
610
+ const retVal = (output || [])
611
+ .filter((e) => e != null)
612
+ .map((entry) => {
613
+ if (entry === null) {
614
+ return null;
615
+ }
616
+ return deserializeAws_restJson1ZonalShiftSummary(entry, context);
617
+ });
618
+ return retVal;
619
+ };
620
+ const deserializeAws_restJson1ZonalShiftSummary = (output, context) => {
621
+ return {
622
+ awayFrom: __expectString(output.awayFrom),
623
+ comment: __expectString(output.comment),
624
+ expiryTime: output.expiryTime != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.expiryTime))) : undefined,
625
+ resourceIdentifier: __expectString(output.resourceIdentifier),
626
+ startTime: output.startTime != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.startTime))) : undefined,
627
+ status: __expectString(output.status),
628
+ zonalShiftId: __expectString(output.zonalShiftId),
629
+ };
630
+ };
631
+ const deserializeMetadata = (output) => ({
632
+ httpStatusCode: output.statusCode,
633
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
634
+ extendedRequestId: output.headers["x-amz-id-2"],
635
+ cfId: output.headers["x-amz-cf-id"],
636
+ });
637
+ const collectBody = (streamBody = new Uint8Array(), context) => {
638
+ if (streamBody instanceof Uint8Array) {
639
+ return Promise.resolve(streamBody);
640
+ }
641
+ return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
642
+ };
643
+ const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
644
+ const isSerializableHeaderValue = (value) => value !== undefined &&
645
+ value !== null &&
646
+ value !== "" &&
647
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
648
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
649
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
650
+ if (encoded.length) {
651
+ return JSON.parse(encoded);
652
+ }
653
+ return {};
654
+ });
655
+ const parseErrorBody = async (errorBody, context) => {
656
+ const value = await parseBody(errorBody, context);
657
+ value.message = value.message ?? value.Message;
658
+ return value;
659
+ };
660
+ const loadRestJsonErrorCode = (output, data) => {
661
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
662
+ const sanitizeErrorCode = (rawValue) => {
663
+ let cleanValue = rawValue;
664
+ if (typeof cleanValue === "number") {
665
+ cleanValue = cleanValue.toString();
666
+ }
667
+ if (cleanValue.indexOf(",") >= 0) {
668
+ cleanValue = cleanValue.split(",")[0];
669
+ }
670
+ if (cleanValue.indexOf(":") >= 0) {
671
+ cleanValue = cleanValue.split(":")[0];
672
+ }
673
+ if (cleanValue.indexOf("#") >= 0) {
674
+ cleanValue = cleanValue.split("#")[1];
675
+ }
676
+ return cleanValue;
677
+ };
678
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
679
+ if (headerKey !== undefined) {
680
+ return sanitizeErrorCode(output.headers[headerKey]);
681
+ }
682
+ if (data.code !== undefined) {
683
+ return sanitizeErrorCode(data.code);
684
+ }
685
+ if (data["__type"] !== undefined) {
686
+ return sanitizeErrorCode(data["__type"]);
687
+ }
688
+ };