@aws-sdk/client-pi 3.35.0 → 3.38.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 (92) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist-cjs/PI.js +0 -25
  3. package/dist-cjs/PIClient.js +0 -30
  4. package/dist-cjs/commands/DescribeDimensionKeysCommand.js +0 -30
  5. package/dist-cjs/commands/GetDimensionKeyDetailsCommand.js +0 -28
  6. package/dist-cjs/commands/GetResourceMetricsCommand.js +0 -31
  7. package/dist-cjs/commands/index.js +6 -0
  8. package/dist-cjs/endpoints.js +1 -2
  9. package/dist-cjs/index.js +3 -6
  10. package/dist-cjs/models/index.js +0 -1
  11. package/dist-cjs/models/models_0.js +0 -52
  12. package/dist-cjs/protocols/Aws_json1_1.js +0 -6
  13. package/dist-cjs/runtimeConfig.browser.js +1 -6
  14. package/dist-cjs/runtimeConfig.js +2 -7
  15. package/dist-cjs/runtimeConfig.native.js +0 -4
  16. package/dist-cjs/runtimeConfig.shared.js +0 -4
  17. package/dist-es/PI.js +0 -1
  18. package/dist-es/PIClient.js +0 -1
  19. package/dist-es/commands/DescribeDimensionKeysCommand.js +0 -1
  20. package/dist-es/commands/GetDimensionKeyDetailsCommand.js +0 -1
  21. package/dist-es/commands/GetResourceMetricsCommand.js +0 -1
  22. package/dist-es/commands/index.js +3 -0
  23. package/dist-es/endpoints.js +1 -2
  24. package/dist-es/index.js +3 -6
  25. package/dist-es/models/index.js +0 -1
  26. package/dist-es/models/models_0.js +0 -1
  27. package/dist-es/protocols/Aws_json1_1.js +0 -1
  28. package/dist-es/runtimeConfig.browser.js +1 -2
  29. package/dist-es/runtimeConfig.js +2 -3
  30. package/dist-es/runtimeConfig.native.js +0 -1
  31. package/dist-es/runtimeConfig.shared.js +0 -1
  32. package/dist-types/commands/index.d.ts +3 -0
  33. package/dist-types/index.d.ts +3 -5
  34. package/dist-types/ts3.4/PI.d.ts +4 -47
  35. package/dist-types/ts3.4/PIClient.d.ts +24 -110
  36. package/dist-types/ts3.4/commands/DescribeDimensionKeysCommand.d.ts +2 -25
  37. package/dist-types/ts3.4/commands/GetDimensionKeyDetailsCommand.d.ts +2 -23
  38. package/dist-types/ts3.4/commands/GetResourceMetricsCommand.d.ts +2 -26
  39. package/dist-types/ts3.4/commands/index.d.ts +3 -0
  40. package/dist-types/ts3.4/index.d.ts +3 -5
  41. package/dist-types/ts3.4/models/models_0.d.ts +82 -588
  42. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -3
  43. package/dist-types/ts3.4/runtimeConfig.d.ts +1 -3
  44. package/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -3
  45. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +1 -3
  46. package/package.json +33 -30
  47. package/dist-cjs/PI.js.map +0 -1
  48. package/dist-cjs/PIClient.js.map +0 -1
  49. package/dist-cjs/commands/DescribeDimensionKeysCommand.js.map +0 -1
  50. package/dist-cjs/commands/GetDimensionKeyDetailsCommand.js.map +0 -1
  51. package/dist-cjs/commands/GetResourceMetricsCommand.js.map +0 -1
  52. package/dist-cjs/endpoints.js.map +0 -1
  53. package/dist-cjs/index.js.map +0 -1
  54. package/dist-cjs/models/index.js.map +0 -1
  55. package/dist-cjs/models/models_0.js.map +0 -1
  56. package/dist-cjs/protocols/Aws_json1_1.js.map +0 -1
  57. package/dist-cjs/runtimeConfig.browser.js.map +0 -1
  58. package/dist-cjs/runtimeConfig.js.map +0 -1
  59. package/dist-cjs/runtimeConfig.native.js.map +0 -1
  60. package/dist-cjs/runtimeConfig.shared.js.map +0 -1
  61. package/dist-es/PI.js.map +0 -1
  62. package/dist-es/PIClient.js.map +0 -1
  63. package/dist-es/commands/DescribeDimensionKeysCommand.js.map +0 -1
  64. package/dist-es/commands/GetDimensionKeyDetailsCommand.js.map +0 -1
  65. package/dist-es/commands/GetResourceMetricsCommand.js.map +0 -1
  66. package/dist-es/endpoints.js.map +0 -1
  67. package/dist-es/index.js.map +0 -1
  68. package/dist-es/models/index.js.map +0 -1
  69. package/dist-es/models/models_0.js.map +0 -1
  70. package/dist-es/protocols/Aws_json1_1.js.map +0 -1
  71. package/dist-es/runtimeConfig.browser.js.map +0 -1
  72. package/dist-es/runtimeConfig.js.map +0 -1
  73. package/dist-es/runtimeConfig.native.js.map +0 -1
  74. package/dist-es/runtimeConfig.shared.js.map +0 -1
  75. package/jest.config.js +0 -4
  76. package/src/PI.ts +0 -154
  77. package/src/PIClient.ts +0 -272
  78. package/src/commands/DescribeDimensionKeysCommand.ts +0 -100
  79. package/src/commands/GetDimensionKeyDetailsCommand.ts +0 -98
  80. package/src/commands/GetResourceMetricsCommand.ts +0 -101
  81. package/src/endpoints.ts +0 -57
  82. package/src/index.ts +0 -6
  83. package/src/models/index.ts +0 -1
  84. package/src/models/models_0.ts +0 -855
  85. package/src/protocols/Aws_json1_1.ts +0 -786
  86. package/src/runtimeConfig.browser.ts +0 -41
  87. package/src/runtimeConfig.native.ts +0 -17
  88. package/src/runtimeConfig.shared.ts +0 -17
  89. package/src/runtimeConfig.ts +0 -46
  90. package/tsconfig.es.json +0 -10
  91. package/tsconfig.json +0 -33
  92. package/tsconfig.types.json +0 -9
@@ -1,786 +0,0 @@
1
- import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
2
- import {
3
- expectNonNull as __expectNonNull,
4
- expectNumber as __expectNumber,
5
- expectString as __expectString,
6
- limitedParseDouble as __limitedParseDouble,
7
- parseEpochTimestamp as __parseEpochTimestamp,
8
- } from "@aws-sdk/smithy-client";
9
- import {
10
- Endpoint as __Endpoint,
11
- HeaderBag as __HeaderBag,
12
- MetadataBearer as __MetadataBearer,
13
- ResponseMetadata as __ResponseMetadata,
14
- SerdeContext as __SerdeContext,
15
- SmithyException as __SmithyException,
16
- } from "@aws-sdk/types";
17
-
18
- import {
19
- DescribeDimensionKeysCommandInput,
20
- DescribeDimensionKeysCommandOutput,
21
- } from "../commands/DescribeDimensionKeysCommand";
22
- import {
23
- GetDimensionKeyDetailsCommandInput,
24
- GetDimensionKeyDetailsCommandOutput,
25
- } from "../commands/GetDimensionKeyDetailsCommand";
26
- import { GetResourceMetricsCommandInput, GetResourceMetricsCommandOutput } from "../commands/GetResourceMetricsCommand";
27
- import {
28
- DataPoint,
29
- DescribeDimensionKeysRequest,
30
- DescribeDimensionKeysResponse,
31
- DimensionGroup,
32
- DimensionKeyDescription,
33
- DimensionKeyDetail,
34
- GetDimensionKeyDetailsRequest,
35
- GetDimensionKeyDetailsResponse,
36
- GetResourceMetricsRequest,
37
- GetResourceMetricsResponse,
38
- InternalServiceError,
39
- InvalidArgumentException,
40
- MetricKeyDataPoints,
41
- MetricQuery,
42
- NotAuthorizedException,
43
- ResponsePartitionKey,
44
- ResponseResourceMetricKey,
45
- } from "../models/models_0";
46
-
47
- export const serializeAws_json1_1DescribeDimensionKeysCommand = async (
48
- input: DescribeDimensionKeysCommandInput,
49
- context: __SerdeContext
50
- ): Promise<__HttpRequest> => {
51
- const headers: __HeaderBag = {
52
- "content-type": "application/x-amz-json-1.1",
53
- "x-amz-target": "PerformanceInsightsv20180227.DescribeDimensionKeys",
54
- };
55
- let body: any;
56
- body = JSON.stringify(serializeAws_json1_1DescribeDimensionKeysRequest(input, context));
57
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
58
- };
59
-
60
- export const serializeAws_json1_1GetDimensionKeyDetailsCommand = async (
61
- input: GetDimensionKeyDetailsCommandInput,
62
- context: __SerdeContext
63
- ): Promise<__HttpRequest> => {
64
- const headers: __HeaderBag = {
65
- "content-type": "application/x-amz-json-1.1",
66
- "x-amz-target": "PerformanceInsightsv20180227.GetDimensionKeyDetails",
67
- };
68
- let body: any;
69
- body = JSON.stringify(serializeAws_json1_1GetDimensionKeyDetailsRequest(input, context));
70
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
71
- };
72
-
73
- export const serializeAws_json1_1GetResourceMetricsCommand = async (
74
- input: GetResourceMetricsCommandInput,
75
- context: __SerdeContext
76
- ): Promise<__HttpRequest> => {
77
- const headers: __HeaderBag = {
78
- "content-type": "application/x-amz-json-1.1",
79
- "x-amz-target": "PerformanceInsightsv20180227.GetResourceMetrics",
80
- };
81
- let body: any;
82
- body = JSON.stringify(serializeAws_json1_1GetResourceMetricsRequest(input, context));
83
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
84
- };
85
-
86
- export const deserializeAws_json1_1DescribeDimensionKeysCommand = async (
87
- output: __HttpResponse,
88
- context: __SerdeContext
89
- ): Promise<DescribeDimensionKeysCommandOutput> => {
90
- if (output.statusCode >= 300) {
91
- return deserializeAws_json1_1DescribeDimensionKeysCommandError(output, context);
92
- }
93
- const data: any = await parseBody(output.body, context);
94
- let contents: any = {};
95
- contents = deserializeAws_json1_1DescribeDimensionKeysResponse(data, context);
96
- const response: DescribeDimensionKeysCommandOutput = {
97
- $metadata: deserializeMetadata(output),
98
- ...contents,
99
- };
100
- return Promise.resolve(response);
101
- };
102
-
103
- const deserializeAws_json1_1DescribeDimensionKeysCommandError = async (
104
- output: __HttpResponse,
105
- context: __SerdeContext
106
- ): Promise<DescribeDimensionKeysCommandOutput> => {
107
- const parsedOutput: any = {
108
- ...output,
109
- body: await parseBody(output.body, context),
110
- };
111
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
112
- let errorCode = "UnknownError";
113
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
114
- switch (errorCode) {
115
- case "InternalServiceError":
116
- case "com.amazonaws.pi#InternalServiceError":
117
- response = {
118
- ...(await deserializeAws_json1_1InternalServiceErrorResponse(parsedOutput, context)),
119
- name: errorCode,
120
- $metadata: deserializeMetadata(output),
121
- };
122
- break;
123
- case "InvalidArgumentException":
124
- case "com.amazonaws.pi#InvalidArgumentException":
125
- response = {
126
- ...(await deserializeAws_json1_1InvalidArgumentExceptionResponse(parsedOutput, context)),
127
- name: errorCode,
128
- $metadata: deserializeMetadata(output),
129
- };
130
- break;
131
- case "NotAuthorizedException":
132
- case "com.amazonaws.pi#NotAuthorizedException":
133
- response = {
134
- ...(await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)),
135
- name: errorCode,
136
- $metadata: deserializeMetadata(output),
137
- };
138
- break;
139
- default:
140
- const parsedBody = parsedOutput.body;
141
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
142
- response = {
143
- ...parsedBody,
144
- name: `${errorCode}`,
145
- message: parsedBody.message || parsedBody.Message || errorCode,
146
- $fault: "client",
147
- $metadata: deserializeMetadata(output),
148
- } as any;
149
- }
150
- const message = response.message || response.Message || errorCode;
151
- response.message = message;
152
- delete response.Message;
153
- return Promise.reject(Object.assign(new Error(message), response));
154
- };
155
-
156
- export const deserializeAws_json1_1GetDimensionKeyDetailsCommand = async (
157
- output: __HttpResponse,
158
- context: __SerdeContext
159
- ): Promise<GetDimensionKeyDetailsCommandOutput> => {
160
- if (output.statusCode >= 300) {
161
- return deserializeAws_json1_1GetDimensionKeyDetailsCommandError(output, context);
162
- }
163
- const data: any = await parseBody(output.body, context);
164
- let contents: any = {};
165
- contents = deserializeAws_json1_1GetDimensionKeyDetailsResponse(data, context);
166
- const response: GetDimensionKeyDetailsCommandOutput = {
167
- $metadata: deserializeMetadata(output),
168
- ...contents,
169
- };
170
- return Promise.resolve(response);
171
- };
172
-
173
- const deserializeAws_json1_1GetDimensionKeyDetailsCommandError = async (
174
- output: __HttpResponse,
175
- context: __SerdeContext
176
- ): Promise<GetDimensionKeyDetailsCommandOutput> => {
177
- const parsedOutput: any = {
178
- ...output,
179
- body: await parseBody(output.body, context),
180
- };
181
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
182
- let errorCode = "UnknownError";
183
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
184
- switch (errorCode) {
185
- case "InternalServiceError":
186
- case "com.amazonaws.pi#InternalServiceError":
187
- response = {
188
- ...(await deserializeAws_json1_1InternalServiceErrorResponse(parsedOutput, context)),
189
- name: errorCode,
190
- $metadata: deserializeMetadata(output),
191
- };
192
- break;
193
- case "InvalidArgumentException":
194
- case "com.amazonaws.pi#InvalidArgumentException":
195
- response = {
196
- ...(await deserializeAws_json1_1InvalidArgumentExceptionResponse(parsedOutput, context)),
197
- name: errorCode,
198
- $metadata: deserializeMetadata(output),
199
- };
200
- break;
201
- case "NotAuthorizedException":
202
- case "com.amazonaws.pi#NotAuthorizedException":
203
- response = {
204
- ...(await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)),
205
- name: errorCode,
206
- $metadata: deserializeMetadata(output),
207
- };
208
- break;
209
- default:
210
- const parsedBody = parsedOutput.body;
211
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
212
- response = {
213
- ...parsedBody,
214
- name: `${errorCode}`,
215
- message: parsedBody.message || parsedBody.Message || errorCode,
216
- $fault: "client",
217
- $metadata: deserializeMetadata(output),
218
- } as any;
219
- }
220
- const message = response.message || response.Message || errorCode;
221
- response.message = message;
222
- delete response.Message;
223
- return Promise.reject(Object.assign(new Error(message), response));
224
- };
225
-
226
- export const deserializeAws_json1_1GetResourceMetricsCommand = async (
227
- output: __HttpResponse,
228
- context: __SerdeContext
229
- ): Promise<GetResourceMetricsCommandOutput> => {
230
- if (output.statusCode >= 300) {
231
- return deserializeAws_json1_1GetResourceMetricsCommandError(output, context);
232
- }
233
- const data: any = await parseBody(output.body, context);
234
- let contents: any = {};
235
- contents = deserializeAws_json1_1GetResourceMetricsResponse(data, context);
236
- const response: GetResourceMetricsCommandOutput = {
237
- $metadata: deserializeMetadata(output),
238
- ...contents,
239
- };
240
- return Promise.resolve(response);
241
- };
242
-
243
- const deserializeAws_json1_1GetResourceMetricsCommandError = async (
244
- output: __HttpResponse,
245
- context: __SerdeContext
246
- ): Promise<GetResourceMetricsCommandOutput> => {
247
- const parsedOutput: any = {
248
- ...output,
249
- body: await parseBody(output.body, context),
250
- };
251
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
252
- let errorCode = "UnknownError";
253
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
254
- switch (errorCode) {
255
- case "InternalServiceError":
256
- case "com.amazonaws.pi#InternalServiceError":
257
- response = {
258
- ...(await deserializeAws_json1_1InternalServiceErrorResponse(parsedOutput, context)),
259
- name: errorCode,
260
- $metadata: deserializeMetadata(output),
261
- };
262
- break;
263
- case "InvalidArgumentException":
264
- case "com.amazonaws.pi#InvalidArgumentException":
265
- response = {
266
- ...(await deserializeAws_json1_1InvalidArgumentExceptionResponse(parsedOutput, context)),
267
- name: errorCode,
268
- $metadata: deserializeMetadata(output),
269
- };
270
- break;
271
- case "NotAuthorizedException":
272
- case "com.amazonaws.pi#NotAuthorizedException":
273
- response = {
274
- ...(await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)),
275
- name: errorCode,
276
- $metadata: deserializeMetadata(output),
277
- };
278
- break;
279
- default:
280
- const parsedBody = parsedOutput.body;
281
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
282
- response = {
283
- ...parsedBody,
284
- name: `${errorCode}`,
285
- message: parsedBody.message || parsedBody.Message || errorCode,
286
- $fault: "client",
287
- $metadata: deserializeMetadata(output),
288
- } as any;
289
- }
290
- const message = response.message || response.Message || errorCode;
291
- response.message = message;
292
- delete response.Message;
293
- return Promise.reject(Object.assign(new Error(message), response));
294
- };
295
-
296
- const deserializeAws_json1_1InternalServiceErrorResponse = async (
297
- parsedOutput: any,
298
- context: __SerdeContext
299
- ): Promise<InternalServiceError> => {
300
- const body = parsedOutput.body;
301
- const deserialized: any = deserializeAws_json1_1InternalServiceError(body, context);
302
- const contents: InternalServiceError = {
303
- name: "InternalServiceError",
304
- $fault: "server",
305
- $metadata: deserializeMetadata(parsedOutput),
306
- ...deserialized,
307
- };
308
- return contents;
309
- };
310
-
311
- const deserializeAws_json1_1InvalidArgumentExceptionResponse = async (
312
- parsedOutput: any,
313
- context: __SerdeContext
314
- ): Promise<InvalidArgumentException> => {
315
- const body = parsedOutput.body;
316
- const deserialized: any = deserializeAws_json1_1InvalidArgumentException(body, context);
317
- const contents: InvalidArgumentException = {
318
- name: "InvalidArgumentException",
319
- $fault: "client",
320
- $metadata: deserializeMetadata(parsedOutput),
321
- ...deserialized,
322
- };
323
- return contents;
324
- };
325
-
326
- const deserializeAws_json1_1NotAuthorizedExceptionResponse = async (
327
- parsedOutput: any,
328
- context: __SerdeContext
329
- ): Promise<NotAuthorizedException> => {
330
- const body = parsedOutput.body;
331
- const deserialized: any = deserializeAws_json1_1NotAuthorizedException(body, context);
332
- const contents: NotAuthorizedException = {
333
- name: "NotAuthorizedException",
334
- $fault: "client",
335
- $metadata: deserializeMetadata(parsedOutput),
336
- ...deserialized,
337
- };
338
- return contents;
339
- };
340
-
341
- const serializeAws_json1_1DescribeDimensionKeysRequest = (
342
- input: DescribeDimensionKeysRequest,
343
- context: __SerdeContext
344
- ): any => {
345
- return {
346
- ...(input.EndTime !== undefined &&
347
- input.EndTime !== null && { EndTime: Math.round(input.EndTime.getTime() / 1000) }),
348
- ...(input.Filter !== undefined &&
349
- input.Filter !== null && { Filter: serializeAws_json1_1MetricQueryFilterMap(input.Filter, context) }),
350
- ...(input.GroupBy !== undefined &&
351
- input.GroupBy !== null && { GroupBy: serializeAws_json1_1DimensionGroup(input.GroupBy, context) }),
352
- ...(input.Identifier !== undefined && input.Identifier !== null && { Identifier: input.Identifier }),
353
- ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }),
354
- ...(input.Metric !== undefined && input.Metric !== null && { Metric: input.Metric }),
355
- ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }),
356
- ...(input.PartitionBy !== undefined &&
357
- input.PartitionBy !== null && { PartitionBy: serializeAws_json1_1DimensionGroup(input.PartitionBy, context) }),
358
- ...(input.PeriodInSeconds !== undefined &&
359
- input.PeriodInSeconds !== null && { PeriodInSeconds: input.PeriodInSeconds }),
360
- ...(input.ServiceType !== undefined && input.ServiceType !== null && { ServiceType: input.ServiceType }),
361
- ...(input.StartTime !== undefined &&
362
- input.StartTime !== null && { StartTime: Math.round(input.StartTime.getTime() / 1000) }),
363
- };
364
- };
365
-
366
- const serializeAws_json1_1DimensionGroup = (input: DimensionGroup, context: __SerdeContext): any => {
367
- return {
368
- ...(input.Dimensions !== undefined &&
369
- input.Dimensions !== null && { Dimensions: serializeAws_json1_1RequestStringList(input.Dimensions, context) }),
370
- ...(input.Group !== undefined && input.Group !== null && { Group: input.Group }),
371
- ...(input.Limit !== undefined && input.Limit !== null && { Limit: input.Limit }),
372
- };
373
- };
374
-
375
- const serializeAws_json1_1GetDimensionKeyDetailsRequest = (
376
- input: GetDimensionKeyDetailsRequest,
377
- context: __SerdeContext
378
- ): any => {
379
- return {
380
- ...(input.Group !== undefined && input.Group !== null && { Group: input.Group }),
381
- ...(input.GroupIdentifier !== undefined &&
382
- input.GroupIdentifier !== null && { GroupIdentifier: input.GroupIdentifier }),
383
- ...(input.Identifier !== undefined && input.Identifier !== null && { Identifier: input.Identifier }),
384
- ...(input.RequestedDimensions !== undefined &&
385
- input.RequestedDimensions !== null && {
386
- RequestedDimensions: serializeAws_json1_1RequestedDimensionList(input.RequestedDimensions, context),
387
- }),
388
- ...(input.ServiceType !== undefined && input.ServiceType !== null && { ServiceType: input.ServiceType }),
389
- };
390
- };
391
-
392
- const serializeAws_json1_1GetResourceMetricsRequest = (
393
- input: GetResourceMetricsRequest,
394
- context: __SerdeContext
395
- ): any => {
396
- return {
397
- ...(input.EndTime !== undefined &&
398
- input.EndTime !== null && { EndTime: Math.round(input.EndTime.getTime() / 1000) }),
399
- ...(input.Identifier !== undefined && input.Identifier !== null && { Identifier: input.Identifier }),
400
- ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }),
401
- ...(input.MetricQueries !== undefined &&
402
- input.MetricQueries !== null && {
403
- MetricQueries: serializeAws_json1_1MetricQueryList(input.MetricQueries, context),
404
- }),
405
- ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }),
406
- ...(input.PeriodInSeconds !== undefined &&
407
- input.PeriodInSeconds !== null && { PeriodInSeconds: input.PeriodInSeconds }),
408
- ...(input.ServiceType !== undefined && input.ServiceType !== null && { ServiceType: input.ServiceType }),
409
- ...(input.StartTime !== undefined &&
410
- input.StartTime !== null && { StartTime: Math.round(input.StartTime.getTime() / 1000) }),
411
- };
412
- };
413
-
414
- const serializeAws_json1_1MetricQuery = (input: MetricQuery, context: __SerdeContext): any => {
415
- return {
416
- ...(input.Filter !== undefined &&
417
- input.Filter !== null && { Filter: serializeAws_json1_1MetricQueryFilterMap(input.Filter, context) }),
418
- ...(input.GroupBy !== undefined &&
419
- input.GroupBy !== null && { GroupBy: serializeAws_json1_1DimensionGroup(input.GroupBy, context) }),
420
- ...(input.Metric !== undefined && input.Metric !== null && { Metric: input.Metric }),
421
- };
422
- };
423
-
424
- const serializeAws_json1_1MetricQueryFilterMap = (input: { [key: string]: string }, context: __SerdeContext): any => {
425
- return Object.entries(input).reduce((acc: { [key: string]: any }, [key, value]: [string, any]) => {
426
- if (value === null) {
427
- return acc;
428
- }
429
- return {
430
- ...acc,
431
- [key]: value,
432
- };
433
- }, {});
434
- };
435
-
436
- const serializeAws_json1_1MetricQueryList = (input: MetricQuery[], context: __SerdeContext): any => {
437
- return input
438
- .filter((e: any) => e != null)
439
- .map((entry) => {
440
- if (entry === null) {
441
- return null as any;
442
- }
443
- return serializeAws_json1_1MetricQuery(entry, context);
444
- });
445
- };
446
-
447
- const serializeAws_json1_1RequestedDimensionList = (input: string[], context: __SerdeContext): any => {
448
- return input
449
- .filter((e: any) => e != null)
450
- .map((entry) => {
451
- if (entry === null) {
452
- return null as any;
453
- }
454
- return entry;
455
- });
456
- };
457
-
458
- const serializeAws_json1_1RequestStringList = (input: string[], context: __SerdeContext): any => {
459
- return input
460
- .filter((e: any) => e != null)
461
- .map((entry) => {
462
- if (entry === null) {
463
- return null as any;
464
- }
465
- return entry;
466
- });
467
- };
468
-
469
- const deserializeAws_json1_1DataPoint = (output: any, context: __SerdeContext): DataPoint => {
470
- return {
471
- Timestamp:
472
- output.Timestamp !== undefined && output.Timestamp !== null
473
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.Timestamp)))
474
- : undefined,
475
- Value: __limitedParseDouble(output.Value),
476
- } as any;
477
- };
478
-
479
- const deserializeAws_json1_1DataPointsList = (output: any, context: __SerdeContext): DataPoint[] => {
480
- return (output || [])
481
- .filter((e: any) => e != null)
482
- .map((entry: any) => {
483
- if (entry === null) {
484
- return null as any;
485
- }
486
- return deserializeAws_json1_1DataPoint(entry, context);
487
- });
488
- };
489
-
490
- const deserializeAws_json1_1DescribeDimensionKeysResponse = (
491
- output: any,
492
- context: __SerdeContext
493
- ): DescribeDimensionKeysResponse => {
494
- return {
495
- AlignedEndTime:
496
- output.AlignedEndTime !== undefined && output.AlignedEndTime !== null
497
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.AlignedEndTime)))
498
- : undefined,
499
- AlignedStartTime:
500
- output.AlignedStartTime !== undefined && output.AlignedStartTime !== null
501
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.AlignedStartTime)))
502
- : undefined,
503
- Keys:
504
- output.Keys !== undefined && output.Keys !== null
505
- ? deserializeAws_json1_1DimensionKeyDescriptionList(output.Keys, context)
506
- : undefined,
507
- NextToken: __expectString(output.NextToken),
508
- PartitionKeys:
509
- output.PartitionKeys !== undefined && output.PartitionKeys !== null
510
- ? deserializeAws_json1_1ResponsePartitionKeyList(output.PartitionKeys, context)
511
- : undefined,
512
- } as any;
513
- };
514
-
515
- const deserializeAws_json1_1DimensionKeyDescription = (
516
- output: any,
517
- context: __SerdeContext
518
- ): DimensionKeyDescription => {
519
- return {
520
- Dimensions:
521
- output.Dimensions !== undefined && output.Dimensions !== null
522
- ? deserializeAws_json1_1DimensionMap(output.Dimensions, context)
523
- : undefined,
524
- Partitions:
525
- output.Partitions !== undefined && output.Partitions !== null
526
- ? deserializeAws_json1_1MetricValuesList(output.Partitions, context)
527
- : undefined,
528
- Total: __limitedParseDouble(output.Total),
529
- } as any;
530
- };
531
-
532
- const deserializeAws_json1_1DimensionKeyDescriptionList = (
533
- output: any,
534
- context: __SerdeContext
535
- ): DimensionKeyDescription[] => {
536
- return (output || [])
537
- .filter((e: any) => e != null)
538
- .map((entry: any) => {
539
- if (entry === null) {
540
- return null as any;
541
- }
542
- return deserializeAws_json1_1DimensionKeyDescription(entry, context);
543
- });
544
- };
545
-
546
- const deserializeAws_json1_1DimensionKeyDetail = (output: any, context: __SerdeContext): DimensionKeyDetail => {
547
- return {
548
- Dimension: __expectString(output.Dimension),
549
- Status: __expectString(output.Status),
550
- Value: __expectString(output.Value),
551
- } as any;
552
- };
553
-
554
- const deserializeAws_json1_1DimensionKeyDetailList = (output: any, context: __SerdeContext): DimensionKeyDetail[] => {
555
- return (output || [])
556
- .filter((e: any) => e != null)
557
- .map((entry: any) => {
558
- if (entry === null) {
559
- return null as any;
560
- }
561
- return deserializeAws_json1_1DimensionKeyDetail(entry, context);
562
- });
563
- };
564
-
565
- const deserializeAws_json1_1DimensionMap = (output: any, context: __SerdeContext): { [key: string]: string } => {
566
- return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => {
567
- if (value === null) {
568
- return acc;
569
- }
570
- return {
571
- ...acc,
572
- [key]: __expectString(value) as any,
573
- };
574
- }, {});
575
- };
576
-
577
- const deserializeAws_json1_1GetDimensionKeyDetailsResponse = (
578
- output: any,
579
- context: __SerdeContext
580
- ): GetDimensionKeyDetailsResponse => {
581
- return {
582
- Dimensions:
583
- output.Dimensions !== undefined && output.Dimensions !== null
584
- ? deserializeAws_json1_1DimensionKeyDetailList(output.Dimensions, context)
585
- : undefined,
586
- } as any;
587
- };
588
-
589
- const deserializeAws_json1_1GetResourceMetricsResponse = (
590
- output: any,
591
- context: __SerdeContext
592
- ): GetResourceMetricsResponse => {
593
- return {
594
- AlignedEndTime:
595
- output.AlignedEndTime !== undefined && output.AlignedEndTime !== null
596
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.AlignedEndTime)))
597
- : undefined,
598
- AlignedStartTime:
599
- output.AlignedStartTime !== undefined && output.AlignedStartTime !== null
600
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.AlignedStartTime)))
601
- : undefined,
602
- Identifier: __expectString(output.Identifier),
603
- MetricList:
604
- output.MetricList !== undefined && output.MetricList !== null
605
- ? deserializeAws_json1_1MetricKeyDataPointsList(output.MetricList, context)
606
- : undefined,
607
- NextToken: __expectString(output.NextToken),
608
- } as any;
609
- };
610
-
611
- const deserializeAws_json1_1InternalServiceError = (output: any, context: __SerdeContext): InternalServiceError => {
612
- return {
613
- Message: __expectString(output.Message),
614
- } as any;
615
- };
616
-
617
- const deserializeAws_json1_1InvalidArgumentException = (
618
- output: any,
619
- context: __SerdeContext
620
- ): InvalidArgumentException => {
621
- return {
622
- Message: __expectString(output.Message),
623
- } as any;
624
- };
625
-
626
- const deserializeAws_json1_1MetricKeyDataPoints = (output: any, context: __SerdeContext): MetricKeyDataPoints => {
627
- return {
628
- DataPoints:
629
- output.DataPoints !== undefined && output.DataPoints !== null
630
- ? deserializeAws_json1_1DataPointsList(output.DataPoints, context)
631
- : undefined,
632
- Key:
633
- output.Key !== undefined && output.Key !== null
634
- ? deserializeAws_json1_1ResponseResourceMetricKey(output.Key, context)
635
- : undefined,
636
- } as any;
637
- };
638
-
639
- const deserializeAws_json1_1MetricKeyDataPointsList = (output: any, context: __SerdeContext): MetricKeyDataPoints[] => {
640
- return (output || [])
641
- .filter((e: any) => e != null)
642
- .map((entry: any) => {
643
- if (entry === null) {
644
- return null as any;
645
- }
646
- return deserializeAws_json1_1MetricKeyDataPoints(entry, context);
647
- });
648
- };
649
-
650
- const deserializeAws_json1_1MetricValuesList = (output: any, context: __SerdeContext): number[] => {
651
- return (output || [])
652
- .filter((e: any) => e != null)
653
- .map((entry: any) => {
654
- if (entry === null) {
655
- return null as any;
656
- }
657
- return __limitedParseDouble(entry) as any;
658
- });
659
- };
660
-
661
- const deserializeAws_json1_1NotAuthorizedException = (output: any, context: __SerdeContext): NotAuthorizedException => {
662
- return {
663
- Message: __expectString(output.Message),
664
- } as any;
665
- };
666
-
667
- const deserializeAws_json1_1ResponsePartitionKey = (output: any, context: __SerdeContext): ResponsePartitionKey => {
668
- return {
669
- Dimensions:
670
- output.Dimensions !== undefined && output.Dimensions !== null
671
- ? deserializeAws_json1_1DimensionMap(output.Dimensions, context)
672
- : undefined,
673
- } as any;
674
- };
675
-
676
- const deserializeAws_json1_1ResponsePartitionKeyList = (
677
- output: any,
678
- context: __SerdeContext
679
- ): ResponsePartitionKey[] => {
680
- return (output || [])
681
- .filter((e: any) => e != null)
682
- .map((entry: any) => {
683
- if (entry === null) {
684
- return null as any;
685
- }
686
- return deserializeAws_json1_1ResponsePartitionKey(entry, context);
687
- });
688
- };
689
-
690
- const deserializeAws_json1_1ResponseResourceMetricKey = (
691
- output: any,
692
- context: __SerdeContext
693
- ): ResponseResourceMetricKey => {
694
- return {
695
- Dimensions:
696
- output.Dimensions !== undefined && output.Dimensions !== null
697
- ? deserializeAws_json1_1DimensionMap(output.Dimensions, context)
698
- : undefined,
699
- Metric: __expectString(output.Metric),
700
- } as any;
701
- };
702
-
703
- const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
704
- httpStatusCode: output.statusCode,
705
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
706
- extendedRequestId: output.headers["x-amz-id-2"],
707
- cfId: output.headers["x-amz-cf-id"],
708
- });
709
-
710
- // Collect low-level response body stream to Uint8Array.
711
- const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
712
- if (streamBody instanceof Uint8Array) {
713
- return Promise.resolve(streamBody);
714
- }
715
- return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
716
- };
717
-
718
- // Encode Uint8Array data into string with utf-8.
719
- const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
720
- collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
721
-
722
- const buildHttpRpcRequest = async (
723
- context: __SerdeContext,
724
- headers: __HeaderBag,
725
- path: string,
726
- resolvedHostname: string | undefined,
727
- body: any
728
- ): Promise<__HttpRequest> => {
729
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
730
- const contents: any = {
731
- protocol,
732
- hostname,
733
- port,
734
- method: "POST",
735
- path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
736
- headers,
737
- };
738
- if (resolvedHostname !== undefined) {
739
- contents.hostname = resolvedHostname;
740
- }
741
- if (body !== undefined) {
742
- contents.body = body;
743
- }
744
- return new __HttpRequest(contents);
745
- };
746
-
747
- const parseBody = (streamBody: any, context: __SerdeContext): any =>
748
- collectBodyString(streamBody, context).then((encoded) => {
749
- if (encoded.length) {
750
- return JSON.parse(encoded);
751
- }
752
- return {};
753
- });
754
-
755
- /**
756
- * Load an error code for the aws.rest-json-1.1 protocol.
757
- */
758
- const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => {
759
- const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
760
-
761
- const sanitizeErrorCode = (rawValue: string): string => {
762
- let cleanValue = rawValue;
763
- if (cleanValue.indexOf(":") >= 0) {
764
- cleanValue = cleanValue.split(":")[0];
765
- }
766
- if (cleanValue.indexOf("#") >= 0) {
767
- cleanValue = cleanValue.split("#")[1];
768
- }
769
- return cleanValue;
770
- };
771
-
772
- const headerKey = findKey(output.headers, "x-amzn-errortype");
773
- if (headerKey !== undefined) {
774
- return sanitizeErrorCode(output.headers[headerKey]);
775
- }
776
-
777
- if (data.code !== undefined) {
778
- return sanitizeErrorCode(data.code);
779
- }
780
-
781
- if (data["__type"] !== undefined) {
782
- return sanitizeErrorCode(data["__type"]);
783
- }
784
-
785
- return "";
786
- };