gpt4 book ai didi

aws-cli - 查询多个值

转载 作者:行者123 更新时间:2023-12-03 15:50:16 24 4
gpt4 key购买 nike

我正在尝试按多个值进行过滤,但是我似乎无法使用 and 子句(例如 filter1 和 filter 2 ... 等):

显示数据库名称为“testing”的快照

aws rds describe-db-snapshots --include-shared --query 'DBSnapshots[?DBInstanceIdentifier==`testing`].{DBNAME:DBInstanceIdentifier,SNAPSHOT:DBSnapshotIdentifier}'
[
{
"SNAPSHOT": "test1",
"DBNAME": "testing"
},
{
"SNAPSHOT": "test2",
"DBNAME": "testing"
},
{
"SNAPSHOT": "test3",
"DBNAME": "testing"
},
{
"SNAPSHOT": "test4",
"DBNAME": "testing"
}
]

显示名为“test1”的快照
$ aws rds describe-db-snapshots --include-shared --query 'DBSnapshots[?DBSnapshotIdentifier==`test1`].{DBNAME:DBInstanceIdentifier,SNAPSHOT:DBSnapshotIdentifier}'
[
{
"SNAPSHOT": "test1",
"DBNAME": "testing"
},
{
"SNAPSHOT": "test1",
"DBNAME": "testing2"
}
]

显示数据库测试中名为 test1 的快照
aws rds describe-db-snapshots --include-shared --query 'DBSnapshots[?DBInstanceIdentifier==`testing`][?DBSnapshotIdentifier==`test1`].{DBNAME:DBInstanceIdentifier,SNAPSHOT:DBSnapshotIdentifier}'
[]

如何做到这一点?

最佳答案

您需要使用 AND expression所以像这样的事情会成功

$ aws rds describe-db-snapshots --include-shared \
--query 'DBSnapshots[?(DBInstanceIdentifier==`testing` && DBSnapshotIdentifier==`test1`)].{DBNAME:DBInstanceIdentifier,SNAPSHOT:DBSnapshotIdentifier}'

关于aws-cli - 查询多个值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47163478/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com