aws-sdk-js - 无法在成本浏览器过滤器中指定“非”运算符
问题描述
我正在尝试使用 aws-sdk-js 从成本资源管理器中查询数据。一切正常,直到我尝试将 a 添加Not
到我的过滤器并遇到此错误 -
TypeError: Cannot redefine property: Not
at Function.defineProperty (<anonymous>)
at Object.get Not [as Not] (/Users/yaron/code/cloud-cost-fetcher/node_modules/@aws-sdk/client-cost-explorer-node/model/shapes/_Expression.ts:18:14)
at JsonBuilder.format (/Users/yaron/code/cloud-cost-fetcher/node_modules/@aws-sdk/json-builder/src/index.ts:62:57)
at JsonBuilder.format (/Users/yaron/code/cloud-cost-fetcher/node_modules/@aws-sdk/json-builder/src/index.ts:62:37)
at JsonBuilder.build (/Users/yaron/code/cloud-cost-fetcher/node_modules/@aws-sdk/json-builder/src/index.ts:36:32)
at JsonRpcSerializer.serialize (/Users/yaron/code/cloud-cost-fetcher/node_modules/@aws-sdk/protocol-json-rpc/src/JsonRpcSerializer.ts:29:33)
at Object.<anonymous> (/Users/yaron/code/cloud-cost-fetcher/node_modules/@aws-sdk/middleware-serializer/src/index.ts:24:39)
at step (/Users/yaron/code/cloud-cost-fetcher/node_modules/tslib/tslib.js:141:27)
at Object.next (/Users/yaron/code/cloud-cost-fetcher/node_modules/tslib/tslib.js:122:57)
at fulfilled (/Users/yaron/code/cloud-cost-fetcher/node_modules/tslib/tslib.js:112:62)
当我使用 AWS CLI 时,相同的过滤器工作得非常好,所以我怀疑这与成本浏览器客户端实施有关。
这是我的代码中产生此错误的相关内容-
import { GetCostAndUsageCommand } from '@aws-sdk/client-cost-explorer-node/commands/GetCostAndUsageCommand'
import { CostExplorerClient } from '@aws-sdk/client-cost-explorer-node/CostExplorerClient'
import AWS from 'aws-sdk'
const costExplorer = new CostExplorerClient({
region: 'us-east-1',
credentials: new AWS.SharedIniFileCredentials({ profile: billingProfile }),
})
const getCostAndUsageCommand = new GetCostAndUsageCommand({
TimePeriod,
Granularity: 'MONTHLY',
GroupBy: [
{
Type: 'TAG',
Key: '<TAG_NAME>',
},
],
Filter: {
Not: {
Dimensions: {
Key: 'LINKED_ACCOUNT',
Values: ['<ACCOUNT_NUMBER'],
},
},
},
Metrics: [metricsType],
})
我正在使用以下 aws npm 模块 -
"@aws-sdk/client-cost-explorer-node": "^0.1.0-preview.2",
"aws-sdk": "^2.747.0",
任何帮助将不胜感激。
解决方案
我已经在 aws-sdk-js 存储库上发布了相同的问题,并从一位维护者那里得到了一个快速而有用的答案。似乎此模块已弃用,应更改为另一个模块,在此处发布此答案,以防将来有人需要此信息。
推荐阅读
- reactjs - Github 推送的更改在我的反应应用程序上不可见
- ios - WKWebView 高度变化
- google-bigquery - 位于 Google Bigtable 上的 Google BigQuery 表未在 Power BI 中列出
- asp.net-mvc-5 - 如何在asp.net mvc5中以零四舍五入值结尾
- reactjs - Typescript ReactDOM 呈现子类型错误
- python - PEP8 函数定义和 Sublime Text 3 代码折叠
- python-3.x - AttributeError: 'tuple' 对象没有属性 'get' Django
- sql - Athena/Presto SQL 每天汇总历史数据信息
- c# - 类/构造函数到 Action
? - docker - 拉取 Docker 镜像会大大增加 GCP 成本/降低性能/存储