ecs的DescribeInstanceStatus接口, 使用cli的--pager不能整合分页
Lv-Tree opened this issue · 4 comments
Lv-Tree commented
# 使用默认的分页聚合和不使用分页聚合结果一样, 都是10个结果
aliyun ecs DescribeInstanceStatus --pager | wc -l
46
aliyun ecs DescribeInstanceStatus| wc -l
50
aliyun ecs DescribeInstanceStatus | tail
"InstanceId": "i-bp12e9qjlwpyon3cli0n",
"Status": "Running"
}
]
},
"PageNumber": 1,
"PageSize": 10,
"RequestId": "10F3697A-9413-5336-9982-779044DC2D49",
"TotalCount": 208
}
# 指定分页聚合的具体参数, 也只得到10个结果
aliyun ecs DescribeInstanceStatus --pager PageNumber=PageNumber PageSize=PageSize TotalCount=TotalCount path=InstanceStatuses.InstanceStatus | wc -l
46
# 只能手动指定PageSize
aliyun ecs DescribeInstanceStatus --PageSize 50 | tail
"InstanceId": "i-bp1clt44axl072p8e3j2",
"Status": "Running"
}
]
},
"PageNumber": 1,
"PageSize": 50,
"RequestId": "2BBBBFBE-B948-588B-99A3-6645AC1D3EC5",
"TotalCount": 208
}
ecs别的接口, 例如DescribeInstances, --pager就好使
Lv-Tree commented
Alibaba Cloud Command Line Interface Version 3.0.108
JacksonTian commented
aliyun ecs DescribeInstanceStatus --pager PageNumber=PageNumber PageSize=PageSize TotalCount=TotalCount path=InstanceStatuses
这样试下。
Lv-Tree commented
aliyun ecs DescribeInstanceStatus --pager PageNumber=PageNumber PageSize=PageSize TotalCount=TotalCount path=InstanceStatuses这样试下。
会报错
[root@master ~]# aliyun ecs DescribeInstanceStatus --pager PageNumber=PageNumber PageSize=PageSize TotalCount=TotalCount path=InstanceStatuses
panic: interface conversion: interface {} is map[string]interface {}, not []interface {}
goroutine 1 [running]:
github.com/aliyun/aliyun-cli/openapi.(*Pager).mergeCollections(0xc000494820, {0x85f0e0, 0xc0000961b0})
/root/aliyun-cli/openapi/pager.go:231 +0x249
github.com/aliyun/aliyun-cli/openapi.(*Pager).FeedResponse(0xc000494820, {0xc0001e2000, 0x2d8})
/root/aliyun-cli/openapi/pager.go:210 +0x339
github.com/aliyun/aliyun-cli/openapi.(*Pager).CallWith(0xc000494820, {0xf9d228, 0xc0005ea980})
/root/aliyun-cli/openapi/pager.go:100 +0x7e
github.com/aliyun/aliyun-cli/openapi.(*Commando).invokeWithHelper(0x85e600, {0xf9d228, 0xc0005ea980})
/root/aliyun-cli/openapi/commando.go:195 +0x78
github.com/aliyun/aliyun-cli/openapi.(*Commando).processInvoke(0x85e600, 0xc000074730, {0x7fff6b0fa784, 0x8e035d}, {0x7fff6b0fa788, 0x0}, {0x0, 0xc00027bd70})
/root/aliyun-cli/openapi/commando.go:137 +0x16f
github.com/aliyun/aliyun-cli/openapi.(*Commando).main(0xc000156c60, 0xc000074730, {0xc000470b00, 0x2, 0xc000491340})
/root/aliyun-cli/openapi/commando.go:105 +0x7b3
github.com/aliyun/aliyun-cli/cli.(*Command).executeInner(0xc000122f00, 0xc000074730, {0xc000020090, 0xc0004b91d0, 0x1318610})
/root/aliyun-cli/cli/command.go:236 +0x527
github.com/aliyun/aliyun-cli/cli.(*Command).Execute(0x8bbd60, 0xc000074730, {0xc000020090, 0x2, 0xc000024ef0})
/root/aliyun-cli/cli/command.go:85 +0x45
main.main()
/root/aliyun-cli/main/main.go:66 +0xb45
JacksonTian commented
$ ecs DescribeInstanceStatus --pager PageNumber=PageNumber PageSize=PageSize TotalCount=TotalCount path=InstanceStatuses.InstanceStatus