@aws-sdk/client-grafana 3.141.0 → 3.150.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.
@@ -11,26 +11,8 @@ const serializeAws_restJson1AssociateLicenseCommand = async (input, context) =>
11
11
  const headers = {};
12
12
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
13
13
  "/workspaces/{workspaceId}/licenses/{licenseType}";
14
- if (input.workspaceId !== undefined) {
15
- const labelValue = input.workspaceId;
16
- if (labelValue.length <= 0) {
17
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
18
- }
19
- resolvedPath = resolvedPath.replace("{workspaceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
20
- }
21
- else {
22
- throw new Error("No value provided for input HTTP label: workspaceId.");
23
- }
24
- if (input.licenseType !== undefined) {
25
- const labelValue = input.licenseType;
26
- if (labelValue.length <= 0) {
27
- throw new Error("Empty value provided for input HTTP label: licenseType.");
28
- }
29
- resolvedPath = resolvedPath.replace("{licenseType}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
30
- }
31
- else {
32
- throw new Error("No value provided for input HTTP label: licenseType.");
33
- }
14
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
15
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "licenseType", () => input.licenseType, "{licenseType}", false);
34
16
  let body;
35
17
  return new protocol_http_1.HttpRequest({
36
18
  protocol,
@@ -91,16 +73,7 @@ const serializeAws_restJson1CreateWorkspaceApiKeyCommand = async (input, context
91
73
  "content-type": "application/json",
92
74
  };
93
75
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces/{workspaceId}/apikeys";
94
- if (input.workspaceId !== undefined) {
95
- const labelValue = input.workspaceId;
96
- if (labelValue.length <= 0) {
97
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
98
- }
99
- resolvedPath = resolvedPath.replace("{workspaceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
100
- }
101
- else {
102
- throw new Error("No value provided for input HTTP label: workspaceId.");
103
- }
76
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
104
77
  let body;
105
78
  body = JSON.stringify({
106
79
  ...(input.keyName != null && { keyName: input.keyName }),
@@ -122,16 +95,7 @@ const serializeAws_restJson1DeleteWorkspaceCommand = async (input, context) => {
122
95
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
123
96
  const headers = {};
124
97
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces/{workspaceId}";
125
- if (input.workspaceId !== undefined) {
126
- const labelValue = input.workspaceId;
127
- if (labelValue.length <= 0) {
128
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
129
- }
130
- resolvedPath = resolvedPath.replace("{workspaceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
131
- }
132
- else {
133
- throw new Error("No value provided for input HTTP label: workspaceId.");
134
- }
98
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
135
99
  let body;
136
100
  return new protocol_http_1.HttpRequest({
137
101
  protocol,
@@ -149,26 +113,8 @@ const serializeAws_restJson1DeleteWorkspaceApiKeyCommand = async (input, context
149
113
  const headers = {};
150
114
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
151
115
  "/workspaces/{workspaceId}/apikeys/{keyName}";
152
- if (input.keyName !== undefined) {
153
- const labelValue = input.keyName;
154
- if (labelValue.length <= 0) {
155
- throw new Error("Empty value provided for input HTTP label: keyName.");
156
- }
157
- resolvedPath = resolvedPath.replace("{keyName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
158
- }
159
- else {
160
- throw new Error("No value provided for input HTTP label: keyName.");
161
- }
162
- if (input.workspaceId !== undefined) {
163
- const labelValue = input.workspaceId;
164
- if (labelValue.length <= 0) {
165
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
166
- }
167
- resolvedPath = resolvedPath.replace("{workspaceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
168
- }
169
- else {
170
- throw new Error("No value provided for input HTTP label: workspaceId.");
171
- }
116
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "keyName", () => input.keyName, "{keyName}", false);
117
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
172
118
  let body;
173
119
  return new protocol_http_1.HttpRequest({
174
120
  protocol,
@@ -185,16 +131,7 @@ const serializeAws_restJson1DescribeWorkspaceCommand = async (input, context) =>
185
131
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
186
132
  const headers = {};
187
133
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces/{workspaceId}";
188
- if (input.workspaceId !== undefined) {
189
- const labelValue = input.workspaceId;
190
- if (labelValue.length <= 0) {
191
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
192
- }
193
- resolvedPath = resolvedPath.replace("{workspaceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
194
- }
195
- else {
196
- throw new Error("No value provided for input HTTP label: workspaceId.");
197
- }
134
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
198
135
  let body;
199
136
  return new protocol_http_1.HttpRequest({
200
137
  protocol,
@@ -211,16 +148,7 @@ const serializeAws_restJson1DescribeWorkspaceAuthenticationCommand = async (inpu
211
148
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
212
149
  const headers = {};
213
150
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces/{workspaceId}/authentication";
214
- if (input.workspaceId !== undefined) {
215
- const labelValue = input.workspaceId;
216
- if (labelValue.length <= 0) {
217
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
218
- }
219
- resolvedPath = resolvedPath.replace("{workspaceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
220
- }
221
- else {
222
- throw new Error("No value provided for input HTTP label: workspaceId.");
223
- }
151
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
224
152
  let body;
225
153
  return new protocol_http_1.HttpRequest({
226
154
  protocol,
@@ -238,26 +166,8 @@ const serializeAws_restJson1DisassociateLicenseCommand = async (input, context)
238
166
  const headers = {};
239
167
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
240
168
  "/workspaces/{workspaceId}/licenses/{licenseType}";
241
- if (input.workspaceId !== undefined) {
242
- const labelValue = input.workspaceId;
243
- if (labelValue.length <= 0) {
244
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
245
- }
246
- resolvedPath = resolvedPath.replace("{workspaceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
247
- }
248
- else {
249
- throw new Error("No value provided for input HTTP label: workspaceId.");
250
- }
251
- if (input.licenseType !== undefined) {
252
- const labelValue = input.licenseType;
253
- if (labelValue.length <= 0) {
254
- throw new Error("Empty value provided for input HTTP label: licenseType.");
255
- }
256
- resolvedPath = resolvedPath.replace("{licenseType}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
257
- }
258
- else {
259
- throw new Error("No value provided for input HTTP label: licenseType.");
260
- }
169
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
170
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "licenseType", () => input.licenseType, "{licenseType}", false);
261
171
  let body;
262
172
  return new protocol_http_1.HttpRequest({
263
173
  protocol,
@@ -274,23 +184,14 @@ const serializeAws_restJson1ListPermissionsCommand = async (input, context) => {
274
184
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
275
185
  const headers = {};
276
186
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces/{workspaceId}/permissions";
277
- if (input.workspaceId !== undefined) {
278
- const labelValue = input.workspaceId;
279
- if (labelValue.length <= 0) {
280
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
281
- }
282
- resolvedPath = resolvedPath.replace("{workspaceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
283
- }
284
- else {
285
- throw new Error("No value provided for input HTTP label: workspaceId.");
286
- }
287
- const query = {
288
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
289
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
290
- ...(input.userType !== undefined && { userType: input.userType }),
291
- ...(input.userId !== undefined && { userId: input.userId }),
292
- ...(input.groupId !== undefined && { groupId: input.groupId }),
293
- };
187
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
188
+ const query = map({
189
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
190
+ nextToken: [, input.nextToken],
191
+ userType: [, input.userType],
192
+ userId: [, input.userId],
193
+ groupId: [, input.groupId],
194
+ });
294
195
  let body;
295
196
  return new protocol_http_1.HttpRequest({
296
197
  protocol,
@@ -308,16 +209,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
308
209
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
309
210
  const headers = {};
310
211
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
311
- if (input.resourceArn !== undefined) {
312
- const labelValue = input.resourceArn;
313
- if (labelValue.length <= 0) {
314
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
315
- }
316
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
317
- }
318
- else {
319
- throw new Error("No value provided for input HTTP label: resourceArn.");
320
- }
212
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
321
213
  let body;
322
214
  return new protocol_http_1.HttpRequest({
323
215
  protocol,
@@ -334,10 +226,10 @@ const serializeAws_restJson1ListWorkspacesCommand = async (input, context) => {
334
226
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
335
227
  const headers = {};
336
228
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces";
337
- const query = {
338
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
339
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
340
- };
229
+ const query = map({
230
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
231
+ nextToken: [, input.nextToken],
232
+ });
341
233
  let body;
342
234
  return new protocol_http_1.HttpRequest({
343
235
  protocol,
@@ -357,16 +249,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
357
249
  "content-type": "application/json",
358
250
  };
359
251
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
360
- if (input.resourceArn !== undefined) {
361
- const labelValue = input.resourceArn;
362
- if (labelValue.length <= 0) {
363
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
364
- }
365
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
366
- }
367
- else {
368
- throw new Error("No value provided for input HTTP label: resourceArn.");
369
- }
252
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
370
253
  let body;
371
254
  body = JSON.stringify({
372
255
  ...(input.tags != null && { tags: serializeAws_restJson1TagMap(input.tags, context) }),
@@ -386,19 +269,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
386
269
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
387
270
  const headers = {};
388
271
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
389
- if (input.resourceArn !== undefined) {
390
- const labelValue = input.resourceArn;
391
- if (labelValue.length <= 0) {
392
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
393
- }
394
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
395
- }
396
- else {
397
- throw new Error("No value provided for input HTTP label: resourceArn.");
398
- }
399
- const query = {
400
- ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }),
401
- };
272
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
273
+ const query = map({
274
+ tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys || []).map((_entry) => _entry)],
275
+ });
402
276
  let body;
403
277
  return new protocol_http_1.HttpRequest({
404
278
  protocol,
@@ -418,16 +292,7 @@ const serializeAws_restJson1UpdatePermissionsCommand = async (input, context) =>
418
292
  "content-type": "application/json",
419
293
  };
420
294
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces/{workspaceId}/permissions";
421
- if (input.workspaceId !== undefined) {
422
- const labelValue = input.workspaceId;
423
- if (labelValue.length <= 0) {
424
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
425
- }
426
- resolvedPath = resolvedPath.replace("{workspaceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
427
- }
428
- else {
429
- throw new Error("No value provided for input HTTP label: workspaceId.");
430
- }
295
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
431
296
  let body;
432
297
  body = JSON.stringify({
433
298
  ...(input.updateInstructionBatch != null && {
@@ -451,16 +316,7 @@ const serializeAws_restJson1UpdateWorkspaceCommand = async (input, context) => {
451
316
  "content-type": "application/json",
452
317
  };
453
318
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces/{workspaceId}";
454
- if (input.workspaceId !== undefined) {
455
- const labelValue = input.workspaceId;
456
- if (labelValue.length <= 0) {
457
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
458
- }
459
- resolvedPath = resolvedPath.replace("{workspaceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
460
- }
461
- else {
462
- throw new Error("No value provided for input HTTP label: workspaceId.");
463
- }
319
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
464
320
  let body;
465
321
  body = JSON.stringify({
466
322
  ...(input.accountAccessType != null && { accountAccessType: input.accountAccessType }),
@@ -497,16 +353,7 @@ const serializeAws_restJson1UpdateWorkspaceAuthenticationCommand = async (input,
497
353
  "content-type": "application/json",
498
354
  };
499
355
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces/{workspaceId}/authentication";
500
- if (input.workspaceId !== undefined) {
501
- const labelValue = input.workspaceId;
502
- if (labelValue.length <= 0) {
503
- throw new Error("Empty value provided for input HTTP label: workspaceId.");
504
- }
505
- resolvedPath = resolvedPath.replace("{workspaceId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
506
- }
507
- else {
508
- throw new Error("No value provided for input HTTP label: workspaceId.");
509
- }
356
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
510
357
  let body;
511
358
  body = JSON.stringify({
512
359
  ...(input.authenticationProviders != null && {
@@ -531,15 +378,14 @@ const deserializeAws_restJson1AssociateLicenseCommand = async (output, context)
531
378
  if (output.statusCode !== 202 && output.statusCode >= 300) {
532
379
  return deserializeAws_restJson1AssociateLicenseCommandError(output, context);
533
380
  }
534
- const contents = {
381
+ const contents = map({
535
382
  $metadata: deserializeMetadata(output),
536
- workspace: undefined,
537
- };
383
+ });
538
384
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
539
- if (data.workspace !== undefined && data.workspace !== null) {
385
+ if (data.workspace != null) {
540
386
  contents.workspace = deserializeAws_restJson1WorkspaceDescription(data.workspace, context);
541
387
  }
542
- return Promise.resolve(contents);
388
+ return contents;
543
389
  };
544
390
  exports.deserializeAws_restJson1AssociateLicenseCommand = deserializeAws_restJson1AssociateLicenseCommand;
545
391
  const deserializeAws_restJson1AssociateLicenseCommandError = async (output, context) => {
@@ -547,7 +393,6 @@ const deserializeAws_restJson1AssociateLicenseCommandError = async (output, cont
547
393
  ...output,
548
394
  body: await parseBody(output.body, context),
549
395
  };
550
- let response;
551
396
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
552
397
  switch (errorCode) {
553
398
  case "AccessDeniedException":
@@ -567,29 +412,26 @@ const deserializeAws_restJson1AssociateLicenseCommandError = async (output, cont
567
412
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
568
413
  default:
569
414
  const parsedBody = parsedOutput.body;
570
- const $metadata = deserializeMetadata(output);
571
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
572
- response = new GrafanaServiceException_1.GrafanaServiceException({
573
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
574
- $fault: "client",
575
- $metadata,
415
+ (0, smithy_client_1.throwDefaultError)({
416
+ output,
417
+ parsedBody,
418
+ exceptionCtor: GrafanaServiceException_1.GrafanaServiceException,
419
+ errorCode,
576
420
  });
577
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
578
421
  }
579
422
  };
580
423
  const deserializeAws_restJson1CreateWorkspaceCommand = async (output, context) => {
581
424
  if (output.statusCode !== 202 && output.statusCode >= 300) {
582
425
  return deserializeAws_restJson1CreateWorkspaceCommandError(output, context);
583
426
  }
584
- const contents = {
427
+ const contents = map({
585
428
  $metadata: deserializeMetadata(output),
586
- workspace: undefined,
587
- };
429
+ });
588
430
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
589
- if (data.workspace !== undefined && data.workspace !== null) {
431
+ if (data.workspace != null) {
590
432
  contents.workspace = deserializeAws_restJson1WorkspaceDescription(data.workspace, context);
591
433
  }
592
- return Promise.resolve(contents);
434
+ return contents;
593
435
  };
594
436
  exports.deserializeAws_restJson1CreateWorkspaceCommand = deserializeAws_restJson1CreateWorkspaceCommand;
595
437
  const deserializeAws_restJson1CreateWorkspaceCommandError = async (output, context) => {
@@ -597,7 +439,6 @@ const deserializeAws_restJson1CreateWorkspaceCommandError = async (output, conte
597
439
  ...output,
598
440
  body: await parseBody(output.body, context),
599
441
  };
600
- let response;
601
442
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
602
443
  switch (errorCode) {
603
444
  case "AccessDeniedException":
@@ -620,37 +461,32 @@ const deserializeAws_restJson1CreateWorkspaceCommandError = async (output, conte
620
461
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
621
462
  default:
622
463
  const parsedBody = parsedOutput.body;
623
- const $metadata = deserializeMetadata(output);
624
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
625
- response = new GrafanaServiceException_1.GrafanaServiceException({
626
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
627
- $fault: "client",
628
- $metadata,
464
+ (0, smithy_client_1.throwDefaultError)({
465
+ output,
466
+ parsedBody,
467
+ exceptionCtor: GrafanaServiceException_1.GrafanaServiceException,
468
+ errorCode,
629
469
  });
630
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
631
470
  }
632
471
  };
633
472
  const deserializeAws_restJson1CreateWorkspaceApiKeyCommand = async (output, context) => {
634
473
  if (output.statusCode !== 200 && output.statusCode >= 300) {
635
474
  return deserializeAws_restJson1CreateWorkspaceApiKeyCommandError(output, context);
636
475
  }
637
- const contents = {
476
+ const contents = map({
638
477
  $metadata: deserializeMetadata(output),
639
- key: undefined,
640
- keyName: undefined,
641
- workspaceId: undefined,
642
- };
478
+ });
643
479
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
644
- if (data.key !== undefined && data.key !== null) {
480
+ if (data.key != null) {
645
481
  contents.key = (0, smithy_client_1.expectString)(data.key);
646
482
  }
647
- if (data.keyName !== undefined && data.keyName !== null) {
483
+ if (data.keyName != null) {
648
484
  contents.keyName = (0, smithy_client_1.expectString)(data.keyName);
649
485
  }
650
- if (data.workspaceId !== undefined && data.workspaceId !== null) {
486
+ if (data.workspaceId != null) {
651
487
  contents.workspaceId = (0, smithy_client_1.expectString)(data.workspaceId);
652
488
  }
653
- return Promise.resolve(contents);
489
+ return contents;
654
490
  };
655
491
  exports.deserializeAws_restJson1CreateWorkspaceApiKeyCommand = deserializeAws_restJson1CreateWorkspaceApiKeyCommand;
656
492
  const deserializeAws_restJson1CreateWorkspaceApiKeyCommandError = async (output, context) => {
@@ -658,7 +494,6 @@ const deserializeAws_restJson1CreateWorkspaceApiKeyCommandError = async (output,
658
494
  ...output,
659
495
  body: await parseBody(output.body, context),
660
496
  };
661
- let response;
662
497
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
663
498
  switch (errorCode) {
664
499
  case "AccessDeniedException":
@@ -684,29 +519,26 @@ const deserializeAws_restJson1CreateWorkspaceApiKeyCommandError = async (output,
684
519
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
685
520
  default:
686
521
  const parsedBody = parsedOutput.body;
687
- const $metadata = deserializeMetadata(output);
688
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
689
- response = new GrafanaServiceException_1.GrafanaServiceException({
690
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
691
- $fault: "client",
692
- $metadata,
522
+ (0, smithy_client_1.throwDefaultError)({
523
+ output,
524
+ parsedBody,
525
+ exceptionCtor: GrafanaServiceException_1.GrafanaServiceException,
526
+ errorCode,
693
527
  });
694
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
695
528
  }
696
529
  };
697
530
  const deserializeAws_restJson1DeleteWorkspaceCommand = async (output, context) => {
698
531
  if (output.statusCode !== 202 && output.statusCode >= 300) {
699
532
  return deserializeAws_restJson1DeleteWorkspaceCommandError(output, context);
700
533
  }
701
- const contents = {
534
+ const contents = map({
702
535
  $metadata: deserializeMetadata(output),
703
- workspace: undefined,
704
- };
536
+ });
705
537
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
706
- if (data.workspace !== undefined && data.workspace !== null) {
538
+ if (data.workspace != null) {
707
539
  contents.workspace = deserializeAws_restJson1WorkspaceDescription(data.workspace, context);
708
540
  }
709
- return Promise.resolve(contents);
541
+ return contents;
710
542
  };
711
543
  exports.deserializeAws_restJson1DeleteWorkspaceCommand = deserializeAws_restJson1DeleteWorkspaceCommand;
712
544
  const deserializeAws_restJson1DeleteWorkspaceCommandError = async (output, context) => {
@@ -714,7 +546,6 @@ const deserializeAws_restJson1DeleteWorkspaceCommandError = async (output, conte
714
546
  ...output,
715
547
  body: await parseBody(output.body, context),
716
548
  };
717
- let response;
718
549
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
719
550
  switch (errorCode) {
720
551
  case "AccessDeniedException":
@@ -737,33 +568,29 @@ const deserializeAws_restJson1DeleteWorkspaceCommandError = async (output, conte
737
568
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
738
569
  default:
739
570
  const parsedBody = parsedOutput.body;
740
- const $metadata = deserializeMetadata(output);
741
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
742
- response = new GrafanaServiceException_1.GrafanaServiceException({
743
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
744
- $fault: "client",
745
- $metadata,
571
+ (0, smithy_client_1.throwDefaultError)({
572
+ output,
573
+ parsedBody,
574
+ exceptionCtor: GrafanaServiceException_1.GrafanaServiceException,
575
+ errorCode,
746
576
  });
747
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
748
577
  }
749
578
  };
750
579
  const deserializeAws_restJson1DeleteWorkspaceApiKeyCommand = async (output, context) => {
751
580
  if (output.statusCode !== 200 && output.statusCode >= 300) {
752
581
  return deserializeAws_restJson1DeleteWorkspaceApiKeyCommandError(output, context);
753
582
  }
754
- const contents = {
583
+ const contents = map({
755
584
  $metadata: deserializeMetadata(output),
756
- keyName: undefined,
757
- workspaceId: undefined,
758
- };
585
+ });
759
586
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
760
- if (data.keyName !== undefined && data.keyName !== null) {
587
+ if (data.keyName != null) {
761
588
  contents.keyName = (0, smithy_client_1.expectString)(data.keyName);
762
589
  }
763
- if (data.workspaceId !== undefined && data.workspaceId !== null) {
590
+ if (data.workspaceId != null) {
764
591
  contents.workspaceId = (0, smithy_client_1.expectString)(data.workspaceId);
765
592
  }
766
- return Promise.resolve(contents);
593
+ return contents;
767
594
  };
768
595
  exports.deserializeAws_restJson1DeleteWorkspaceApiKeyCommand = deserializeAws_restJson1DeleteWorkspaceApiKeyCommand;
769
596
  const deserializeAws_restJson1DeleteWorkspaceApiKeyCommandError = async (output, context) => {
@@ -771,7 +598,6 @@ const deserializeAws_restJson1DeleteWorkspaceApiKeyCommandError = async (output,
771
598
  ...output,
772
599
  body: await parseBody(output.body, context),
773
600
  };
774
- let response;
775
601
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
776
602
  switch (errorCode) {
777
603
  case "AccessDeniedException":
@@ -794,29 +620,26 @@ const deserializeAws_restJson1DeleteWorkspaceApiKeyCommandError = async (output,
794
620
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
795
621
  default:
796
622
  const parsedBody = parsedOutput.body;
797
- const $metadata = deserializeMetadata(output);
798
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
799
- response = new GrafanaServiceException_1.GrafanaServiceException({
800
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
801
- $fault: "client",
802
- $metadata,
623
+ (0, smithy_client_1.throwDefaultError)({
624
+ output,
625
+ parsedBody,
626
+ exceptionCtor: GrafanaServiceException_1.GrafanaServiceException,
627
+ errorCode,
803
628
  });
804
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
805
629
  }
806
630
  };
807
631
  const deserializeAws_restJson1DescribeWorkspaceCommand = async (output, context) => {
808
632
  if (output.statusCode !== 200 && output.statusCode >= 300) {
809
633
  return deserializeAws_restJson1DescribeWorkspaceCommandError(output, context);
810
634
  }
811
- const contents = {
635
+ const contents = map({
812
636
  $metadata: deserializeMetadata(output),
813
- workspace: undefined,
814
- };
637
+ });
815
638
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
816
- if (data.workspace !== undefined && data.workspace !== null) {
639
+ if (data.workspace != null) {
817
640
  contents.workspace = deserializeAws_restJson1WorkspaceDescription(data.workspace, context);
818
641
  }
819
- return Promise.resolve(contents);
642
+ return contents;
820
643
  };
821
644
  exports.deserializeAws_restJson1DescribeWorkspaceCommand = deserializeAws_restJson1DescribeWorkspaceCommand;
822
645
  const deserializeAws_restJson1DescribeWorkspaceCommandError = async (output, context) => {
@@ -824,7 +647,6 @@ const deserializeAws_restJson1DescribeWorkspaceCommandError = async (output, con
824
647
  ...output,
825
648
  body: await parseBody(output.body, context),
826
649
  };
827
- let response;
828
650
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
829
651
  switch (errorCode) {
830
652
  case "AccessDeniedException":
@@ -844,29 +666,26 @@ const deserializeAws_restJson1DescribeWorkspaceCommandError = async (output, con
844
666
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
845
667
  default:
846
668
  const parsedBody = parsedOutput.body;
847
- const $metadata = deserializeMetadata(output);
848
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
849
- response = new GrafanaServiceException_1.GrafanaServiceException({
850
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
851
- $fault: "client",
852
- $metadata,
669
+ (0, smithy_client_1.throwDefaultError)({
670
+ output,
671
+ parsedBody,
672
+ exceptionCtor: GrafanaServiceException_1.GrafanaServiceException,
673
+ errorCode,
853
674
  });
854
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
855
675
  }
856
676
  };
857
677
  const deserializeAws_restJson1DescribeWorkspaceAuthenticationCommand = async (output, context) => {
858
678
  if (output.statusCode !== 200 && output.statusCode >= 300) {
859
679
  return deserializeAws_restJson1DescribeWorkspaceAuthenticationCommandError(output, context);
860
680
  }
861
- const contents = {
681
+ const contents = map({
862
682
  $metadata: deserializeMetadata(output),
863
- authentication: undefined,
864
- };
683
+ });
865
684
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
866
- if (data.authentication !== undefined && data.authentication !== null) {
685
+ if (data.authentication != null) {
867
686
  contents.authentication = deserializeAws_restJson1AuthenticationDescription(data.authentication, context);
868
687
  }
869
- return Promise.resolve(contents);
688
+ return contents;
870
689
  };
871
690
  exports.deserializeAws_restJson1DescribeWorkspaceAuthenticationCommand = deserializeAws_restJson1DescribeWorkspaceAuthenticationCommand;
872
691
  const deserializeAws_restJson1DescribeWorkspaceAuthenticationCommandError = async (output, context) => {
@@ -874,7 +693,6 @@ const deserializeAws_restJson1DescribeWorkspaceAuthenticationCommandError = asyn
874
693
  ...output,
875
694
  body: await parseBody(output.body, context),
876
695
  };
877
- let response;
878
696
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
879
697
  switch (errorCode) {
880
698
  case "AccessDeniedException":
@@ -894,29 +712,26 @@ const deserializeAws_restJson1DescribeWorkspaceAuthenticationCommandError = asyn
894
712
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
895
713
  default:
896
714
  const parsedBody = parsedOutput.body;
897
- const $metadata = deserializeMetadata(output);
898
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
899
- response = new GrafanaServiceException_1.GrafanaServiceException({
900
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
901
- $fault: "client",
902
- $metadata,
715
+ (0, smithy_client_1.throwDefaultError)({
716
+ output,
717
+ parsedBody,
718
+ exceptionCtor: GrafanaServiceException_1.GrafanaServiceException,
719
+ errorCode,
903
720
  });
904
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
905
721
  }
906
722
  };
907
723
  const deserializeAws_restJson1DisassociateLicenseCommand = async (output, context) => {
908
724
  if (output.statusCode !== 202 && output.statusCode >= 300) {
909
725
  return deserializeAws_restJson1DisassociateLicenseCommandError(output, context);
910
726
  }
911
- const contents = {
727
+ const contents = map({
912
728
  $metadata: deserializeMetadata(output),
913
- workspace: undefined,
914
- };
729
+ });
915
730
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
916
- if (data.workspace !== undefined && data.workspace !== null) {
731
+ if (data.workspace != null) {
917
732
  contents.workspace = deserializeAws_restJson1WorkspaceDescription(data.workspace, context);
918
733
  }
919
- return Promise.resolve(contents);
734
+ return contents;
920
735
  };
921
736
  exports.deserializeAws_restJson1DisassociateLicenseCommand = deserializeAws_restJson1DisassociateLicenseCommand;
922
737
  const deserializeAws_restJson1DisassociateLicenseCommandError = async (output, context) => {
@@ -924,7 +739,6 @@ const deserializeAws_restJson1DisassociateLicenseCommandError = async (output, c
924
739
  ...output,
925
740
  body: await parseBody(output.body, context),
926
741
  };
927
- let response;
928
742
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
929
743
  switch (errorCode) {
930
744
  case "AccessDeniedException":
@@ -944,33 +758,29 @@ const deserializeAws_restJson1DisassociateLicenseCommandError = async (output, c
944
758
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
945
759
  default:
946
760
  const parsedBody = parsedOutput.body;
947
- const $metadata = deserializeMetadata(output);
948
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
949
- response = new GrafanaServiceException_1.GrafanaServiceException({
950
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
951
- $fault: "client",
952
- $metadata,
761
+ (0, smithy_client_1.throwDefaultError)({
762
+ output,
763
+ parsedBody,
764
+ exceptionCtor: GrafanaServiceException_1.GrafanaServiceException,
765
+ errorCode,
953
766
  });
954
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
955
767
  }
956
768
  };
957
769
  const deserializeAws_restJson1ListPermissionsCommand = async (output, context) => {
958
770
  if (output.statusCode !== 200 && output.statusCode >= 300) {
959
771
  return deserializeAws_restJson1ListPermissionsCommandError(output, context);
960
772
  }
961
- const contents = {
773
+ const contents = map({
962
774
  $metadata: deserializeMetadata(output),
963
- nextToken: undefined,
964
- permissions: undefined,
965
- };
775
+ });
966
776
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
967
- if (data.nextToken !== undefined && data.nextToken !== null) {
777
+ if (data.nextToken != null) {
968
778
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
969
779
  }
970
- if (data.permissions !== undefined && data.permissions !== null) {
780
+ if (data.permissions != null) {
971
781
  contents.permissions = deserializeAws_restJson1PermissionEntryList(data.permissions, context);
972
782
  }
973
- return Promise.resolve(contents);
783
+ return contents;
974
784
  };
975
785
  exports.deserializeAws_restJson1ListPermissionsCommand = deserializeAws_restJson1ListPermissionsCommand;
976
786
  const deserializeAws_restJson1ListPermissionsCommandError = async (output, context) => {
@@ -978,7 +788,6 @@ const deserializeAws_restJson1ListPermissionsCommandError = async (output, conte
978
788
  ...output,
979
789
  body: await parseBody(output.body, context),
980
790
  };
981
- let response;
982
791
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
983
792
  switch (errorCode) {
984
793
  case "AccessDeniedException":
@@ -998,29 +807,26 @@ const deserializeAws_restJson1ListPermissionsCommandError = async (output, conte
998
807
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
999
808
  default:
1000
809
  const parsedBody = parsedOutput.body;
1001
- const $metadata = deserializeMetadata(output);
1002
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1003
- response = new GrafanaServiceException_1.GrafanaServiceException({
1004
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1005
- $fault: "client",
1006
- $metadata,
810
+ (0, smithy_client_1.throwDefaultError)({
811
+ output,
812
+ parsedBody,
813
+ exceptionCtor: GrafanaServiceException_1.GrafanaServiceException,
814
+ errorCode,
1007
815
  });
1008
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1009
816
  }
1010
817
  };
1011
818
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
1012
819
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1013
820
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
1014
821
  }
1015
- const contents = {
822
+ const contents = map({
1016
823
  $metadata: deserializeMetadata(output),
1017
- tags: undefined,
1018
- };
824
+ });
1019
825
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1020
- if (data.tags !== undefined && data.tags !== null) {
826
+ if (data.tags != null) {
1021
827
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
1022
828
  }
1023
- return Promise.resolve(contents);
829
+ return contents;
1024
830
  };
1025
831
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
1026
832
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -1028,7 +834,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1028
834
  ...output,
1029
835
  body: await parseBody(output.body, context),
1030
836
  };
1031
- let response;
1032
837
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1033
838
  switch (errorCode) {
1034
839
  case "AccessDeniedException":
@@ -1048,33 +853,29 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1048
853
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1049
854
  default:
1050
855
  const parsedBody = parsedOutput.body;
1051
- const $metadata = deserializeMetadata(output);
1052
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1053
- response = new GrafanaServiceException_1.GrafanaServiceException({
1054
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1055
- $fault: "client",
1056
- $metadata,
856
+ (0, smithy_client_1.throwDefaultError)({
857
+ output,
858
+ parsedBody,
859
+ exceptionCtor: GrafanaServiceException_1.GrafanaServiceException,
860
+ errorCode,
1057
861
  });
1058
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1059
862
  }
1060
863
  };
1061
864
  const deserializeAws_restJson1ListWorkspacesCommand = async (output, context) => {
1062
865
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1063
866
  return deserializeAws_restJson1ListWorkspacesCommandError(output, context);
1064
867
  }
1065
- const contents = {
868
+ const contents = map({
1066
869
  $metadata: deserializeMetadata(output),
1067
- nextToken: undefined,
1068
- workspaces: undefined,
1069
- };
870
+ });
1070
871
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1071
- if (data.nextToken !== undefined && data.nextToken !== null) {
872
+ if (data.nextToken != null) {
1072
873
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1073
874
  }
1074
- if (data.workspaces !== undefined && data.workspaces !== null) {
875
+ if (data.workspaces != null) {
1075
876
  contents.workspaces = deserializeAws_restJson1WorkspaceList(data.workspaces, context);
1076
877
  }
1077
- return Promise.resolve(contents);
878
+ return contents;
1078
879
  };
1079
880
  exports.deserializeAws_restJson1ListWorkspacesCommand = deserializeAws_restJson1ListWorkspacesCommand;
1080
881
  const deserializeAws_restJson1ListWorkspacesCommandError = async (output, context) => {
@@ -1082,7 +883,6 @@ const deserializeAws_restJson1ListWorkspacesCommandError = async (output, contex
1082
883
  ...output,
1083
884
  body: await parseBody(output.body, context),
1084
885
  };
1085
- let response;
1086
886
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1087
887
  switch (errorCode) {
1088
888
  case "AccessDeniedException":
@@ -1096,25 +896,23 @@ const deserializeAws_restJson1ListWorkspacesCommandError = async (output, contex
1096
896
  throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1097
897
  default:
1098
898
  const parsedBody = parsedOutput.body;
1099
- const $metadata = deserializeMetadata(output);
1100
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1101
- response = new GrafanaServiceException_1.GrafanaServiceException({
1102
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1103
- $fault: "client",
1104
- $metadata,
899
+ (0, smithy_client_1.throwDefaultError)({
900
+ output,
901
+ parsedBody,
902
+ exceptionCtor: GrafanaServiceException_1.GrafanaServiceException,
903
+ errorCode,
1105
904
  });
1106
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1107
905
  }
1108
906
  };
1109
907
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
1110
908
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1111
909
  return deserializeAws_restJson1TagResourceCommandError(output, context);
1112
910
  }
1113
- const contents = {
911
+ const contents = map({
1114
912
  $metadata: deserializeMetadata(output),
1115
- };
913
+ });
1116
914
  await collectBody(output.body, context);
1117
- return Promise.resolve(contents);
915
+ return contents;
1118
916
  };
1119
917
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
1120
918
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -1122,7 +920,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1122
920
  ...output,
1123
921
  body: await parseBody(output.body, context),
1124
922
  };
1125
- let response;
1126
923
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1127
924
  switch (errorCode) {
1128
925
  case "AccessDeniedException":
@@ -1142,25 +939,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1142
939
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1143
940
  default:
1144
941
  const parsedBody = parsedOutput.body;
1145
- const $metadata = deserializeMetadata(output);
1146
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1147
- response = new GrafanaServiceException_1.GrafanaServiceException({
1148
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1149
- $fault: "client",
1150
- $metadata,
942
+ (0, smithy_client_1.throwDefaultError)({
943
+ output,
944
+ parsedBody,
945
+ exceptionCtor: GrafanaServiceException_1.GrafanaServiceException,
946
+ errorCode,
1151
947
  });
1152
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1153
948
  }
1154
949
  };
1155
950
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
1156
951
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1157
952
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
1158
953
  }
1159
- const contents = {
954
+ const contents = map({
1160
955
  $metadata: deserializeMetadata(output),
1161
- };
956
+ });
1162
957
  await collectBody(output.body, context);
1163
- return Promise.resolve(contents);
958
+ return contents;
1164
959
  };
1165
960
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
1166
961
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -1168,7 +963,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1168
963
  ...output,
1169
964
  body: await parseBody(output.body, context),
1170
965
  };
1171
- let response;
1172
966
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1173
967
  switch (errorCode) {
1174
968
  case "AccessDeniedException":
@@ -1188,29 +982,26 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1188
982
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1189
983
  default:
1190
984
  const parsedBody = parsedOutput.body;
1191
- const $metadata = deserializeMetadata(output);
1192
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1193
- response = new GrafanaServiceException_1.GrafanaServiceException({
1194
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1195
- $fault: "client",
1196
- $metadata,
985
+ (0, smithy_client_1.throwDefaultError)({
986
+ output,
987
+ parsedBody,
988
+ exceptionCtor: GrafanaServiceException_1.GrafanaServiceException,
989
+ errorCode,
1197
990
  });
1198
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1199
991
  }
1200
992
  };
1201
993
  const deserializeAws_restJson1UpdatePermissionsCommand = async (output, context) => {
1202
994
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1203
995
  return deserializeAws_restJson1UpdatePermissionsCommandError(output, context);
1204
996
  }
1205
- const contents = {
997
+ const contents = map({
1206
998
  $metadata: deserializeMetadata(output),
1207
- errors: undefined,
1208
- };
999
+ });
1209
1000
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1210
- if (data.errors !== undefined && data.errors !== null) {
1001
+ if (data.errors != null) {
1211
1002
  contents.errors = deserializeAws_restJson1UpdateErrorList(data.errors, context);
1212
1003
  }
1213
- return Promise.resolve(contents);
1004
+ return contents;
1214
1005
  };
1215
1006
  exports.deserializeAws_restJson1UpdatePermissionsCommand = deserializeAws_restJson1UpdatePermissionsCommand;
1216
1007
  const deserializeAws_restJson1UpdatePermissionsCommandError = async (output, context) => {
@@ -1218,7 +1009,6 @@ const deserializeAws_restJson1UpdatePermissionsCommandError = async (output, con
1218
1009
  ...output,
1219
1010
  body: await parseBody(output.body, context),
1220
1011
  };
1221
- let response;
1222
1012
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1223
1013
  switch (errorCode) {
1224
1014
  case "AccessDeniedException":
@@ -1238,29 +1028,26 @@ const deserializeAws_restJson1UpdatePermissionsCommandError = async (output, con
1238
1028
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1239
1029
  default:
1240
1030
  const parsedBody = parsedOutput.body;
1241
- const $metadata = deserializeMetadata(output);
1242
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1243
- response = new GrafanaServiceException_1.GrafanaServiceException({
1244
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1245
- $fault: "client",
1246
- $metadata,
1031
+ (0, smithy_client_1.throwDefaultError)({
1032
+ output,
1033
+ parsedBody,
1034
+ exceptionCtor: GrafanaServiceException_1.GrafanaServiceException,
1035
+ errorCode,
1247
1036
  });
1248
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1249
1037
  }
1250
1038
  };
1251
1039
  const deserializeAws_restJson1UpdateWorkspaceCommand = async (output, context) => {
1252
1040
  if (output.statusCode !== 202 && output.statusCode >= 300) {
1253
1041
  return deserializeAws_restJson1UpdateWorkspaceCommandError(output, context);
1254
1042
  }
1255
- const contents = {
1043
+ const contents = map({
1256
1044
  $metadata: deserializeMetadata(output),
1257
- workspace: undefined,
1258
- };
1045
+ });
1259
1046
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1260
- if (data.workspace !== undefined && data.workspace !== null) {
1047
+ if (data.workspace != null) {
1261
1048
  contents.workspace = deserializeAws_restJson1WorkspaceDescription(data.workspace, context);
1262
1049
  }
1263
- return Promise.resolve(contents);
1050
+ return contents;
1264
1051
  };
1265
1052
  exports.deserializeAws_restJson1UpdateWorkspaceCommand = deserializeAws_restJson1UpdateWorkspaceCommand;
1266
1053
  const deserializeAws_restJson1UpdateWorkspaceCommandError = async (output, context) => {
@@ -1268,7 +1055,6 @@ const deserializeAws_restJson1UpdateWorkspaceCommandError = async (output, conte
1268
1055
  ...output,
1269
1056
  body: await parseBody(output.body, context),
1270
1057
  };
1271
- let response;
1272
1058
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1273
1059
  switch (errorCode) {
1274
1060
  case "AccessDeniedException":
@@ -1291,29 +1077,26 @@ const deserializeAws_restJson1UpdateWorkspaceCommandError = async (output, conte
1291
1077
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1292
1078
  default:
1293
1079
  const parsedBody = parsedOutput.body;
1294
- const $metadata = deserializeMetadata(output);
1295
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1296
- response = new GrafanaServiceException_1.GrafanaServiceException({
1297
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1298
- $fault: "client",
1299
- $metadata,
1080
+ (0, smithy_client_1.throwDefaultError)({
1081
+ output,
1082
+ parsedBody,
1083
+ exceptionCtor: GrafanaServiceException_1.GrafanaServiceException,
1084
+ errorCode,
1300
1085
  });
1301
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1302
1086
  }
1303
1087
  };
1304
1088
  const deserializeAws_restJson1UpdateWorkspaceAuthenticationCommand = async (output, context) => {
1305
1089
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1306
1090
  return deserializeAws_restJson1UpdateWorkspaceAuthenticationCommandError(output, context);
1307
1091
  }
1308
- const contents = {
1092
+ const contents = map({
1309
1093
  $metadata: deserializeMetadata(output),
1310
- authentication: undefined,
1311
- };
1094
+ });
1312
1095
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1313
- if (data.authentication !== undefined && data.authentication !== null) {
1096
+ if (data.authentication != null) {
1314
1097
  contents.authentication = deserializeAws_restJson1AuthenticationDescription(data.authentication, context);
1315
1098
  }
1316
- return Promise.resolve(contents);
1099
+ return contents;
1317
1100
  };
1318
1101
  exports.deserializeAws_restJson1UpdateWorkspaceAuthenticationCommand = deserializeAws_restJson1UpdateWorkspaceAuthenticationCommand;
1319
1102
  const deserializeAws_restJson1UpdateWorkspaceAuthenticationCommandError = async (output, context) => {
@@ -1321,7 +1104,6 @@ const deserializeAws_restJson1UpdateWorkspaceAuthenticationCommandError = async
1321
1104
  ...output,
1322
1105
  body: await parseBody(output.body, context),
1323
1106
  };
1324
- let response;
1325
1107
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1326
1108
  switch (errorCode) {
1327
1109
  case "AccessDeniedException":
@@ -1344,20 +1126,19 @@ const deserializeAws_restJson1UpdateWorkspaceAuthenticationCommandError = async
1344
1126
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1345
1127
  default:
1346
1128
  const parsedBody = parsedOutput.body;
1347
- const $metadata = deserializeMetadata(output);
1348
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1349
- response = new GrafanaServiceException_1.GrafanaServiceException({
1350
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1351
- $fault: "client",
1352
- $metadata,
1129
+ (0, smithy_client_1.throwDefaultError)({
1130
+ output,
1131
+ parsedBody,
1132
+ exceptionCtor: GrafanaServiceException_1.GrafanaServiceException,
1133
+ errorCode,
1353
1134
  });
1354
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1355
1135
  }
1356
1136
  };
1137
+ const map = smithy_client_1.map;
1357
1138
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
1358
- const contents = {};
1139
+ const contents = map({});
1359
1140
  const data = parsedOutput.body;
1360
- if (data.message !== undefined && data.message !== null) {
1141
+ if (data.message != null) {
1361
1142
  contents.message = (0, smithy_client_1.expectString)(data.message);
1362
1143
  }
1363
1144
  const exception = new models_0_1.AccessDeniedException({
@@ -1367,15 +1148,15 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
1367
1148
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1368
1149
  };
1369
1150
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
1370
- const contents = {};
1151
+ const contents = map({});
1371
1152
  const data = parsedOutput.body;
1372
- if (data.message !== undefined && data.message !== null) {
1153
+ if (data.message != null) {
1373
1154
  contents.message = (0, smithy_client_1.expectString)(data.message);
1374
1155
  }
1375
- if (data.resourceId !== undefined && data.resourceId !== null) {
1156
+ if (data.resourceId != null) {
1376
1157
  contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
1377
1158
  }
1378
- if (data.resourceType !== undefined && data.resourceType !== null) {
1159
+ if (data.resourceType != null) {
1379
1160
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
1380
1161
  }
1381
1162
  const exception = new models_0_1.ConflictException({
@@ -1385,12 +1166,14 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
1385
1166
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1386
1167
  };
1387
1168
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
1388
- const contents = {};
1389
- if (parsedOutput.headers["retry-after"] !== undefined) {
1390
- contents.retryAfterSeconds = (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]);
1391
- }
1169
+ const contents = map({
1170
+ retryAfterSeconds: [
1171
+ () => void 0 !== parsedOutput.headers["retry-after"],
1172
+ () => (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]),
1173
+ ],
1174
+ });
1392
1175
  const data = parsedOutput.body;
1393
- if (data.message !== undefined && data.message !== null) {
1176
+ if (data.message != null) {
1394
1177
  contents.message = (0, smithy_client_1.expectString)(data.message);
1395
1178
  }
1396
1179
  const exception = new models_0_1.InternalServerException({
@@ -1400,15 +1183,15 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
1400
1183
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1401
1184
  };
1402
1185
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1403
- const contents = {};
1186
+ const contents = map({});
1404
1187
  const data = parsedOutput.body;
1405
- if (data.message !== undefined && data.message !== null) {
1188
+ if (data.message != null) {
1406
1189
  contents.message = (0, smithy_client_1.expectString)(data.message);
1407
1190
  }
1408
- if (data.resourceId !== undefined && data.resourceId !== null) {
1191
+ if (data.resourceId != null) {
1409
1192
  contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
1410
1193
  }
1411
- if (data.resourceType !== undefined && data.resourceType !== null) {
1194
+ if (data.resourceType != null) {
1412
1195
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
1413
1196
  }
1414
1197
  const exception = new models_0_1.ResourceNotFoundException({
@@ -1418,21 +1201,21 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
1418
1201
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1419
1202
  };
1420
1203
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
1421
- const contents = {};
1204
+ const contents = map({});
1422
1205
  const data = parsedOutput.body;
1423
- if (data.message !== undefined && data.message !== null) {
1206
+ if (data.message != null) {
1424
1207
  contents.message = (0, smithy_client_1.expectString)(data.message);
1425
1208
  }
1426
- if (data.quotaCode !== undefined && data.quotaCode !== null) {
1209
+ if (data.quotaCode != null) {
1427
1210
  contents.quotaCode = (0, smithy_client_1.expectString)(data.quotaCode);
1428
1211
  }
1429
- if (data.resourceId !== undefined && data.resourceId !== null) {
1212
+ if (data.resourceId != null) {
1430
1213
  contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
1431
1214
  }
1432
- if (data.resourceType !== undefined && data.resourceType !== null) {
1215
+ if (data.resourceType != null) {
1433
1216
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
1434
1217
  }
1435
- if (data.serviceCode !== undefined && data.serviceCode !== null) {
1218
+ if (data.serviceCode != null) {
1436
1219
  contents.serviceCode = (0, smithy_client_1.expectString)(data.serviceCode);
1437
1220
  }
1438
1221
  const exception = new models_0_1.ServiceQuotaExceededException({
@@ -1442,18 +1225,20 @@ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (par
1442
1225
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1443
1226
  };
1444
1227
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
1445
- const contents = {};
1446
- if (parsedOutput.headers["retry-after"] !== undefined) {
1447
- contents.retryAfterSeconds = (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]);
1448
- }
1228
+ const contents = map({
1229
+ retryAfterSeconds: [
1230
+ () => void 0 !== parsedOutput.headers["retry-after"],
1231
+ () => (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]),
1232
+ ],
1233
+ });
1449
1234
  const data = parsedOutput.body;
1450
- if (data.message !== undefined && data.message !== null) {
1235
+ if (data.message != null) {
1451
1236
  contents.message = (0, smithy_client_1.expectString)(data.message);
1452
1237
  }
1453
- if (data.quotaCode !== undefined && data.quotaCode !== null) {
1238
+ if (data.quotaCode != null) {
1454
1239
  contents.quotaCode = (0, smithy_client_1.expectString)(data.quotaCode);
1455
1240
  }
1456
- if (data.serviceCode !== undefined && data.serviceCode !== null) {
1241
+ if (data.serviceCode != null) {
1457
1242
  contents.serviceCode = (0, smithy_client_1.expectString)(data.serviceCode);
1458
1243
  }
1459
1244
  const exception = new models_0_1.ThrottlingException({
@@ -1463,15 +1248,15 @@ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput,
1463
1248
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1464
1249
  };
1465
1250
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
1466
- const contents = {};
1251
+ const contents = map({});
1467
1252
  const data = parsedOutput.body;
1468
- if (data.fieldList !== undefined && data.fieldList !== null) {
1253
+ if (data.fieldList != null) {
1469
1254
  contents.fieldList = deserializeAws_restJson1ValidationExceptionFieldList(data.fieldList, context);
1470
1255
  }
1471
- if (data.message !== undefined && data.message !== null) {
1256
+ if (data.message != null) {
1472
1257
  contents.message = (0, smithy_client_1.expectString)(data.message);
1473
1258
  }
1474
- if (data.reason !== undefined && data.reason !== null) {
1259
+ if (data.reason != null) {
1475
1260
  contents.reason = (0, smithy_client_1.expectString)(data.reason);
1476
1261
  }
1477
1262
  const exception = new models_0_1.ValidationException({
@@ -1484,9 +1269,6 @@ const serializeAws_restJson1AllowedOrganizations = (input, context) => {
1484
1269
  return input
1485
1270
  .filter((e) => e != null)
1486
1271
  .map((entry) => {
1487
- if (entry === null) {
1488
- return null;
1489
- }
1490
1272
  return entry;
1491
1273
  });
1492
1274
  };
@@ -1504,9 +1286,6 @@ const serializeAws_restJson1AuthenticationProviders = (input, context) => {
1504
1286
  return input
1505
1287
  .filter((e) => e != null)
1506
1288
  .map((entry) => {
1507
- if (entry === null) {
1508
- return null;
1509
- }
1510
1289
  return entry;
1511
1290
  });
1512
1291
  };
@@ -1514,9 +1293,6 @@ const serializeAws_restJson1DataSourceTypesList = (input, context) => {
1514
1293
  return input
1515
1294
  .filter((e) => e != null)
1516
1295
  .map((entry) => {
1517
- if (entry === null) {
1518
- return null;
1519
- }
1520
1296
  return entry;
1521
1297
  });
1522
1298
  };
@@ -1531,9 +1307,6 @@ const serializeAws_restJson1NotificationDestinationsList = (input, context) => {
1531
1307
  return input
1532
1308
  .filter((e) => e != null)
1533
1309
  .map((entry) => {
1534
- if (entry === null) {
1535
- return null;
1536
- }
1537
1310
  return entry;
1538
1311
  });
1539
1312
  };
@@ -1541,9 +1314,6 @@ const serializeAws_restJson1OrganizationalUnitList = (input, context) => {
1541
1314
  return input
1542
1315
  .filter((e) => e != null)
1543
1316
  .map((entry) => {
1544
- if (entry === null) {
1545
- return null;
1546
- }
1547
1317
  return entry;
1548
1318
  });
1549
1319
  };
@@ -1551,9 +1321,6 @@ const serializeAws_restJson1RoleValueList = (input, context) => {
1551
1321
  return input
1552
1322
  .filter((e) => e != null)
1553
1323
  .map((entry) => {
1554
- if (entry === null) {
1555
- return null;
1556
- }
1557
1324
  return entry;
1558
1325
  });
1559
1326
  };
@@ -1598,9 +1365,6 @@ const serializeAws_restJson1UpdateInstructionBatch = (input, context) => {
1598
1365
  return input
1599
1366
  .filter((e) => e != null)
1600
1367
  .map((entry) => {
1601
- if (entry === null) {
1602
- return null;
1603
- }
1604
1368
  return serializeAws_restJson1UpdateInstruction(entry, context);
1605
1369
  });
1606
1370
  };
@@ -1614,9 +1378,6 @@ const serializeAws_restJson1UserList = (input, context) => {
1614
1378
  return input
1615
1379
  .filter((e) => e != null)
1616
1380
  .map((entry) => {
1617
- if (entry === null) {
1618
- return null;
1619
- }
1620
1381
  return serializeAws_restJson1User(entry, context);
1621
1382
  });
1622
1383
  };