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