Reputation: 708
I try to test boto3 library as documented http://boto3.readthedocs.io/ web page. I try to get Cloudformation stack list. So my code is:
import boto3
client = boto3.client('cloudformation')
response = client.list_stacks(
NextToken='string',
StackStatusFilter=[
'CREATE_IN_PROGRESS'|'CREATE_FAILED'|'CREATE_COMPLETE'|'ROLLBACK_IN_PROGRESS'|'ROLLBACK_FAILED'|'ROLLBACK_COMPLETE'|'DELETE_IN_PROGRESS'|'DELETE_FAILED'|'DELETE_COMPLETE'|'UPDATE_IN_PROGRESS'|'UPDATE_COMPLETE_CLEANUP_IN_PROGRESS'|'UPDATE_COMPLETE'|'UPDATE_ROLLBACK_IN_PROGRESS'|'UPDATE_ROLLBACK_FAILED'|'UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS'|'UPDATE_ROLLBACK_COMPLETE'|'REVIEW_IN_PROGRESS',
]
)
print response
When I run this, I receive an error message like:
TypeError: unsupported operand type(s) for |: 'str' and 'str'
Anything wrong with that? I'm using Python 2.7
Upvotes: 1
Views: 2503
Reputation: 10090
You're including the pipe symbol (|
) when you shouldn't be. The syntax they give you on the boto3 docs is just showing you all of the possible filter terms. You need to separate the possible statuses with commas, not pipes. Alternatively if you want all cloudformation stacks, you can just omit the StackStatusFilter
parameter
Upvotes: 7