本文整理汇总了Python中cfn_sphere.aws.cfn.CloudFormation.wait_for_stack_events方法的典型用法代码示例。如果您正苦于以下问题:Python CloudFormation.wait_for_stack_events方法的具体用法?Python CloudFormation.wait_for_stack_events怎么用?Python CloudFormation.wait_for_stack_events使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cfn_sphere.aws.cfn.CloudFormation
的用法示例。
在下文中一共展示了CloudFormation.wait_for_stack_events方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_wait_for_stack_event_returns_on_update_complete
# 需要导入模块: from cfn_sphere.aws.cfn import CloudFormation [as 别名]
# 或者: from cfn_sphere.aws.cfn.CloudFormation import wait_for_stack_events [as 别名]
def test_wait_for_stack_event_returns_on_update_complete(self, cloudformation_mock):
timestamp = datetime.datetime.utcnow()
template_mock = Mock(spec=CloudFormationTemplate)
template_mock.url = "foo.yml"
template_mock.get_template_body_dict.return_value = {}
event = StackEvent()
event.resource_type = "AWS::CloudFormation::Stack"
event.resource_status = "UPDATE_COMPLETE"
event.event_id = "123"
event.timestamp = timestamp
stack_events_mock = Mock()
stack_events_mock.describe_stack_events.return_value = [event]
cloudformation_mock.connect_to_region.return_value = stack_events_mock
cfn = CloudFormation()
cfn.wait_for_stack_events("foo", "UPDATE_COMPLETE", timestamp - timedelta(seconds=10),
timeout=10)
示例2: test_wait_for_stack_event_raises_exception_on_rollback
# 需要导入模块: from cfn_sphere.aws.cfn import CloudFormation [as 别名]
# 或者: from cfn_sphere.aws.cfn.CloudFormation import wait_for_stack_events [as 别名]
def test_wait_for_stack_event_raises_exception_on_rollback(self, cloudformation_mock):
timestamp = datetime.datetime.utcnow()
template_mock = Mock(spec=CloudFormationTemplate)
template_mock.url = "foo.yml"
template_mock.get_template_body_dict.return_value = {}
event = StackEvent()
event.resource_type = "AWS::CloudFormation::Stack"
event.resource_status = "ROLLBACK_COMPLETE"
event.event_id = "123"
event.timestamp = timestamp
stack_events_mock = Mock()
stack_events_mock.describe_stack_events.return_value = [event]
cloudformation_mock.connect_to_region.return_value = stack_events_mock
cfn = CloudFormation()
with self.assertRaises(Exception):
cfn.wait_for_stack_events("foo", ["UPDATE_COMPLETE"], timestamp - timedelta(seconds=10),
timeout=10)
示例3: test_wait_for_stack_event_returns_on_start_event_with_valid_timestamp
# 需要导入模块: from cfn_sphere.aws.cfn import CloudFormation [as 别名]
# 或者: from cfn_sphere.aws.cfn.CloudFormation import wait_for_stack_events [as 别名]
def test_wait_for_stack_event_returns_on_start_event_with_valid_timestamp(self, cloudformation_mock):
timestamp = datetime.datetime.utcnow()
template_mock = Mock(spec=CloudFormationTemplate)
template_mock.url = "foo.yml"
template_mock.get_template_body_dict.return_value = {}
event = StackEvent()
event.resource_type = "AWS::CloudFormation::Stack"
event.resource_status = "UPDATE_IN_PROGRESS"
event.event_id = "123"
event.timestamp = timestamp
stack_events_mock = Mock()
stack_events_mock.describe_stack_events.return_value = [event]
cloudformation_mock.connect_to_region.return_value = stack_events_mock
cfn = CloudFormation()
event = cfn.wait_for_stack_events("foo", "UPDATE_IN_PROGRESS",
timestamp - timedelta(seconds=10),
timeout=10)
self.assertEqual(timestamp, event.timestamp)