boto3中的有效状态列表

2024-05-02 10:59:20 发布

您现在位置:Python中文网/ 问答频道 /正文

我想列出没有DELETE_COMPLETE作为堆栈状态的所有堆栈

使用boto2非常简单:

import boto
cf = boto.cloudformation.connect_to_region(region)
status_filter = [st for st in cf.valid_states if st != 'DELETE_COMPLETE']
for stack in cf.list_stacks(stack_status_filters=status_filter):
    ...

boto3为每个AWS服务使用botocore和许多service-2.json文件。但我找不到任何列出所有可能的状态标志的列表。在

我可以在service-2.json(botocore/data/cloudformation/2010-05-15/service-2.json)中找到它,但是如何正确地访问这个列表呢?在

获取所有堆栈,然后跳过for循环中DELETE_COMPLETE状态的堆栈不是一个选项。在


Tags: injsonfor堆栈状态statusservicefilter