当前位置: 首页>>代码示例>>Python>>正文


Python CloudFormation.wait_for_stack_events方法代码示例

本文整理汇总了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)
开发者ID:oliver-schoenherr,项目名称:cfn-sphere,代码行数:23,代码来源:cfn_tests.py

示例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)
开发者ID:oliver-schoenherr,项目名称:cfn-sphere,代码行数:24,代码来源:cfn_tests.py

示例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)
开发者ID:oliver-schoenherr,项目名称:cfn-sphere,代码行数:26,代码来源:cfn_tests.py


注:本文中的cfn_sphere.aws.cfn.CloudFormation.wait_for_stack_events方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。