@aws-sdk/client-emr-serverless 3.100.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 (128) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/LICENSE +201 -0
  3. package/README.md +226 -0
  4. package/dist-cjs/EMRServerless.js +217 -0
  5. package/dist-cjs/EMRServerlessClient.js +35 -0
  6. package/dist-cjs/commands/CancelJobRunCommand.js +36 -0
  7. package/dist-cjs/commands/CreateApplicationCommand.js +36 -0
  8. package/dist-cjs/commands/DeleteApplicationCommand.js +36 -0
  9. package/dist-cjs/commands/GetApplicationCommand.js +36 -0
  10. package/dist-cjs/commands/GetJobRunCommand.js +36 -0
  11. package/dist-cjs/commands/ListApplicationsCommand.js +36 -0
  12. package/dist-cjs/commands/ListJobRunsCommand.js +36 -0
  13. package/dist-cjs/commands/ListTagsForResourceCommand.js +36 -0
  14. package/dist-cjs/commands/StartApplicationCommand.js +36 -0
  15. package/dist-cjs/commands/StartJobRunCommand.js +36 -0
  16. package/dist-cjs/commands/StopApplicationCommand.js +36 -0
  17. package/dist-cjs/commands/TagResourceCommand.js +36 -0
  18. package/dist-cjs/commands/UntagResourceCommand.js +36 -0
  19. package/dist-cjs/commands/UpdateApplicationCommand.js +36 -0
  20. package/dist-cjs/commands/index.js +17 -0
  21. package/dist-cjs/endpoints.js +150 -0
  22. package/dist-cjs/index.js +11 -0
  23. package/dist-cjs/models/EMRServerlessServiceException.js +11 -0
  24. package/dist-cjs/models/index.js +4 -0
  25. package/dist-cjs/models/models_0.js +408 -0
  26. package/dist-cjs/pagination/Interfaces.js +2 -0
  27. package/dist-cjs/pagination/ListApplicationsPaginator.js +36 -0
  28. package/dist-cjs/pagination/ListJobRunsPaginator.js +36 -0
  29. package/dist-cjs/pagination/index.js +6 -0
  30. package/dist-cjs/protocols/Aws_restJson1.js +1724 -0
  31. package/dist-cjs/runtimeConfig.browser.js +45 -0
  32. package/dist-cjs/runtimeConfig.js +52 -0
  33. package/dist-cjs/runtimeConfig.native.js +16 -0
  34. package/dist-cjs/runtimeConfig.shared.js +17 -0
  35. package/dist-es/EMRServerless.js +220 -0
  36. package/dist-es/EMRServerlessClient.js +37 -0
  37. package/dist-es/commands/CancelJobRunCommand.js +39 -0
  38. package/dist-es/commands/CreateApplicationCommand.js +39 -0
  39. package/dist-es/commands/DeleteApplicationCommand.js +39 -0
  40. package/dist-es/commands/GetApplicationCommand.js +39 -0
  41. package/dist-es/commands/GetJobRunCommand.js +39 -0
  42. package/dist-es/commands/ListApplicationsCommand.js +39 -0
  43. package/dist-es/commands/ListJobRunsCommand.js +39 -0
  44. package/dist-es/commands/ListTagsForResourceCommand.js +39 -0
  45. package/dist-es/commands/StartApplicationCommand.js +39 -0
  46. package/dist-es/commands/StartJobRunCommand.js +39 -0
  47. package/dist-es/commands/StopApplicationCommand.js +39 -0
  48. package/dist-es/commands/TagResourceCommand.js +39 -0
  49. package/dist-es/commands/UntagResourceCommand.js +39 -0
  50. package/dist-es/commands/UpdateApplicationCommand.js +39 -0
  51. package/dist-es/commands/index.js +14 -0
  52. package/dist-es/endpoints.js +146 -0
  53. package/dist-es/index.js +6 -0
  54. package/dist-es/models/EMRServerlessServiceException.js +12 -0
  55. package/dist-es/models/index.js +1 -0
  56. package/dist-es/models/models_0.js +295 -0
  57. package/dist-es/pagination/Interfaces.js +1 -0
  58. package/dist-es/pagination/ListApplicationsPaginator.js +75 -0
  59. package/dist-es/pagination/ListJobRunsPaginator.js +75 -0
  60. package/dist-es/pagination/index.js +3 -0
  61. package/dist-es/protocols/Aws_restJson1.js +1994 -0
  62. package/dist-es/runtimeConfig.browser.js +26 -0
  63. package/dist-es/runtimeConfig.js +30 -0
  64. package/dist-es/runtimeConfig.native.js +8 -0
  65. package/dist-es/runtimeConfig.shared.js +13 -0
  66. package/dist-types/EMRServerless.d.ts +133 -0
  67. package/dist-types/EMRServerlessClient.d.ts +179 -0
  68. package/dist-types/commands/CancelJobRunCommand.d.ts +35 -0
  69. package/dist-types/commands/CreateApplicationCommand.d.ts +35 -0
  70. package/dist-types/commands/DeleteApplicationCommand.d.ts +36 -0
  71. package/dist-types/commands/GetApplicationCommand.d.ts +35 -0
  72. package/dist-types/commands/GetJobRunCommand.d.ts +35 -0
  73. package/dist-types/commands/ListApplicationsCommand.d.ts +35 -0
  74. package/dist-types/commands/ListJobRunsCommand.d.ts +35 -0
  75. package/dist-types/commands/ListTagsForResourceCommand.d.ts +35 -0
  76. package/dist-types/commands/StartApplicationCommand.d.ts +35 -0
  77. package/dist-types/commands/StartJobRunCommand.d.ts +35 -0
  78. package/dist-types/commands/StopApplicationCommand.d.ts +36 -0
  79. package/dist-types/commands/TagResourceCommand.d.ts +39 -0
  80. package/dist-types/commands/UntagResourceCommand.d.ts +35 -0
  81. package/dist-types/commands/UpdateApplicationCommand.d.ts +36 -0
  82. package/dist-types/commands/index.d.ts +14 -0
  83. package/dist-types/endpoints.d.ts +2 -0
  84. package/dist-types/index.d.ts +6 -0
  85. package/dist-types/models/EMRServerlessServiceException.d.ts +10 -0
  86. package/dist-types/models/index.d.ts +1 -0
  87. package/dist-types/models/models_0.d.ts +1172 -0
  88. package/dist-types/pagination/Interfaces.d.ts +6 -0
  89. package/dist-types/pagination/ListApplicationsPaginator.d.ts +4 -0
  90. package/dist-types/pagination/ListJobRunsPaginator.d.ts +4 -0
  91. package/dist-types/pagination/index.d.ts +3 -0
  92. package/dist-types/protocols/Aws_restJson1.d.ts +44 -0
  93. package/dist-types/runtimeConfig.browser.d.ts +40 -0
  94. package/dist-types/runtimeConfig.d.ts +40 -0
  95. package/dist-types/runtimeConfig.native.d.ts +39 -0
  96. package/dist-types/runtimeConfig.shared.d.ts +13 -0
  97. package/dist-types/ts3.4/EMRServerless.d.ts +75 -0
  98. package/dist-types/ts3.4/EMRServerlessClient.d.ts +87 -0
  99. package/dist-types/ts3.4/commands/CancelJobRunCommand.d.ts +17 -0
  100. package/dist-types/ts3.4/commands/CreateApplicationCommand.d.ts +17 -0
  101. package/dist-types/ts3.4/commands/DeleteApplicationCommand.d.ts +17 -0
  102. package/dist-types/ts3.4/commands/GetApplicationCommand.d.ts +17 -0
  103. package/dist-types/ts3.4/commands/GetJobRunCommand.d.ts +17 -0
  104. package/dist-types/ts3.4/commands/ListApplicationsCommand.d.ts +17 -0
  105. package/dist-types/ts3.4/commands/ListJobRunsCommand.d.ts +17 -0
  106. package/dist-types/ts3.4/commands/ListTagsForResourceCommand.d.ts +17 -0
  107. package/dist-types/ts3.4/commands/StartApplicationCommand.d.ts +17 -0
  108. package/dist-types/ts3.4/commands/StartJobRunCommand.d.ts +17 -0
  109. package/dist-types/ts3.4/commands/StopApplicationCommand.d.ts +17 -0
  110. package/dist-types/ts3.4/commands/TagResourceCommand.d.ts +17 -0
  111. package/dist-types/ts3.4/commands/UntagResourceCommand.d.ts +17 -0
  112. package/dist-types/ts3.4/commands/UpdateApplicationCommand.d.ts +17 -0
  113. package/dist-types/ts3.4/commands/index.d.ts +14 -0
  114. package/dist-types/ts3.4/endpoints.d.ts +2 -0
  115. package/dist-types/ts3.4/index.d.ts +6 -0
  116. package/dist-types/ts3.4/models/EMRServerlessServiceException.d.ts +6 -0
  117. package/dist-types/ts3.4/models/index.d.ts +1 -0
  118. package/dist-types/ts3.4/models/models_0.d.ts +700 -0
  119. package/dist-types/ts3.4/pagination/Interfaces.d.ts +6 -0
  120. package/dist-types/ts3.4/pagination/ListApplicationsPaginator.d.ts +4 -0
  121. package/dist-types/ts3.4/pagination/ListJobRunsPaginator.d.ts +4 -0
  122. package/dist-types/ts3.4/pagination/index.d.ts +3 -0
  123. package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +44 -0
  124. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +38 -0
  125. package/dist-types/ts3.4/runtimeConfig.d.ts +38 -0
  126. package/dist-types/ts3.4/runtimeConfig.native.d.ts +37 -0
  127. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +11 -0
  128. package/package.json +95 -0
@@ -0,0 +1,1994 @@
1
+ import { __assign, __awaiter, __generator, __read } from "tslib";
2
+ import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
3
+ import { decorateServiceException as __decorateServiceException, expectBoolean as __expectBoolean, expectInt32 as __expectInt32, expectLong as __expectLong, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, expectUnion as __expectUnion, extendedEncodeURIComponent as __extendedEncodeURIComponent, limitedParseDouble as __limitedParseDouble, parseEpochTimestamp as __parseEpochTimestamp, } from "@aws-sdk/smithy-client";
4
+ import { v4 as generateIdempotencyToken } from "uuid";
5
+ import { EMRServerlessServiceException as __BaseException } from "../models/EMRServerlessServiceException";
6
+ import { ConflictException, InternalServerException, JobDriver, ResourceNotFoundException, ServiceQuotaExceededException, ValidationException, } from "../models/models_0";
7
+ export var serializeAws_restJson1CancelJobRunCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
8
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, labelValue, body;
9
+ return __generator(this, function (_c) {
10
+ switch (_c.label) {
11
+ case 0: return [4, context.endpoint()];
12
+ case 1:
13
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
14
+ headers = {};
15
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
16
+ "/applications/{applicationId}/jobruns/{jobRunId}";
17
+ if (input.applicationId !== undefined) {
18
+ labelValue = input.applicationId;
19
+ if (labelValue.length <= 0) {
20
+ throw new Error("Empty value provided for input HTTP label: applicationId.");
21
+ }
22
+ resolvedPath = resolvedPath.replace("{applicationId}", __extendedEncodeURIComponent(labelValue));
23
+ }
24
+ else {
25
+ throw new Error("No value provided for input HTTP label: applicationId.");
26
+ }
27
+ if (input.jobRunId !== undefined) {
28
+ labelValue = input.jobRunId;
29
+ if (labelValue.length <= 0) {
30
+ throw new Error("Empty value provided for input HTTP label: jobRunId.");
31
+ }
32
+ resolvedPath = resolvedPath.replace("{jobRunId}", __extendedEncodeURIComponent(labelValue));
33
+ }
34
+ else {
35
+ throw new Error("No value provided for input HTTP label: jobRunId.");
36
+ }
37
+ return [2, new __HttpRequest({
38
+ protocol: protocol,
39
+ hostname: hostname,
40
+ port: port,
41
+ method: "DELETE",
42
+ headers: headers,
43
+ path: resolvedPath,
44
+ body: body,
45
+ })];
46
+ }
47
+ });
48
+ }); };
49
+ export var serializeAws_restJson1CreateApplicationCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
50
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
51
+ var _c;
52
+ return __generator(this, function (_d) {
53
+ switch (_d.label) {
54
+ case 0: return [4, context.endpoint()];
55
+ case 1:
56
+ _a = _d.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
57
+ headers = {
58
+ "content-type": "application/json",
59
+ };
60
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/applications";
61
+ body = JSON.stringify(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, (input.autoStartConfiguration !== undefined &&
62
+ input.autoStartConfiguration !== null && {
63
+ autoStartConfiguration: serializeAws_restJson1AutoStartConfig(input.autoStartConfiguration, context),
64
+ })), (input.autoStopConfiguration !== undefined &&
65
+ input.autoStopConfiguration !== null && {
66
+ autoStopConfiguration: serializeAws_restJson1AutoStopConfig(input.autoStopConfiguration, context),
67
+ })), { clientToken: (_c = input.clientToken) !== null && _c !== void 0 ? _c : generateIdempotencyToken() }), (input.initialCapacity !== undefined &&
68
+ input.initialCapacity !== null && {
69
+ initialCapacity: serializeAws_restJson1InitialCapacityConfigMap(input.initialCapacity, context),
70
+ })), (input.maximumCapacity !== undefined &&
71
+ input.maximumCapacity !== null && {
72
+ maximumCapacity: serializeAws_restJson1MaximumAllowedResources(input.maximumCapacity, context),
73
+ })), (input.name !== undefined && input.name !== null && { name: input.name })), (input.networkConfiguration !== undefined &&
74
+ input.networkConfiguration !== null && {
75
+ networkConfiguration: serializeAws_restJson1NetworkConfiguration(input.networkConfiguration, context),
76
+ })), (input.releaseLabel !== undefined && input.releaseLabel !== null && { releaseLabel: input.releaseLabel })), (input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) })), (input.type !== undefined && input.type !== null && { type: input.type })));
77
+ return [2, new __HttpRequest({
78
+ protocol: protocol,
79
+ hostname: hostname,
80
+ port: port,
81
+ method: "POST",
82
+ headers: headers,
83
+ path: resolvedPath,
84
+ body: body,
85
+ })];
86
+ }
87
+ });
88
+ }); };
89
+ export var serializeAws_restJson1DeleteApplicationCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
90
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
91
+ return __generator(this, function (_c) {
92
+ switch (_c.label) {
93
+ case 0: return [4, context.endpoint()];
94
+ case 1:
95
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
96
+ headers = {};
97
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/applications/{applicationId}";
98
+ if (input.applicationId !== undefined) {
99
+ labelValue = input.applicationId;
100
+ if (labelValue.length <= 0) {
101
+ throw new Error("Empty value provided for input HTTP label: applicationId.");
102
+ }
103
+ resolvedPath = resolvedPath.replace("{applicationId}", __extendedEncodeURIComponent(labelValue));
104
+ }
105
+ else {
106
+ throw new Error("No value provided for input HTTP label: applicationId.");
107
+ }
108
+ return [2, new __HttpRequest({
109
+ protocol: protocol,
110
+ hostname: hostname,
111
+ port: port,
112
+ method: "DELETE",
113
+ headers: headers,
114
+ path: resolvedPath,
115
+ body: body,
116
+ })];
117
+ }
118
+ });
119
+ }); };
120
+ export var serializeAws_restJson1GetApplicationCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
121
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
122
+ return __generator(this, function (_c) {
123
+ switch (_c.label) {
124
+ case 0: return [4, context.endpoint()];
125
+ case 1:
126
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
127
+ headers = {};
128
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/applications/{applicationId}";
129
+ if (input.applicationId !== undefined) {
130
+ labelValue = input.applicationId;
131
+ if (labelValue.length <= 0) {
132
+ throw new Error("Empty value provided for input HTTP label: applicationId.");
133
+ }
134
+ resolvedPath = resolvedPath.replace("{applicationId}", __extendedEncodeURIComponent(labelValue));
135
+ }
136
+ else {
137
+ throw new Error("No value provided for input HTTP label: applicationId.");
138
+ }
139
+ return [2, new __HttpRequest({
140
+ protocol: protocol,
141
+ hostname: hostname,
142
+ port: port,
143
+ method: "GET",
144
+ headers: headers,
145
+ path: resolvedPath,
146
+ body: body,
147
+ })];
148
+ }
149
+ });
150
+ }); };
151
+ export var serializeAws_restJson1GetJobRunCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
152
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, labelValue, body;
153
+ return __generator(this, function (_c) {
154
+ switch (_c.label) {
155
+ case 0: return [4, context.endpoint()];
156
+ case 1:
157
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
158
+ headers = {};
159
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
160
+ "/applications/{applicationId}/jobruns/{jobRunId}";
161
+ if (input.applicationId !== undefined) {
162
+ labelValue = input.applicationId;
163
+ if (labelValue.length <= 0) {
164
+ throw new Error("Empty value provided for input HTTP label: applicationId.");
165
+ }
166
+ resolvedPath = resolvedPath.replace("{applicationId}", __extendedEncodeURIComponent(labelValue));
167
+ }
168
+ else {
169
+ throw new Error("No value provided for input HTTP label: applicationId.");
170
+ }
171
+ if (input.jobRunId !== undefined) {
172
+ labelValue = input.jobRunId;
173
+ if (labelValue.length <= 0) {
174
+ throw new Error("Empty value provided for input HTTP label: jobRunId.");
175
+ }
176
+ resolvedPath = resolvedPath.replace("{jobRunId}", __extendedEncodeURIComponent(labelValue));
177
+ }
178
+ else {
179
+ throw new Error("No value provided for input HTTP label: jobRunId.");
180
+ }
181
+ return [2, new __HttpRequest({
182
+ protocol: protocol,
183
+ hostname: hostname,
184
+ port: port,
185
+ method: "GET",
186
+ headers: headers,
187
+ path: resolvedPath,
188
+ body: body,
189
+ })];
190
+ }
191
+ });
192
+ }); };
193
+ export var serializeAws_restJson1ListApplicationsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
194
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
195
+ return __generator(this, function (_c) {
196
+ switch (_c.label) {
197
+ case 0: return [4, context.endpoint()];
198
+ case 1:
199
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
200
+ headers = {};
201
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/applications";
202
+ query = __assign(__assign(__assign({}, (input.nextToken !== undefined && { nextToken: input.nextToken })), (input.maxResults !== undefined && { maxResults: input.maxResults.toString() })), (input.states !== undefined && {
203
+ states: (Array.from(input.states.values()) || []).map(function (_entry) { return _entry; }),
204
+ }));
205
+ return [2, new __HttpRequest({
206
+ protocol: protocol,
207
+ hostname: hostname,
208
+ port: port,
209
+ method: "GET",
210
+ headers: headers,
211
+ path: resolvedPath,
212
+ query: query,
213
+ body: body,
214
+ })];
215
+ }
216
+ });
217
+ }); };
218
+ export var serializeAws_restJson1ListJobRunsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
219
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, query, body;
220
+ return __generator(this, function (_c) {
221
+ switch (_c.label) {
222
+ case 0: return [4, context.endpoint()];
223
+ case 1:
224
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
225
+ headers = {};
226
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/applications/{applicationId}/jobruns";
227
+ if (input.applicationId !== undefined) {
228
+ labelValue = input.applicationId;
229
+ if (labelValue.length <= 0) {
230
+ throw new Error("Empty value provided for input HTTP label: applicationId.");
231
+ }
232
+ resolvedPath = resolvedPath.replace("{applicationId}", __extendedEncodeURIComponent(labelValue));
233
+ }
234
+ else {
235
+ throw new Error("No value provided for input HTTP label: applicationId.");
236
+ }
237
+ query = __assign(__assign(__assign(__assign(__assign({}, (input.nextToken !== undefined && { nextToken: input.nextToken })), (input.maxResults !== undefined && { maxResults: input.maxResults.toString() })), (input.createdAtAfter !== undefined && {
238
+ createdAtAfter: (input.createdAtAfter.toISOString().split(".")[0] + "Z").toString(),
239
+ })), (input.createdAtBefore !== undefined && {
240
+ createdAtBefore: (input.createdAtBefore.toISOString().split(".")[0] + "Z").toString(),
241
+ })), (input.states !== undefined && {
242
+ states: (Array.from(input.states.values()) || []).map(function (_entry) { return _entry; }),
243
+ }));
244
+ return [2, new __HttpRequest({
245
+ protocol: protocol,
246
+ hostname: hostname,
247
+ port: port,
248
+ method: "GET",
249
+ headers: headers,
250
+ path: resolvedPath,
251
+ query: query,
252
+ body: body,
253
+ })];
254
+ }
255
+ });
256
+ }); };
257
+ export var serializeAws_restJson1ListTagsForResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
258
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
259
+ return __generator(this, function (_c) {
260
+ switch (_c.label) {
261
+ case 0: return [4, context.endpoint()];
262
+ case 1:
263
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
264
+ headers = {};
265
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/tags/{resourceArn}";
266
+ if (input.resourceArn !== undefined) {
267
+ labelValue = input.resourceArn;
268
+ if (labelValue.length <= 0) {
269
+ throw new Error("Empty value provided for input HTTP label: resourceArn.");
270
+ }
271
+ resolvedPath = resolvedPath.replace("{resourceArn}", __extendedEncodeURIComponent(labelValue));
272
+ }
273
+ else {
274
+ throw new Error("No value provided for input HTTP label: resourceArn.");
275
+ }
276
+ return [2, new __HttpRequest({
277
+ protocol: protocol,
278
+ hostname: hostname,
279
+ port: port,
280
+ method: "GET",
281
+ headers: headers,
282
+ path: resolvedPath,
283
+ body: body,
284
+ })];
285
+ }
286
+ });
287
+ }); };
288
+ export var serializeAws_restJson1StartApplicationCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
289
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
290
+ return __generator(this, function (_c) {
291
+ switch (_c.label) {
292
+ case 0: return [4, context.endpoint()];
293
+ case 1:
294
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
295
+ headers = {};
296
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/applications/{applicationId}/start";
297
+ if (input.applicationId !== undefined) {
298
+ labelValue = input.applicationId;
299
+ if (labelValue.length <= 0) {
300
+ throw new Error("Empty value provided for input HTTP label: applicationId.");
301
+ }
302
+ resolvedPath = resolvedPath.replace("{applicationId}", __extendedEncodeURIComponent(labelValue));
303
+ }
304
+ else {
305
+ throw new Error("No value provided for input HTTP label: applicationId.");
306
+ }
307
+ return [2, new __HttpRequest({
308
+ protocol: protocol,
309
+ hostname: hostname,
310
+ port: port,
311
+ method: "POST",
312
+ headers: headers,
313
+ path: resolvedPath,
314
+ body: body,
315
+ })];
316
+ }
317
+ });
318
+ }); };
319
+ export var serializeAws_restJson1StartJobRunCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
320
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
321
+ var _c;
322
+ return __generator(this, function (_d) {
323
+ switch (_d.label) {
324
+ case 0: return [4, context.endpoint()];
325
+ case 1:
326
+ _a = _d.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
327
+ headers = {
328
+ "content-type": "application/json",
329
+ };
330
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/applications/{applicationId}/jobruns";
331
+ if (input.applicationId !== undefined) {
332
+ labelValue = input.applicationId;
333
+ if (labelValue.length <= 0) {
334
+ throw new Error("Empty value provided for input HTTP label: applicationId.");
335
+ }
336
+ resolvedPath = resolvedPath.replace("{applicationId}", __extendedEncodeURIComponent(labelValue));
337
+ }
338
+ else {
339
+ throw new Error("No value provided for input HTTP label: applicationId.");
340
+ }
341
+ body = JSON.stringify(__assign(__assign(__assign(__assign(__assign(__assign({ clientToken: (_c = input.clientToken) !== null && _c !== void 0 ? _c : generateIdempotencyToken() }, (input.configurationOverrides !== undefined &&
342
+ input.configurationOverrides !== null && {
343
+ configurationOverrides: serializeAws_restJson1ConfigurationOverrides(input.configurationOverrides, context),
344
+ })), (input.executionRoleArn !== undefined &&
345
+ input.executionRoleArn !== null && { executionRoleArn: input.executionRoleArn })), (input.executionTimeoutMinutes !== undefined &&
346
+ input.executionTimeoutMinutes !== null && { executionTimeoutMinutes: input.executionTimeoutMinutes })), (input.jobDriver !== undefined &&
347
+ input.jobDriver !== null && { jobDriver: serializeAws_restJson1JobDriver(input.jobDriver, context) })), (input.name !== undefined && input.name !== null && { name: input.name })), (input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) })));
348
+ return [2, new __HttpRequest({
349
+ protocol: protocol,
350
+ hostname: hostname,
351
+ port: port,
352
+ method: "POST",
353
+ headers: headers,
354
+ path: resolvedPath,
355
+ body: body,
356
+ })];
357
+ }
358
+ });
359
+ }); };
360
+ export var serializeAws_restJson1StopApplicationCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
361
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
362
+ return __generator(this, function (_c) {
363
+ switch (_c.label) {
364
+ case 0: return [4, context.endpoint()];
365
+ case 1:
366
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
367
+ headers = {};
368
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/applications/{applicationId}/stop";
369
+ if (input.applicationId !== undefined) {
370
+ labelValue = input.applicationId;
371
+ if (labelValue.length <= 0) {
372
+ throw new Error("Empty value provided for input HTTP label: applicationId.");
373
+ }
374
+ resolvedPath = resolvedPath.replace("{applicationId}", __extendedEncodeURIComponent(labelValue));
375
+ }
376
+ else {
377
+ throw new Error("No value provided for input HTTP label: applicationId.");
378
+ }
379
+ return [2, new __HttpRequest({
380
+ protocol: protocol,
381
+ hostname: hostname,
382
+ port: port,
383
+ method: "POST",
384
+ headers: headers,
385
+ path: resolvedPath,
386
+ body: body,
387
+ })];
388
+ }
389
+ });
390
+ }); };
391
+ export var serializeAws_restJson1TagResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
392
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
393
+ return __generator(this, function (_c) {
394
+ switch (_c.label) {
395
+ case 0: return [4, context.endpoint()];
396
+ case 1:
397
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
398
+ headers = {
399
+ "content-type": "application/json",
400
+ };
401
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/tags/{resourceArn}";
402
+ if (input.resourceArn !== undefined) {
403
+ labelValue = input.resourceArn;
404
+ if (labelValue.length <= 0) {
405
+ throw new Error("Empty value provided for input HTTP label: resourceArn.");
406
+ }
407
+ resolvedPath = resolvedPath.replace("{resourceArn}", __extendedEncodeURIComponent(labelValue));
408
+ }
409
+ else {
410
+ throw new Error("No value provided for input HTTP label: resourceArn.");
411
+ }
412
+ body = JSON.stringify(__assign({}, (input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) })));
413
+ return [2, new __HttpRequest({
414
+ protocol: protocol,
415
+ hostname: hostname,
416
+ port: port,
417
+ method: "POST",
418
+ headers: headers,
419
+ path: resolvedPath,
420
+ body: body,
421
+ })];
422
+ }
423
+ });
424
+ }); };
425
+ export var serializeAws_restJson1UntagResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
426
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, query, body;
427
+ return __generator(this, function (_c) {
428
+ switch (_c.label) {
429
+ case 0: return [4, context.endpoint()];
430
+ case 1:
431
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
432
+ headers = {};
433
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/tags/{resourceArn}";
434
+ if (input.resourceArn !== undefined) {
435
+ labelValue = input.resourceArn;
436
+ if (labelValue.length <= 0) {
437
+ throw new Error("Empty value provided for input HTTP label: resourceArn.");
438
+ }
439
+ resolvedPath = resolvedPath.replace("{resourceArn}", __extendedEncodeURIComponent(labelValue));
440
+ }
441
+ else {
442
+ throw new Error("No value provided for input HTTP label: resourceArn.");
443
+ }
444
+ query = __assign({}, (input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map(function (_entry) { return _entry; }) }));
445
+ return [2, new __HttpRequest({
446
+ protocol: protocol,
447
+ hostname: hostname,
448
+ port: port,
449
+ method: "DELETE",
450
+ headers: headers,
451
+ path: resolvedPath,
452
+ query: query,
453
+ body: body,
454
+ })];
455
+ }
456
+ });
457
+ }); };
458
+ export var serializeAws_restJson1UpdateApplicationCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
459
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
460
+ var _c;
461
+ return __generator(this, function (_d) {
462
+ switch (_d.label) {
463
+ case 0: return [4, context.endpoint()];
464
+ case 1:
465
+ _a = _d.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
466
+ headers = {
467
+ "content-type": "application/json",
468
+ };
469
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/applications/{applicationId}";
470
+ if (input.applicationId !== undefined) {
471
+ labelValue = input.applicationId;
472
+ if (labelValue.length <= 0) {
473
+ throw new Error("Empty value provided for input HTTP label: applicationId.");
474
+ }
475
+ resolvedPath = resolvedPath.replace("{applicationId}", __extendedEncodeURIComponent(labelValue));
476
+ }
477
+ else {
478
+ throw new Error("No value provided for input HTTP label: applicationId.");
479
+ }
480
+ body = JSON.stringify(__assign(__assign(__assign(__assign(__assign(__assign({}, (input.autoStartConfiguration !== undefined &&
481
+ input.autoStartConfiguration !== null && {
482
+ autoStartConfiguration: serializeAws_restJson1AutoStartConfig(input.autoStartConfiguration, context),
483
+ })), (input.autoStopConfiguration !== undefined &&
484
+ input.autoStopConfiguration !== null && {
485
+ autoStopConfiguration: serializeAws_restJson1AutoStopConfig(input.autoStopConfiguration, context),
486
+ })), { clientToken: (_c = input.clientToken) !== null && _c !== void 0 ? _c : generateIdempotencyToken() }), (input.initialCapacity !== undefined &&
487
+ input.initialCapacity !== null && {
488
+ initialCapacity: serializeAws_restJson1InitialCapacityConfigMap(input.initialCapacity, context),
489
+ })), (input.maximumCapacity !== undefined &&
490
+ input.maximumCapacity !== null && {
491
+ maximumCapacity: serializeAws_restJson1MaximumAllowedResources(input.maximumCapacity, context),
492
+ })), (input.networkConfiguration !== undefined &&
493
+ input.networkConfiguration !== null && {
494
+ networkConfiguration: serializeAws_restJson1NetworkConfiguration(input.networkConfiguration, context),
495
+ })));
496
+ return [2, new __HttpRequest({
497
+ protocol: protocol,
498
+ hostname: hostname,
499
+ port: port,
500
+ method: "PATCH",
501
+ headers: headers,
502
+ path: resolvedPath,
503
+ body: body,
504
+ })];
505
+ }
506
+ });
507
+ }); };
508
+ export var deserializeAws_restJson1CancelJobRunCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
509
+ var contents, data, _a, _b;
510
+ return __generator(this, function (_c) {
511
+ switch (_c.label) {
512
+ case 0:
513
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
514
+ return [2, deserializeAws_restJson1CancelJobRunCommandError(output, context)];
515
+ }
516
+ contents = {
517
+ $metadata: deserializeMetadata(output),
518
+ applicationId: undefined,
519
+ jobRunId: undefined,
520
+ };
521
+ _a = __expectNonNull;
522
+ _b = __expectObject;
523
+ return [4, parseBody(output.body, context)];
524
+ case 1:
525
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
526
+ if (data.applicationId !== undefined && data.applicationId !== null) {
527
+ contents.applicationId = __expectString(data.applicationId);
528
+ }
529
+ if (data.jobRunId !== undefined && data.jobRunId !== null) {
530
+ contents.jobRunId = __expectString(data.jobRunId);
531
+ }
532
+ return [2, Promise.resolve(contents)];
533
+ }
534
+ });
535
+ }); };
536
+ var deserializeAws_restJson1CancelJobRunCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
537
+ var parsedOutput, _a, response, errorCode, _b, parsedBody;
538
+ var _c;
539
+ return __generator(this, function (_d) {
540
+ switch (_d.label) {
541
+ case 0:
542
+ _a = [__assign({}, output)];
543
+ _c = {};
544
+ return [4, parseBody(output.body, context)];
545
+ case 1:
546
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
547
+ errorCode = "UnknownError";
548
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
549
+ _b = errorCode;
550
+ switch (_b) {
551
+ case "InternalServerException": return [3, 2];
552
+ case "com.amazonaws.emrserverless#InternalServerException": return [3, 2];
553
+ case "ResourceNotFoundException": return [3, 4];
554
+ case "com.amazonaws.emrserverless#ResourceNotFoundException": return [3, 4];
555
+ case "ValidationException": return [3, 6];
556
+ case "com.amazonaws.emrserverless#ValidationException": return [3, 6];
557
+ }
558
+ return [3, 8];
559
+ case 2: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
560
+ case 3: throw _d.sent();
561
+ case 4: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
562
+ case 5: throw _d.sent();
563
+ case 6: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
564
+ case 7: throw _d.sent();
565
+ case 8:
566
+ parsedBody = parsedOutput.body;
567
+ response = new __BaseException({
568
+ name: parsedBody.code || parsedBody.Code || errorCode,
569
+ $fault: "client",
570
+ $metadata: deserializeMetadata(output),
571
+ });
572
+ throw __decorateServiceException(response, parsedBody);
573
+ }
574
+ });
575
+ }); };
576
+ export var deserializeAws_restJson1CreateApplicationCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
577
+ var contents, data, _a, _b;
578
+ return __generator(this, function (_c) {
579
+ switch (_c.label) {
580
+ case 0:
581
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
582
+ return [2, deserializeAws_restJson1CreateApplicationCommandError(output, context)];
583
+ }
584
+ contents = {
585
+ $metadata: deserializeMetadata(output),
586
+ applicationId: undefined,
587
+ arn: undefined,
588
+ name: undefined,
589
+ };
590
+ _a = __expectNonNull;
591
+ _b = __expectObject;
592
+ return [4, parseBody(output.body, context)];
593
+ case 1:
594
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
595
+ if (data.applicationId !== undefined && data.applicationId !== null) {
596
+ contents.applicationId = __expectString(data.applicationId);
597
+ }
598
+ if (data.arn !== undefined && data.arn !== null) {
599
+ contents.arn = __expectString(data.arn);
600
+ }
601
+ if (data.name !== undefined && data.name !== null) {
602
+ contents.name = __expectString(data.name);
603
+ }
604
+ return [2, Promise.resolve(contents)];
605
+ }
606
+ });
607
+ }); };
608
+ var deserializeAws_restJson1CreateApplicationCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
609
+ var parsedOutput, _a, response, errorCode, _b, parsedBody;
610
+ var _c;
611
+ return __generator(this, function (_d) {
612
+ switch (_d.label) {
613
+ case 0:
614
+ _a = [__assign({}, output)];
615
+ _c = {};
616
+ return [4, parseBody(output.body, context)];
617
+ case 1:
618
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
619
+ errorCode = "UnknownError";
620
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
621
+ _b = errorCode;
622
+ switch (_b) {
623
+ case "ConflictException": return [3, 2];
624
+ case "com.amazonaws.emrserverless#ConflictException": return [3, 2];
625
+ case "InternalServerException": return [3, 4];
626
+ case "com.amazonaws.emrserverless#InternalServerException": return [3, 4];
627
+ case "ValidationException": return [3, 6];
628
+ case "com.amazonaws.emrserverless#ValidationException": return [3, 6];
629
+ }
630
+ return [3, 8];
631
+ case 2: return [4, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
632
+ case 3: throw _d.sent();
633
+ case 4: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
634
+ case 5: throw _d.sent();
635
+ case 6: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
636
+ case 7: throw _d.sent();
637
+ case 8:
638
+ parsedBody = parsedOutput.body;
639
+ response = new __BaseException({
640
+ name: parsedBody.code || parsedBody.Code || errorCode,
641
+ $fault: "client",
642
+ $metadata: deserializeMetadata(output),
643
+ });
644
+ throw __decorateServiceException(response, parsedBody);
645
+ }
646
+ });
647
+ }); };
648
+ export var deserializeAws_restJson1DeleteApplicationCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
649
+ var contents;
650
+ return __generator(this, function (_a) {
651
+ switch (_a.label) {
652
+ case 0:
653
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
654
+ return [2, deserializeAws_restJson1DeleteApplicationCommandError(output, context)];
655
+ }
656
+ contents = {
657
+ $metadata: deserializeMetadata(output),
658
+ };
659
+ return [4, collectBody(output.body, context)];
660
+ case 1:
661
+ _a.sent();
662
+ return [2, Promise.resolve(contents)];
663
+ }
664
+ });
665
+ }); };
666
+ var deserializeAws_restJson1DeleteApplicationCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
667
+ var parsedOutput, _a, response, errorCode, _b, parsedBody;
668
+ var _c;
669
+ return __generator(this, function (_d) {
670
+ switch (_d.label) {
671
+ case 0:
672
+ _a = [__assign({}, output)];
673
+ _c = {};
674
+ return [4, parseBody(output.body, context)];
675
+ case 1:
676
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
677
+ errorCode = "UnknownError";
678
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
679
+ _b = errorCode;
680
+ switch (_b) {
681
+ case "InternalServerException": return [3, 2];
682
+ case "com.amazonaws.emrserverless#InternalServerException": return [3, 2];
683
+ case "ResourceNotFoundException": return [3, 4];
684
+ case "com.amazonaws.emrserverless#ResourceNotFoundException": return [3, 4];
685
+ case "ValidationException": return [3, 6];
686
+ case "com.amazonaws.emrserverless#ValidationException": return [3, 6];
687
+ }
688
+ return [3, 8];
689
+ case 2: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
690
+ case 3: throw _d.sent();
691
+ case 4: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
692
+ case 5: throw _d.sent();
693
+ case 6: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
694
+ case 7: throw _d.sent();
695
+ case 8:
696
+ parsedBody = parsedOutput.body;
697
+ response = new __BaseException({
698
+ name: parsedBody.code || parsedBody.Code || errorCode,
699
+ $fault: "client",
700
+ $metadata: deserializeMetadata(output),
701
+ });
702
+ throw __decorateServiceException(response, parsedBody);
703
+ }
704
+ });
705
+ }); };
706
+ export var deserializeAws_restJson1GetApplicationCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
707
+ var contents, data, _a, _b;
708
+ return __generator(this, function (_c) {
709
+ switch (_c.label) {
710
+ case 0:
711
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
712
+ return [2, deserializeAws_restJson1GetApplicationCommandError(output, context)];
713
+ }
714
+ contents = {
715
+ $metadata: deserializeMetadata(output),
716
+ application: undefined,
717
+ };
718
+ _a = __expectNonNull;
719
+ _b = __expectObject;
720
+ return [4, parseBody(output.body, context)];
721
+ case 1:
722
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
723
+ if (data.application !== undefined && data.application !== null) {
724
+ contents.application = deserializeAws_restJson1Application(data.application, context);
725
+ }
726
+ return [2, Promise.resolve(contents)];
727
+ }
728
+ });
729
+ }); };
730
+ var deserializeAws_restJson1GetApplicationCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
731
+ var parsedOutput, _a, response, errorCode, _b, parsedBody;
732
+ var _c;
733
+ return __generator(this, function (_d) {
734
+ switch (_d.label) {
735
+ case 0:
736
+ _a = [__assign({}, output)];
737
+ _c = {};
738
+ return [4, parseBody(output.body, context)];
739
+ case 1:
740
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
741
+ errorCode = "UnknownError";
742
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
743
+ _b = errorCode;
744
+ switch (_b) {
745
+ case "InternalServerException": return [3, 2];
746
+ case "com.amazonaws.emrserverless#InternalServerException": return [3, 2];
747
+ case "ResourceNotFoundException": return [3, 4];
748
+ case "com.amazonaws.emrserverless#ResourceNotFoundException": return [3, 4];
749
+ case "ValidationException": return [3, 6];
750
+ case "com.amazonaws.emrserverless#ValidationException": return [3, 6];
751
+ }
752
+ return [3, 8];
753
+ case 2: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
754
+ case 3: throw _d.sent();
755
+ case 4: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
756
+ case 5: throw _d.sent();
757
+ case 6: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
758
+ case 7: throw _d.sent();
759
+ case 8:
760
+ parsedBody = parsedOutput.body;
761
+ response = new __BaseException({
762
+ name: parsedBody.code || parsedBody.Code || errorCode,
763
+ $fault: "client",
764
+ $metadata: deserializeMetadata(output),
765
+ });
766
+ throw __decorateServiceException(response, parsedBody);
767
+ }
768
+ });
769
+ }); };
770
+ export var deserializeAws_restJson1GetJobRunCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
771
+ var contents, data, _a, _b;
772
+ return __generator(this, function (_c) {
773
+ switch (_c.label) {
774
+ case 0:
775
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
776
+ return [2, deserializeAws_restJson1GetJobRunCommandError(output, context)];
777
+ }
778
+ contents = {
779
+ $metadata: deserializeMetadata(output),
780
+ jobRun: undefined,
781
+ };
782
+ _a = __expectNonNull;
783
+ _b = __expectObject;
784
+ return [4, parseBody(output.body, context)];
785
+ case 1:
786
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
787
+ if (data.jobRun !== undefined && data.jobRun !== null) {
788
+ contents.jobRun = deserializeAws_restJson1JobRun(data.jobRun, context);
789
+ }
790
+ return [2, Promise.resolve(contents)];
791
+ }
792
+ });
793
+ }); };
794
+ var deserializeAws_restJson1GetJobRunCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
795
+ var parsedOutput, _a, response, errorCode, _b, parsedBody;
796
+ var _c;
797
+ return __generator(this, function (_d) {
798
+ switch (_d.label) {
799
+ case 0:
800
+ _a = [__assign({}, output)];
801
+ _c = {};
802
+ return [4, parseBody(output.body, context)];
803
+ case 1:
804
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
805
+ errorCode = "UnknownError";
806
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
807
+ _b = errorCode;
808
+ switch (_b) {
809
+ case "InternalServerException": return [3, 2];
810
+ case "com.amazonaws.emrserverless#InternalServerException": return [3, 2];
811
+ case "ResourceNotFoundException": return [3, 4];
812
+ case "com.amazonaws.emrserverless#ResourceNotFoundException": return [3, 4];
813
+ case "ValidationException": return [3, 6];
814
+ case "com.amazonaws.emrserverless#ValidationException": return [3, 6];
815
+ }
816
+ return [3, 8];
817
+ case 2: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
818
+ case 3: throw _d.sent();
819
+ case 4: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
820
+ case 5: throw _d.sent();
821
+ case 6: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
822
+ case 7: throw _d.sent();
823
+ case 8:
824
+ parsedBody = parsedOutput.body;
825
+ response = new __BaseException({
826
+ name: parsedBody.code || parsedBody.Code || errorCode,
827
+ $fault: "client",
828
+ $metadata: deserializeMetadata(output),
829
+ });
830
+ throw __decorateServiceException(response, parsedBody);
831
+ }
832
+ });
833
+ }); };
834
+ export var deserializeAws_restJson1ListApplicationsCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
835
+ var contents, data, _a, _b;
836
+ return __generator(this, function (_c) {
837
+ switch (_c.label) {
838
+ case 0:
839
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
840
+ return [2, deserializeAws_restJson1ListApplicationsCommandError(output, context)];
841
+ }
842
+ contents = {
843
+ $metadata: deserializeMetadata(output),
844
+ applications: undefined,
845
+ nextToken: undefined,
846
+ };
847
+ _a = __expectNonNull;
848
+ _b = __expectObject;
849
+ return [4, parseBody(output.body, context)];
850
+ case 1:
851
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
852
+ if (data.applications !== undefined && data.applications !== null) {
853
+ contents.applications = deserializeAws_restJson1ApplicationList(data.applications, context);
854
+ }
855
+ if (data.nextToken !== undefined && data.nextToken !== null) {
856
+ contents.nextToken = __expectString(data.nextToken);
857
+ }
858
+ return [2, Promise.resolve(contents)];
859
+ }
860
+ });
861
+ }); };
862
+ var deserializeAws_restJson1ListApplicationsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
863
+ var parsedOutput, _a, response, errorCode, _b, parsedBody;
864
+ var _c;
865
+ return __generator(this, function (_d) {
866
+ switch (_d.label) {
867
+ case 0:
868
+ _a = [__assign({}, output)];
869
+ _c = {};
870
+ return [4, parseBody(output.body, context)];
871
+ case 1:
872
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
873
+ errorCode = "UnknownError";
874
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
875
+ _b = errorCode;
876
+ switch (_b) {
877
+ case "InternalServerException": return [3, 2];
878
+ case "com.amazonaws.emrserverless#InternalServerException": return [3, 2];
879
+ case "ValidationException": return [3, 4];
880
+ case "com.amazonaws.emrserverless#ValidationException": return [3, 4];
881
+ }
882
+ return [3, 6];
883
+ case 2: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
884
+ case 3: throw _d.sent();
885
+ case 4: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
886
+ case 5: throw _d.sent();
887
+ case 6:
888
+ parsedBody = parsedOutput.body;
889
+ response = new __BaseException({
890
+ name: parsedBody.code || parsedBody.Code || errorCode,
891
+ $fault: "client",
892
+ $metadata: deserializeMetadata(output),
893
+ });
894
+ throw __decorateServiceException(response, parsedBody);
895
+ }
896
+ });
897
+ }); };
898
+ export var deserializeAws_restJson1ListJobRunsCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
899
+ var contents, data, _a, _b;
900
+ return __generator(this, function (_c) {
901
+ switch (_c.label) {
902
+ case 0:
903
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
904
+ return [2, deserializeAws_restJson1ListJobRunsCommandError(output, context)];
905
+ }
906
+ contents = {
907
+ $metadata: deserializeMetadata(output),
908
+ jobRuns: undefined,
909
+ nextToken: undefined,
910
+ };
911
+ _a = __expectNonNull;
912
+ _b = __expectObject;
913
+ return [4, parseBody(output.body, context)];
914
+ case 1:
915
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
916
+ if (data.jobRuns !== undefined && data.jobRuns !== null) {
917
+ contents.jobRuns = deserializeAws_restJson1JobRuns(data.jobRuns, context);
918
+ }
919
+ if (data.nextToken !== undefined && data.nextToken !== null) {
920
+ contents.nextToken = __expectString(data.nextToken);
921
+ }
922
+ return [2, Promise.resolve(contents)];
923
+ }
924
+ });
925
+ }); };
926
+ var deserializeAws_restJson1ListJobRunsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
927
+ var parsedOutput, _a, response, errorCode, _b, parsedBody;
928
+ var _c;
929
+ return __generator(this, function (_d) {
930
+ switch (_d.label) {
931
+ case 0:
932
+ _a = [__assign({}, output)];
933
+ _c = {};
934
+ return [4, parseBody(output.body, context)];
935
+ case 1:
936
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
937
+ errorCode = "UnknownError";
938
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
939
+ _b = errorCode;
940
+ switch (_b) {
941
+ case "InternalServerException": return [3, 2];
942
+ case "com.amazonaws.emrserverless#InternalServerException": return [3, 2];
943
+ case "ValidationException": return [3, 4];
944
+ case "com.amazonaws.emrserverless#ValidationException": return [3, 4];
945
+ }
946
+ return [3, 6];
947
+ case 2: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
948
+ case 3: throw _d.sent();
949
+ case 4: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
950
+ case 5: throw _d.sent();
951
+ case 6:
952
+ parsedBody = parsedOutput.body;
953
+ response = new __BaseException({
954
+ name: parsedBody.code || parsedBody.Code || errorCode,
955
+ $fault: "client",
956
+ $metadata: deserializeMetadata(output),
957
+ });
958
+ throw __decorateServiceException(response, parsedBody);
959
+ }
960
+ });
961
+ }); };
962
+ export var deserializeAws_restJson1ListTagsForResourceCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
963
+ var contents, data, _a, _b;
964
+ return __generator(this, function (_c) {
965
+ switch (_c.label) {
966
+ case 0:
967
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
968
+ return [2, deserializeAws_restJson1ListTagsForResourceCommandError(output, context)];
969
+ }
970
+ contents = {
971
+ $metadata: deserializeMetadata(output),
972
+ tags: undefined,
973
+ };
974
+ _a = __expectNonNull;
975
+ _b = __expectObject;
976
+ return [4, parseBody(output.body, context)];
977
+ case 1:
978
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
979
+ if (data.tags !== undefined && data.tags !== null) {
980
+ contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
981
+ }
982
+ return [2, Promise.resolve(contents)];
983
+ }
984
+ });
985
+ }); };
986
+ var deserializeAws_restJson1ListTagsForResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
987
+ var parsedOutput, _a, response, errorCode, _b, parsedBody;
988
+ var _c;
989
+ return __generator(this, function (_d) {
990
+ switch (_d.label) {
991
+ case 0:
992
+ _a = [__assign({}, output)];
993
+ _c = {};
994
+ return [4, parseBody(output.body, context)];
995
+ case 1:
996
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
997
+ errorCode = "UnknownError";
998
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
999
+ _b = errorCode;
1000
+ switch (_b) {
1001
+ case "InternalServerException": return [3, 2];
1002
+ case "com.amazonaws.emrserverless#InternalServerException": return [3, 2];
1003
+ case "ResourceNotFoundException": return [3, 4];
1004
+ case "com.amazonaws.emrserverless#ResourceNotFoundException": return [3, 4];
1005
+ case "ValidationException": return [3, 6];
1006
+ case "com.amazonaws.emrserverless#ValidationException": return [3, 6];
1007
+ }
1008
+ return [3, 8];
1009
+ case 2: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
1010
+ case 3: throw _d.sent();
1011
+ case 4: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
1012
+ case 5: throw _d.sent();
1013
+ case 6: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
1014
+ case 7: throw _d.sent();
1015
+ case 8:
1016
+ parsedBody = parsedOutput.body;
1017
+ response = new __BaseException({
1018
+ name: parsedBody.code || parsedBody.Code || errorCode,
1019
+ $fault: "client",
1020
+ $metadata: deserializeMetadata(output),
1021
+ });
1022
+ throw __decorateServiceException(response, parsedBody);
1023
+ }
1024
+ });
1025
+ }); };
1026
+ export var deserializeAws_restJson1StartApplicationCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1027
+ var contents;
1028
+ return __generator(this, function (_a) {
1029
+ switch (_a.label) {
1030
+ case 0:
1031
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1032
+ return [2, deserializeAws_restJson1StartApplicationCommandError(output, context)];
1033
+ }
1034
+ contents = {
1035
+ $metadata: deserializeMetadata(output),
1036
+ };
1037
+ return [4, collectBody(output.body, context)];
1038
+ case 1:
1039
+ _a.sent();
1040
+ return [2, Promise.resolve(contents)];
1041
+ }
1042
+ });
1043
+ }); };
1044
+ var deserializeAws_restJson1StartApplicationCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1045
+ var parsedOutput, _a, response, errorCode, _b, parsedBody;
1046
+ var _c;
1047
+ return __generator(this, function (_d) {
1048
+ switch (_d.label) {
1049
+ case 0:
1050
+ _a = [__assign({}, output)];
1051
+ _c = {};
1052
+ return [4, parseBody(output.body, context)];
1053
+ case 1:
1054
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
1055
+ errorCode = "UnknownError";
1056
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1057
+ _b = errorCode;
1058
+ switch (_b) {
1059
+ case "InternalServerException": return [3, 2];
1060
+ case "com.amazonaws.emrserverless#InternalServerException": return [3, 2];
1061
+ case "ResourceNotFoundException": return [3, 4];
1062
+ case "com.amazonaws.emrserverless#ResourceNotFoundException": return [3, 4];
1063
+ case "ServiceQuotaExceededException": return [3, 6];
1064
+ case "com.amazonaws.emrserverless#ServiceQuotaExceededException": return [3, 6];
1065
+ case "ValidationException": return [3, 8];
1066
+ case "com.amazonaws.emrserverless#ValidationException": return [3, 8];
1067
+ }
1068
+ return [3, 10];
1069
+ case 2: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
1070
+ case 3: throw _d.sent();
1071
+ case 4: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
1072
+ case 5: throw _d.sent();
1073
+ case 6: return [4, deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)];
1074
+ case 7: throw _d.sent();
1075
+ case 8: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
1076
+ case 9: throw _d.sent();
1077
+ case 10:
1078
+ parsedBody = parsedOutput.body;
1079
+ response = new __BaseException({
1080
+ name: parsedBody.code || parsedBody.Code || errorCode,
1081
+ $fault: "client",
1082
+ $metadata: deserializeMetadata(output),
1083
+ });
1084
+ throw __decorateServiceException(response, parsedBody);
1085
+ }
1086
+ });
1087
+ }); };
1088
+ export var deserializeAws_restJson1StartJobRunCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1089
+ var contents, data, _a, _b;
1090
+ return __generator(this, function (_c) {
1091
+ switch (_c.label) {
1092
+ case 0:
1093
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1094
+ return [2, deserializeAws_restJson1StartJobRunCommandError(output, context)];
1095
+ }
1096
+ contents = {
1097
+ $metadata: deserializeMetadata(output),
1098
+ applicationId: undefined,
1099
+ arn: undefined,
1100
+ jobRunId: undefined,
1101
+ };
1102
+ _a = __expectNonNull;
1103
+ _b = __expectObject;
1104
+ return [4, parseBody(output.body, context)];
1105
+ case 1:
1106
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
1107
+ if (data.applicationId !== undefined && data.applicationId !== null) {
1108
+ contents.applicationId = __expectString(data.applicationId);
1109
+ }
1110
+ if (data.arn !== undefined && data.arn !== null) {
1111
+ contents.arn = __expectString(data.arn);
1112
+ }
1113
+ if (data.jobRunId !== undefined && data.jobRunId !== null) {
1114
+ contents.jobRunId = __expectString(data.jobRunId);
1115
+ }
1116
+ return [2, Promise.resolve(contents)];
1117
+ }
1118
+ });
1119
+ }); };
1120
+ var deserializeAws_restJson1StartJobRunCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1121
+ var parsedOutput, _a, response, errorCode, _b, parsedBody;
1122
+ var _c;
1123
+ return __generator(this, function (_d) {
1124
+ switch (_d.label) {
1125
+ case 0:
1126
+ _a = [__assign({}, output)];
1127
+ _c = {};
1128
+ return [4, parseBody(output.body, context)];
1129
+ case 1:
1130
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
1131
+ errorCode = "UnknownError";
1132
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1133
+ _b = errorCode;
1134
+ switch (_b) {
1135
+ case "ConflictException": return [3, 2];
1136
+ case "com.amazonaws.emrserverless#ConflictException": return [3, 2];
1137
+ case "InternalServerException": return [3, 4];
1138
+ case "com.amazonaws.emrserverless#InternalServerException": return [3, 4];
1139
+ case "ResourceNotFoundException": return [3, 6];
1140
+ case "com.amazonaws.emrserverless#ResourceNotFoundException": return [3, 6];
1141
+ case "ValidationException": return [3, 8];
1142
+ case "com.amazonaws.emrserverless#ValidationException": return [3, 8];
1143
+ }
1144
+ return [3, 10];
1145
+ case 2: return [4, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
1146
+ case 3: throw _d.sent();
1147
+ case 4: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
1148
+ case 5: throw _d.sent();
1149
+ case 6: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
1150
+ case 7: throw _d.sent();
1151
+ case 8: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
1152
+ case 9: throw _d.sent();
1153
+ case 10:
1154
+ parsedBody = parsedOutput.body;
1155
+ response = new __BaseException({
1156
+ name: parsedBody.code || parsedBody.Code || errorCode,
1157
+ $fault: "client",
1158
+ $metadata: deserializeMetadata(output),
1159
+ });
1160
+ throw __decorateServiceException(response, parsedBody);
1161
+ }
1162
+ });
1163
+ }); };
1164
+ export var deserializeAws_restJson1StopApplicationCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1165
+ var contents;
1166
+ return __generator(this, function (_a) {
1167
+ switch (_a.label) {
1168
+ case 0:
1169
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1170
+ return [2, deserializeAws_restJson1StopApplicationCommandError(output, context)];
1171
+ }
1172
+ contents = {
1173
+ $metadata: deserializeMetadata(output),
1174
+ };
1175
+ return [4, collectBody(output.body, context)];
1176
+ case 1:
1177
+ _a.sent();
1178
+ return [2, Promise.resolve(contents)];
1179
+ }
1180
+ });
1181
+ }); };
1182
+ var deserializeAws_restJson1StopApplicationCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1183
+ var parsedOutput, _a, response, errorCode, _b, parsedBody;
1184
+ var _c;
1185
+ return __generator(this, function (_d) {
1186
+ switch (_d.label) {
1187
+ case 0:
1188
+ _a = [__assign({}, output)];
1189
+ _c = {};
1190
+ return [4, parseBody(output.body, context)];
1191
+ case 1:
1192
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
1193
+ errorCode = "UnknownError";
1194
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1195
+ _b = errorCode;
1196
+ switch (_b) {
1197
+ case "InternalServerException": return [3, 2];
1198
+ case "com.amazonaws.emrserverless#InternalServerException": return [3, 2];
1199
+ case "ResourceNotFoundException": return [3, 4];
1200
+ case "com.amazonaws.emrserverless#ResourceNotFoundException": return [3, 4];
1201
+ case "ValidationException": return [3, 6];
1202
+ case "com.amazonaws.emrserverless#ValidationException": return [3, 6];
1203
+ }
1204
+ return [3, 8];
1205
+ case 2: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
1206
+ case 3: throw _d.sent();
1207
+ case 4: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
1208
+ case 5: throw _d.sent();
1209
+ case 6: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
1210
+ case 7: throw _d.sent();
1211
+ case 8:
1212
+ parsedBody = parsedOutput.body;
1213
+ response = new __BaseException({
1214
+ name: parsedBody.code || parsedBody.Code || errorCode,
1215
+ $fault: "client",
1216
+ $metadata: deserializeMetadata(output),
1217
+ });
1218
+ throw __decorateServiceException(response, parsedBody);
1219
+ }
1220
+ });
1221
+ }); };
1222
+ export var deserializeAws_restJson1TagResourceCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1223
+ var contents;
1224
+ return __generator(this, function (_a) {
1225
+ switch (_a.label) {
1226
+ case 0:
1227
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1228
+ return [2, deserializeAws_restJson1TagResourceCommandError(output, context)];
1229
+ }
1230
+ contents = {
1231
+ $metadata: deserializeMetadata(output),
1232
+ };
1233
+ return [4, collectBody(output.body, context)];
1234
+ case 1:
1235
+ _a.sent();
1236
+ return [2, Promise.resolve(contents)];
1237
+ }
1238
+ });
1239
+ }); };
1240
+ var deserializeAws_restJson1TagResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1241
+ var parsedOutput, _a, response, errorCode, _b, parsedBody;
1242
+ var _c;
1243
+ return __generator(this, function (_d) {
1244
+ switch (_d.label) {
1245
+ case 0:
1246
+ _a = [__assign({}, output)];
1247
+ _c = {};
1248
+ return [4, parseBody(output.body, context)];
1249
+ case 1:
1250
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
1251
+ errorCode = "UnknownError";
1252
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1253
+ _b = errorCode;
1254
+ switch (_b) {
1255
+ case "InternalServerException": return [3, 2];
1256
+ case "com.amazonaws.emrserverless#InternalServerException": return [3, 2];
1257
+ case "ResourceNotFoundException": return [3, 4];
1258
+ case "com.amazonaws.emrserverless#ResourceNotFoundException": return [3, 4];
1259
+ case "ValidationException": return [3, 6];
1260
+ case "com.amazonaws.emrserverless#ValidationException": return [3, 6];
1261
+ }
1262
+ return [3, 8];
1263
+ case 2: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
1264
+ case 3: throw _d.sent();
1265
+ case 4: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
1266
+ case 5: throw _d.sent();
1267
+ case 6: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
1268
+ case 7: throw _d.sent();
1269
+ case 8:
1270
+ parsedBody = parsedOutput.body;
1271
+ response = new __BaseException({
1272
+ name: parsedBody.code || parsedBody.Code || errorCode,
1273
+ $fault: "client",
1274
+ $metadata: deserializeMetadata(output),
1275
+ });
1276
+ throw __decorateServiceException(response, parsedBody);
1277
+ }
1278
+ });
1279
+ }); };
1280
+ export var deserializeAws_restJson1UntagResourceCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1281
+ var contents;
1282
+ return __generator(this, function (_a) {
1283
+ switch (_a.label) {
1284
+ case 0:
1285
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1286
+ return [2, deserializeAws_restJson1UntagResourceCommandError(output, context)];
1287
+ }
1288
+ contents = {
1289
+ $metadata: deserializeMetadata(output),
1290
+ };
1291
+ return [4, collectBody(output.body, context)];
1292
+ case 1:
1293
+ _a.sent();
1294
+ return [2, Promise.resolve(contents)];
1295
+ }
1296
+ });
1297
+ }); };
1298
+ var deserializeAws_restJson1UntagResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1299
+ var parsedOutput, _a, response, errorCode, _b, parsedBody;
1300
+ var _c;
1301
+ return __generator(this, function (_d) {
1302
+ switch (_d.label) {
1303
+ case 0:
1304
+ _a = [__assign({}, output)];
1305
+ _c = {};
1306
+ return [4, parseBody(output.body, context)];
1307
+ case 1:
1308
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
1309
+ errorCode = "UnknownError";
1310
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1311
+ _b = errorCode;
1312
+ switch (_b) {
1313
+ case "InternalServerException": return [3, 2];
1314
+ case "com.amazonaws.emrserverless#InternalServerException": return [3, 2];
1315
+ case "ResourceNotFoundException": return [3, 4];
1316
+ case "com.amazonaws.emrserverless#ResourceNotFoundException": return [3, 4];
1317
+ case "ValidationException": return [3, 6];
1318
+ case "com.amazonaws.emrserverless#ValidationException": return [3, 6];
1319
+ }
1320
+ return [3, 8];
1321
+ case 2: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
1322
+ case 3: throw _d.sent();
1323
+ case 4: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
1324
+ case 5: throw _d.sent();
1325
+ case 6: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
1326
+ case 7: throw _d.sent();
1327
+ case 8:
1328
+ parsedBody = parsedOutput.body;
1329
+ response = new __BaseException({
1330
+ name: parsedBody.code || parsedBody.Code || errorCode,
1331
+ $fault: "client",
1332
+ $metadata: deserializeMetadata(output),
1333
+ });
1334
+ throw __decorateServiceException(response, parsedBody);
1335
+ }
1336
+ });
1337
+ }); };
1338
+ export var deserializeAws_restJson1UpdateApplicationCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1339
+ var contents, data, _a, _b;
1340
+ return __generator(this, function (_c) {
1341
+ switch (_c.label) {
1342
+ case 0:
1343
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1344
+ return [2, deserializeAws_restJson1UpdateApplicationCommandError(output, context)];
1345
+ }
1346
+ contents = {
1347
+ $metadata: deserializeMetadata(output),
1348
+ application: undefined,
1349
+ };
1350
+ _a = __expectNonNull;
1351
+ _b = __expectObject;
1352
+ return [4, parseBody(output.body, context)];
1353
+ case 1:
1354
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
1355
+ if (data.application !== undefined && data.application !== null) {
1356
+ contents.application = deserializeAws_restJson1Application(data.application, context);
1357
+ }
1358
+ return [2, Promise.resolve(contents)];
1359
+ }
1360
+ });
1361
+ }); };
1362
+ var deserializeAws_restJson1UpdateApplicationCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1363
+ var parsedOutput, _a, response, errorCode, _b, parsedBody;
1364
+ var _c;
1365
+ return __generator(this, function (_d) {
1366
+ switch (_d.label) {
1367
+ case 0:
1368
+ _a = [__assign({}, output)];
1369
+ _c = {};
1370
+ return [4, parseBody(output.body, context)];
1371
+ case 1:
1372
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
1373
+ errorCode = "UnknownError";
1374
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1375
+ _b = errorCode;
1376
+ switch (_b) {
1377
+ case "InternalServerException": return [3, 2];
1378
+ case "com.amazonaws.emrserverless#InternalServerException": return [3, 2];
1379
+ case "ResourceNotFoundException": return [3, 4];
1380
+ case "com.amazonaws.emrserverless#ResourceNotFoundException": return [3, 4];
1381
+ case "ValidationException": return [3, 6];
1382
+ case "com.amazonaws.emrserverless#ValidationException": return [3, 6];
1383
+ }
1384
+ return [3, 8];
1385
+ case 2: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
1386
+ case 3: throw _d.sent();
1387
+ case 4: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
1388
+ case 5: throw _d.sent();
1389
+ case 6: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
1390
+ case 7: throw _d.sent();
1391
+ case 8:
1392
+ parsedBody = parsedOutput.body;
1393
+ response = new __BaseException({
1394
+ name: parsedBody.code || parsedBody.Code || errorCode,
1395
+ $fault: "client",
1396
+ $metadata: deserializeMetadata(output),
1397
+ });
1398
+ throw __decorateServiceException(response, parsedBody);
1399
+ }
1400
+ });
1401
+ }); };
1402
+ var deserializeAws_restJson1ConflictExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1403
+ var contents, data, exception;
1404
+ return __generator(this, function (_a) {
1405
+ contents = {};
1406
+ data = parsedOutput.body;
1407
+ if (data.message !== undefined && data.message !== null) {
1408
+ contents.message = __expectString(data.message);
1409
+ }
1410
+ exception = new ConflictException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1411
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
1412
+ });
1413
+ }); };
1414
+ var deserializeAws_restJson1InternalServerExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1415
+ var contents, data, exception;
1416
+ return __generator(this, function (_a) {
1417
+ contents = {};
1418
+ data = parsedOutput.body;
1419
+ if (data.message !== undefined && data.message !== null) {
1420
+ contents.message = __expectString(data.message);
1421
+ }
1422
+ exception = new InternalServerException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1423
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
1424
+ });
1425
+ }); };
1426
+ var deserializeAws_restJson1ResourceNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1427
+ var contents, data, exception;
1428
+ return __generator(this, function (_a) {
1429
+ contents = {};
1430
+ data = parsedOutput.body;
1431
+ if (data.message !== undefined && data.message !== null) {
1432
+ contents.message = __expectString(data.message);
1433
+ }
1434
+ exception = new ResourceNotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1435
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
1436
+ });
1437
+ }); };
1438
+ var deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1439
+ var contents, data, exception;
1440
+ return __generator(this, function (_a) {
1441
+ contents = {};
1442
+ data = parsedOutput.body;
1443
+ if (data.message !== undefined && data.message !== null) {
1444
+ contents.message = __expectString(data.message);
1445
+ }
1446
+ exception = new ServiceQuotaExceededException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1447
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
1448
+ });
1449
+ }); };
1450
+ var deserializeAws_restJson1ValidationExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1451
+ var contents, data, exception;
1452
+ return __generator(this, function (_a) {
1453
+ contents = {};
1454
+ data = parsedOutput.body;
1455
+ if (data.message !== undefined && data.message !== null) {
1456
+ contents.message = __expectString(data.message);
1457
+ }
1458
+ exception = new ValidationException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1459
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
1460
+ });
1461
+ }); };
1462
+ var serializeAws_restJson1AutoStartConfig = function (input, context) {
1463
+ return __assign({}, (input.enabled !== undefined && input.enabled !== null && { enabled: input.enabled }));
1464
+ };
1465
+ var serializeAws_restJson1AutoStopConfig = function (input, context) {
1466
+ return __assign(__assign({}, (input.enabled !== undefined && input.enabled !== null && { enabled: input.enabled })), (input.idleTimeoutMinutes !== undefined &&
1467
+ input.idleTimeoutMinutes !== null && { idleTimeoutMinutes: input.idleTimeoutMinutes }));
1468
+ };
1469
+ var serializeAws_restJson1Configuration = function (input, context) {
1470
+ return __assign(__assign(__assign({}, (input.classification !== undefined &&
1471
+ input.classification !== null && { classification: input.classification })), (input.configurations !== undefined &&
1472
+ input.configurations !== null && {
1473
+ configurations: serializeAws_restJson1ConfigurationList(input.configurations, context),
1474
+ })), (input.properties !== undefined &&
1475
+ input.properties !== null && {
1476
+ properties: serializeAws_restJson1SensitivePropertiesMap(input.properties, context),
1477
+ }));
1478
+ };
1479
+ var serializeAws_restJson1ConfigurationList = function (input, context) {
1480
+ return input
1481
+ .filter(function (e) { return e != null; })
1482
+ .map(function (entry) {
1483
+ if (entry === null) {
1484
+ return null;
1485
+ }
1486
+ return serializeAws_restJson1Configuration(entry, context);
1487
+ });
1488
+ };
1489
+ var serializeAws_restJson1ConfigurationOverrides = function (input, context) {
1490
+ return __assign(__assign({}, (input.applicationConfiguration !== undefined &&
1491
+ input.applicationConfiguration !== null && {
1492
+ applicationConfiguration: serializeAws_restJson1ConfigurationList(input.applicationConfiguration, context),
1493
+ })), (input.monitoringConfiguration !== undefined &&
1494
+ input.monitoringConfiguration !== null && {
1495
+ monitoringConfiguration: serializeAws_restJson1MonitoringConfiguration(input.monitoringConfiguration, context),
1496
+ }));
1497
+ };
1498
+ var serializeAws_restJson1EntryPointArguments = function (input, context) {
1499
+ return input
1500
+ .filter(function (e) { return e != null; })
1501
+ .map(function (entry) {
1502
+ if (entry === null) {
1503
+ return null;
1504
+ }
1505
+ return entry;
1506
+ });
1507
+ };
1508
+ var serializeAws_restJson1Hive = function (input, context) {
1509
+ return __assign(__assign(__assign({}, (input.initQueryFile !== undefined && input.initQueryFile !== null && { initQueryFile: input.initQueryFile })), (input.parameters !== undefined && input.parameters !== null && { parameters: input.parameters })), (input.query !== undefined && input.query !== null && { query: input.query }));
1510
+ };
1511
+ var serializeAws_restJson1InitialCapacityConfig = function (input, context) {
1512
+ return __assign(__assign({}, (input.workerConfiguration !== undefined &&
1513
+ input.workerConfiguration !== null && {
1514
+ workerConfiguration: serializeAws_restJson1WorkerResourceConfig(input.workerConfiguration, context),
1515
+ })), (input.workerCount !== undefined && input.workerCount !== null && { workerCount: input.workerCount }));
1516
+ };
1517
+ var serializeAws_restJson1InitialCapacityConfigMap = function (input, context) {
1518
+ return Object.entries(input).reduce(function (acc, _a) {
1519
+ var _b;
1520
+ var _c = __read(_a, 2), key = _c[0], value = _c[1];
1521
+ if (value === null) {
1522
+ return acc;
1523
+ }
1524
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = serializeAws_restJson1InitialCapacityConfig(value, context), _b));
1525
+ }, {});
1526
+ };
1527
+ var serializeAws_restJson1JobDriver = function (input, context) {
1528
+ return JobDriver.visit(input, {
1529
+ hive: function (value) { return ({ hive: serializeAws_restJson1Hive(value, context) }); },
1530
+ sparkSubmit: function (value) { return ({ sparkSubmit: serializeAws_restJson1SparkSubmit(value, context) }); },
1531
+ _: function (name, value) { return ({ name: value }); },
1532
+ });
1533
+ };
1534
+ var serializeAws_restJson1ManagedPersistenceMonitoringConfiguration = function (input, context) {
1535
+ return __assign(__assign({}, (input.enabled !== undefined && input.enabled !== null && { enabled: input.enabled })), (input.encryptionKeyArn !== undefined &&
1536
+ input.encryptionKeyArn !== null && { encryptionKeyArn: input.encryptionKeyArn }));
1537
+ };
1538
+ var serializeAws_restJson1MaximumAllowedResources = function (input, context) {
1539
+ return __assign(__assign(__assign({}, (input.cpu !== undefined && input.cpu !== null && { cpu: input.cpu })), (input.disk !== undefined && input.disk !== null && { disk: input.disk })), (input.memory !== undefined && input.memory !== null && { memory: input.memory }));
1540
+ };
1541
+ var serializeAws_restJson1MonitoringConfiguration = function (input, context) {
1542
+ return __assign(__assign({}, (input.managedPersistenceMonitoringConfiguration !== undefined &&
1543
+ input.managedPersistenceMonitoringConfiguration !== null && {
1544
+ managedPersistenceMonitoringConfiguration: serializeAws_restJson1ManagedPersistenceMonitoringConfiguration(input.managedPersistenceMonitoringConfiguration, context),
1545
+ })), (input.s3MonitoringConfiguration !== undefined &&
1546
+ input.s3MonitoringConfiguration !== null && {
1547
+ s3MonitoringConfiguration: serializeAws_restJson1S3MonitoringConfiguration(input.s3MonitoringConfiguration, context),
1548
+ }));
1549
+ };
1550
+ var serializeAws_restJson1NetworkConfiguration = function (input, context) {
1551
+ return __assign(__assign({}, (input.securityGroupIds !== undefined &&
1552
+ input.securityGroupIds !== null && {
1553
+ securityGroupIds: serializeAws_restJson1SecurityGroupIds(input.securityGroupIds, context),
1554
+ })), (input.subnetIds !== undefined &&
1555
+ input.subnetIds !== null && { subnetIds: serializeAws_restJson1SubnetIds(input.subnetIds, context) }));
1556
+ };
1557
+ var serializeAws_restJson1S3MonitoringConfiguration = function (input, context) {
1558
+ return __assign(__assign({}, (input.encryptionKeyArn !== undefined &&
1559
+ input.encryptionKeyArn !== null && { encryptionKeyArn: input.encryptionKeyArn })), (input.logUri !== undefined && input.logUri !== null && { logUri: input.logUri }));
1560
+ };
1561
+ var serializeAws_restJson1SecurityGroupIds = function (input, context) {
1562
+ return input
1563
+ .filter(function (e) { return e != null; })
1564
+ .map(function (entry) {
1565
+ if (entry === null) {
1566
+ return null;
1567
+ }
1568
+ return entry;
1569
+ });
1570
+ };
1571
+ var serializeAws_restJson1SensitivePropertiesMap = function (input, context) {
1572
+ return Object.entries(input).reduce(function (acc, _a) {
1573
+ var _b;
1574
+ var _c = __read(_a, 2), key = _c[0], value = _c[1];
1575
+ if (value === null) {
1576
+ return acc;
1577
+ }
1578
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = value, _b));
1579
+ }, {});
1580
+ };
1581
+ var serializeAws_restJson1SparkSubmit = function (input, context) {
1582
+ return __assign(__assign(__assign({}, (input.entryPoint !== undefined && input.entryPoint !== null && { entryPoint: input.entryPoint })), (input.entryPointArguments !== undefined &&
1583
+ input.entryPointArguments !== null && {
1584
+ entryPointArguments: serializeAws_restJson1EntryPointArguments(input.entryPointArguments, context),
1585
+ })), (input.sparkSubmitParameters !== undefined &&
1586
+ input.sparkSubmitParameters !== null && { sparkSubmitParameters: input.sparkSubmitParameters }));
1587
+ };
1588
+ var serializeAws_restJson1SubnetIds = function (input, context) {
1589
+ return input
1590
+ .filter(function (e) { return e != null; })
1591
+ .map(function (entry) {
1592
+ if (entry === null) {
1593
+ return null;
1594
+ }
1595
+ return entry;
1596
+ });
1597
+ };
1598
+ var serializeAws_restJson1TagMap = function (input, context) {
1599
+ return Object.entries(input).reduce(function (acc, _a) {
1600
+ var _b;
1601
+ var _c = __read(_a, 2), key = _c[0], value = _c[1];
1602
+ if (value === null) {
1603
+ return acc;
1604
+ }
1605
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = value, _b));
1606
+ }, {});
1607
+ };
1608
+ var serializeAws_restJson1WorkerResourceConfig = function (input, context) {
1609
+ return __assign(__assign(__assign({}, (input.cpu !== undefined && input.cpu !== null && { cpu: input.cpu })), (input.disk !== undefined && input.disk !== null && { disk: input.disk })), (input.memory !== undefined && input.memory !== null && { memory: input.memory }));
1610
+ };
1611
+ var deserializeAws_restJson1Application = function (output, context) {
1612
+ return {
1613
+ applicationId: __expectString(output.applicationId),
1614
+ arn: __expectString(output.arn),
1615
+ autoStartConfiguration: output.autoStartConfiguration !== undefined && output.autoStartConfiguration !== null
1616
+ ? deserializeAws_restJson1AutoStartConfig(output.autoStartConfiguration, context)
1617
+ : undefined,
1618
+ autoStopConfiguration: output.autoStopConfiguration !== undefined && output.autoStopConfiguration !== null
1619
+ ? deserializeAws_restJson1AutoStopConfig(output.autoStopConfiguration, context)
1620
+ : undefined,
1621
+ createdAt: output.createdAt !== undefined && output.createdAt !== null
1622
+ ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt)))
1623
+ : undefined,
1624
+ initialCapacity: output.initialCapacity !== undefined && output.initialCapacity !== null
1625
+ ? deserializeAws_restJson1InitialCapacityConfigMap(output.initialCapacity, context)
1626
+ : undefined,
1627
+ maximumCapacity: output.maximumCapacity !== undefined && output.maximumCapacity !== null
1628
+ ? deserializeAws_restJson1MaximumAllowedResources(output.maximumCapacity, context)
1629
+ : undefined,
1630
+ name: __expectString(output.name),
1631
+ networkConfiguration: output.networkConfiguration !== undefined && output.networkConfiguration !== null
1632
+ ? deserializeAws_restJson1NetworkConfiguration(output.networkConfiguration, context)
1633
+ : undefined,
1634
+ releaseLabel: __expectString(output.releaseLabel),
1635
+ state: __expectString(output.state),
1636
+ stateDetails: __expectString(output.stateDetails),
1637
+ tags: output.tags !== undefined && output.tags !== null
1638
+ ? deserializeAws_restJson1TagMap(output.tags, context)
1639
+ : undefined,
1640
+ type: __expectString(output.type),
1641
+ updatedAt: output.updatedAt !== undefined && output.updatedAt !== null
1642
+ ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.updatedAt)))
1643
+ : undefined,
1644
+ };
1645
+ };
1646
+ var deserializeAws_restJson1ApplicationList = function (output, context) {
1647
+ var retVal = (output || [])
1648
+ .filter(function (e) { return e != null; })
1649
+ .map(function (entry) {
1650
+ if (entry === null) {
1651
+ return null;
1652
+ }
1653
+ return deserializeAws_restJson1ApplicationSummary(entry, context);
1654
+ });
1655
+ return retVal;
1656
+ };
1657
+ var deserializeAws_restJson1ApplicationSummary = function (output, context) {
1658
+ return {
1659
+ arn: __expectString(output.arn),
1660
+ createdAt: output.createdAt !== undefined && output.createdAt !== null
1661
+ ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt)))
1662
+ : undefined,
1663
+ id: __expectString(output.id),
1664
+ name: __expectString(output.name),
1665
+ releaseLabel: __expectString(output.releaseLabel),
1666
+ state: __expectString(output.state),
1667
+ stateDetails: __expectString(output.stateDetails),
1668
+ type: __expectString(output.type),
1669
+ updatedAt: output.updatedAt !== undefined && output.updatedAt !== null
1670
+ ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.updatedAt)))
1671
+ : undefined,
1672
+ };
1673
+ };
1674
+ var deserializeAws_restJson1AutoStartConfig = function (output, context) {
1675
+ return {
1676
+ enabled: __expectBoolean(output.enabled),
1677
+ };
1678
+ };
1679
+ var deserializeAws_restJson1AutoStopConfig = function (output, context) {
1680
+ return {
1681
+ enabled: __expectBoolean(output.enabled),
1682
+ idleTimeoutMinutes: __expectInt32(output.idleTimeoutMinutes),
1683
+ };
1684
+ };
1685
+ var deserializeAws_restJson1Configuration = function (output, context) {
1686
+ return {
1687
+ classification: __expectString(output.classification),
1688
+ configurations: output.configurations !== undefined && output.configurations !== null
1689
+ ? deserializeAws_restJson1ConfigurationList(output.configurations, context)
1690
+ : undefined,
1691
+ properties: output.properties !== undefined && output.properties !== null
1692
+ ? deserializeAws_restJson1SensitivePropertiesMap(output.properties, context)
1693
+ : undefined,
1694
+ };
1695
+ };
1696
+ var deserializeAws_restJson1ConfigurationList = function (output, context) {
1697
+ var retVal = (output || [])
1698
+ .filter(function (e) { return e != null; })
1699
+ .map(function (entry) {
1700
+ if (entry === null) {
1701
+ return null;
1702
+ }
1703
+ return deserializeAws_restJson1Configuration(entry, context);
1704
+ });
1705
+ return retVal;
1706
+ };
1707
+ var deserializeAws_restJson1ConfigurationOverrides = function (output, context) {
1708
+ return {
1709
+ applicationConfiguration: output.applicationConfiguration !== undefined && output.applicationConfiguration !== null
1710
+ ? deserializeAws_restJson1ConfigurationList(output.applicationConfiguration, context)
1711
+ : undefined,
1712
+ monitoringConfiguration: output.monitoringConfiguration !== undefined && output.monitoringConfiguration !== null
1713
+ ? deserializeAws_restJson1MonitoringConfiguration(output.monitoringConfiguration, context)
1714
+ : undefined,
1715
+ };
1716
+ };
1717
+ var deserializeAws_restJson1EntryPointArguments = function (output, context) {
1718
+ var retVal = (output || [])
1719
+ .filter(function (e) { return e != null; })
1720
+ .map(function (entry) {
1721
+ if (entry === null) {
1722
+ return null;
1723
+ }
1724
+ return __expectString(entry);
1725
+ });
1726
+ return retVal;
1727
+ };
1728
+ var deserializeAws_restJson1Hive = function (output, context) {
1729
+ return {
1730
+ initQueryFile: __expectString(output.initQueryFile),
1731
+ parameters: __expectString(output.parameters),
1732
+ query: __expectString(output.query),
1733
+ };
1734
+ };
1735
+ var deserializeAws_restJson1InitialCapacityConfig = function (output, context) {
1736
+ return {
1737
+ workerConfiguration: output.workerConfiguration !== undefined && output.workerConfiguration !== null
1738
+ ? deserializeAws_restJson1WorkerResourceConfig(output.workerConfiguration, context)
1739
+ : undefined,
1740
+ workerCount: __expectLong(output.workerCount),
1741
+ };
1742
+ };
1743
+ var deserializeAws_restJson1InitialCapacityConfigMap = function (output, context) {
1744
+ return Object.entries(output).reduce(function (acc, _a) {
1745
+ var _b;
1746
+ var _c = __read(_a, 2), key = _c[0], value = _c[1];
1747
+ if (value === null) {
1748
+ return acc;
1749
+ }
1750
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = deserializeAws_restJson1InitialCapacityConfig(value, context), _b));
1751
+ }, {});
1752
+ };
1753
+ var deserializeAws_restJson1JobDriver = function (output, context) {
1754
+ if (output.hive !== undefined && output.hive !== null) {
1755
+ return {
1756
+ hive: deserializeAws_restJson1Hive(output.hive, context),
1757
+ };
1758
+ }
1759
+ if (output.sparkSubmit !== undefined && output.sparkSubmit !== null) {
1760
+ return {
1761
+ sparkSubmit: deserializeAws_restJson1SparkSubmit(output.sparkSubmit, context),
1762
+ };
1763
+ }
1764
+ return { $unknown: Object.entries(output)[0] };
1765
+ };
1766
+ var deserializeAws_restJson1JobRun = function (output, context) {
1767
+ return {
1768
+ applicationId: __expectString(output.applicationId),
1769
+ arn: __expectString(output.arn),
1770
+ configurationOverrides: output.configurationOverrides !== undefined && output.configurationOverrides !== null
1771
+ ? deserializeAws_restJson1ConfigurationOverrides(output.configurationOverrides, context)
1772
+ : undefined,
1773
+ createdAt: output.createdAt !== undefined && output.createdAt !== null
1774
+ ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt)))
1775
+ : undefined,
1776
+ createdBy: __expectString(output.createdBy),
1777
+ executionRole: __expectString(output.executionRole),
1778
+ jobDriver: output.jobDriver !== undefined && output.jobDriver !== null
1779
+ ? deserializeAws_restJson1JobDriver(__expectUnion(output.jobDriver), context)
1780
+ : undefined,
1781
+ jobRunId: __expectString(output.jobRunId),
1782
+ name: __expectString(output.name),
1783
+ networkConfiguration: output.networkConfiguration !== undefined && output.networkConfiguration !== null
1784
+ ? deserializeAws_restJson1NetworkConfiguration(output.networkConfiguration, context)
1785
+ : undefined,
1786
+ releaseLabel: __expectString(output.releaseLabel),
1787
+ state: __expectString(output.state),
1788
+ stateDetails: __expectString(output.stateDetails),
1789
+ tags: output.tags !== undefined && output.tags !== null
1790
+ ? deserializeAws_restJson1TagMap(output.tags, context)
1791
+ : undefined,
1792
+ totalExecutionDurationSeconds: __expectInt32(output.totalExecutionDurationSeconds),
1793
+ totalResourceUtilization: output.totalResourceUtilization !== undefined && output.totalResourceUtilization !== null
1794
+ ? deserializeAws_restJson1TotalResourceUtilization(output.totalResourceUtilization, context)
1795
+ : undefined,
1796
+ updatedAt: output.updatedAt !== undefined && output.updatedAt !== null
1797
+ ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.updatedAt)))
1798
+ : undefined,
1799
+ };
1800
+ };
1801
+ var deserializeAws_restJson1JobRuns = function (output, context) {
1802
+ var retVal = (output || [])
1803
+ .filter(function (e) { return e != null; })
1804
+ .map(function (entry) {
1805
+ if (entry === null) {
1806
+ return null;
1807
+ }
1808
+ return deserializeAws_restJson1JobRunSummary(entry, context);
1809
+ });
1810
+ return retVal;
1811
+ };
1812
+ var deserializeAws_restJson1JobRunSummary = function (output, context) {
1813
+ return {
1814
+ applicationId: __expectString(output.applicationId),
1815
+ arn: __expectString(output.arn),
1816
+ createdAt: output.createdAt !== undefined && output.createdAt !== null
1817
+ ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt)))
1818
+ : undefined,
1819
+ createdBy: __expectString(output.createdBy),
1820
+ executionRole: __expectString(output.executionRole),
1821
+ id: __expectString(output.id),
1822
+ name: __expectString(output.name),
1823
+ releaseLabel: __expectString(output.releaseLabel),
1824
+ state: __expectString(output.state),
1825
+ stateDetails: __expectString(output.stateDetails),
1826
+ type: __expectString(output.type),
1827
+ updatedAt: output.updatedAt !== undefined && output.updatedAt !== null
1828
+ ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.updatedAt)))
1829
+ : undefined,
1830
+ };
1831
+ };
1832
+ var deserializeAws_restJson1ManagedPersistenceMonitoringConfiguration = function (output, context) {
1833
+ return {
1834
+ enabled: __expectBoolean(output.enabled),
1835
+ encryptionKeyArn: __expectString(output.encryptionKeyArn),
1836
+ };
1837
+ };
1838
+ var deserializeAws_restJson1MaximumAllowedResources = function (output, context) {
1839
+ return {
1840
+ cpu: __expectString(output.cpu),
1841
+ disk: __expectString(output.disk),
1842
+ memory: __expectString(output.memory),
1843
+ };
1844
+ };
1845
+ var deserializeAws_restJson1MonitoringConfiguration = function (output, context) {
1846
+ return {
1847
+ managedPersistenceMonitoringConfiguration: output.managedPersistenceMonitoringConfiguration !== undefined &&
1848
+ output.managedPersistenceMonitoringConfiguration !== null
1849
+ ? deserializeAws_restJson1ManagedPersistenceMonitoringConfiguration(output.managedPersistenceMonitoringConfiguration, context)
1850
+ : undefined,
1851
+ s3MonitoringConfiguration: output.s3MonitoringConfiguration !== undefined && output.s3MonitoringConfiguration !== null
1852
+ ? deserializeAws_restJson1S3MonitoringConfiguration(output.s3MonitoringConfiguration, context)
1853
+ : undefined,
1854
+ };
1855
+ };
1856
+ var deserializeAws_restJson1NetworkConfiguration = function (output, context) {
1857
+ return {
1858
+ securityGroupIds: output.securityGroupIds !== undefined && output.securityGroupIds !== null
1859
+ ? deserializeAws_restJson1SecurityGroupIds(output.securityGroupIds, context)
1860
+ : undefined,
1861
+ subnetIds: output.subnetIds !== undefined && output.subnetIds !== null
1862
+ ? deserializeAws_restJson1SubnetIds(output.subnetIds, context)
1863
+ : undefined,
1864
+ };
1865
+ };
1866
+ var deserializeAws_restJson1S3MonitoringConfiguration = function (output, context) {
1867
+ return {
1868
+ encryptionKeyArn: __expectString(output.encryptionKeyArn),
1869
+ logUri: __expectString(output.logUri),
1870
+ };
1871
+ };
1872
+ var deserializeAws_restJson1SecurityGroupIds = function (output, context) {
1873
+ var retVal = (output || [])
1874
+ .filter(function (e) { return e != null; })
1875
+ .map(function (entry) {
1876
+ if (entry === null) {
1877
+ return null;
1878
+ }
1879
+ return __expectString(entry);
1880
+ });
1881
+ return retVal;
1882
+ };
1883
+ var deserializeAws_restJson1SensitivePropertiesMap = function (output, context) {
1884
+ return Object.entries(output).reduce(function (acc, _a) {
1885
+ var _b;
1886
+ var _c = __read(_a, 2), key = _c[0], value = _c[1];
1887
+ if (value === null) {
1888
+ return acc;
1889
+ }
1890
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = __expectString(value), _b));
1891
+ }, {});
1892
+ };
1893
+ var deserializeAws_restJson1SparkSubmit = function (output, context) {
1894
+ return {
1895
+ entryPoint: __expectString(output.entryPoint),
1896
+ entryPointArguments: output.entryPointArguments !== undefined && output.entryPointArguments !== null
1897
+ ? deserializeAws_restJson1EntryPointArguments(output.entryPointArguments, context)
1898
+ : undefined,
1899
+ sparkSubmitParameters: __expectString(output.sparkSubmitParameters),
1900
+ };
1901
+ };
1902
+ var deserializeAws_restJson1SubnetIds = function (output, context) {
1903
+ var retVal = (output || [])
1904
+ .filter(function (e) { return e != null; })
1905
+ .map(function (entry) {
1906
+ if (entry === null) {
1907
+ return null;
1908
+ }
1909
+ return __expectString(entry);
1910
+ });
1911
+ return retVal;
1912
+ };
1913
+ var deserializeAws_restJson1TagMap = function (output, context) {
1914
+ return Object.entries(output).reduce(function (acc, _a) {
1915
+ var _b;
1916
+ var _c = __read(_a, 2), key = _c[0], value = _c[1];
1917
+ if (value === null) {
1918
+ return acc;
1919
+ }
1920
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = __expectString(value), _b));
1921
+ }, {});
1922
+ };
1923
+ var deserializeAws_restJson1TotalResourceUtilization = function (output, context) {
1924
+ return {
1925
+ memoryGBHour: __limitedParseDouble(output.memoryGBHour),
1926
+ storageGBHour: __limitedParseDouble(output.storageGBHour),
1927
+ vCPUHour: __limitedParseDouble(output.vCPUHour),
1928
+ };
1929
+ };
1930
+ var deserializeAws_restJson1WorkerResourceConfig = function (output, context) {
1931
+ return {
1932
+ cpu: __expectString(output.cpu),
1933
+ disk: __expectString(output.disk),
1934
+ memory: __expectString(output.memory),
1935
+ };
1936
+ };
1937
+ var deserializeMetadata = function (output) {
1938
+ var _a;
1939
+ return ({
1940
+ httpStatusCode: output.statusCode,
1941
+ requestId: (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"],
1942
+ extendedRequestId: output.headers["x-amz-id-2"],
1943
+ cfId: output.headers["x-amz-cf-id"],
1944
+ });
1945
+ };
1946
+ var collectBody = function (streamBody, context) {
1947
+ if (streamBody === void 0) { streamBody = new Uint8Array(); }
1948
+ if (streamBody instanceof Uint8Array) {
1949
+ return Promise.resolve(streamBody);
1950
+ }
1951
+ return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
1952
+ };
1953
+ var collectBodyString = function (streamBody, context) {
1954
+ return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
1955
+ };
1956
+ var isSerializableHeaderValue = function (value) {
1957
+ return value !== undefined &&
1958
+ value !== null &&
1959
+ value !== "" &&
1960
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
1961
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
1962
+ };
1963
+ var parseBody = function (streamBody, context) {
1964
+ return collectBodyString(streamBody, context).then(function (encoded) {
1965
+ if (encoded.length) {
1966
+ return JSON.parse(encoded);
1967
+ }
1968
+ return {};
1969
+ });
1970
+ };
1971
+ var loadRestJsonErrorCode = function (output, data) {
1972
+ var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
1973
+ var sanitizeErrorCode = function (rawValue) {
1974
+ var cleanValue = rawValue;
1975
+ if (cleanValue.indexOf(":") >= 0) {
1976
+ cleanValue = cleanValue.split(":")[0];
1977
+ }
1978
+ if (cleanValue.indexOf("#") >= 0) {
1979
+ cleanValue = cleanValue.split("#")[1];
1980
+ }
1981
+ return cleanValue;
1982
+ };
1983
+ var headerKey = findKey(output.headers, "x-amzn-errortype");
1984
+ if (headerKey !== undefined) {
1985
+ return sanitizeErrorCode(output.headers[headerKey]);
1986
+ }
1987
+ if (data.code !== undefined) {
1988
+ return sanitizeErrorCode(data.code);
1989
+ }
1990
+ if (data["__type"] !== undefined) {
1991
+ return sanitizeErrorCode(data["__type"]);
1992
+ }
1993
+ return "";
1994
+ };