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


Python PythonPackageArchive.add_py_file方法代码示例

本文整理汇总了Python中c7n.mu.PythonPackageArchive.add_py_file方法的典型用法代码示例。如果您正苦于以下问题:Python PythonPackageArchive.add_py_file方法的具体用法?Python PythonPackageArchive.add_py_file怎么用?Python PythonPackageArchive.add_py_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在c7n.mu.PythonPackageArchive的用法示例。


在下文中一共展示了PythonPackageArchive.add_py_file方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_function

# 需要导入模块: from c7n.mu import PythonPackageArchive [as 别名]
# 或者: from c7n.mu.PythonPackageArchive import add_py_file [as 别名]
def get_function(session_factory, name, role, sns_topic, log_groups,
                 subject="Lambda Error", pattern="Traceback"):
    """Lambda function provisioning.

    Self contained within the component, to allow for easier reuse.
    """

    # Lazy import to avoid runtime dependency
    from c7n.mu import (
        LambdaFunction, PythonPackageArchive, CloudWatchLogSubscription)

    config = dict(
        name=name,
        handler='logsub.process_log_event',
        runtime='python2.7',
        memory_size=512,
        timeout=15,
        role=role,
        description='Custodian Ops Error Notify',
        events=[
            CloudWatchLogSubscription(
                session_factory, log_groups, pattern)])

    archive = PythonPackageArchive()
    archive.add_py_file(__file__)
    archive.add_contents(
        'config.json', json.dumps({
            'topic': sns_topic,
            'subject': subject
        }))
    archive.close()

    return LambdaFunction(config, archive)
开发者ID:naveenb29,项目名称:cloud-custodian,代码行数:35,代码来源:logsub.py

示例2: get_function

# 需要导入模块: from c7n.mu import PythonPackageArchive [as 别名]
# 或者: from c7n.mu.PythonPackageArchive import add_py_file [as 别名]
def get_function(session_factory, name, role, events):
    from c7n.mu import (LambdaFunction, PythonPackageArchive)

    config = dict(
        name=name,
        handler='helloworld.main',
        runtime='python2.7',
        memory_size=512,
        timeout=15,
        role=role,
        description='Hello World',
        events=events)

    archive = PythonPackageArchive()
    archive.add_py_file(__file__)
    archive.close()

    return LambdaFunction(config, archive)
开发者ID:naveenb29,项目名称:cloud-custodian,代码行数:20,代码来源:helloworld.py

示例3: test_reverts_to_py_if_available

# 需要导入模块: from c7n.mu import PythonPackageArchive [as 别名]
# 或者: from c7n.mu.PythonPackageArchive import add_py_file [as 别名]
 def test_reverts_to_py_if_available(self):
     archive = PythonPackageArchive()
     py = self.py_with_pyc('foo.py')
     archive.add_py_file(py+'c')
     archive.close()
     self.assertEqual(archive.get_filenames(), ['foo.py'])
开发者ID:JJediny,项目名称:cloud-custodian,代码行数:8,代码来源:test_mu.py

示例4: test_can_add_py_file

# 需要导入模块: from c7n.mu import PythonPackageArchive [as 别名]
# 或者: from c7n.mu.PythonPackageArchive import add_py_file [as 别名]
 def test_can_add_py_file(self):
     archive = PythonPackageArchive()
     archive.add_py_file(self.py_with_pyc('foo.py'))
     archive.close()
     self.assertEqual(archive.get_filenames(), ['foo.py'])
开发者ID:JJediny,项目名称:cloud-custodian,代码行数:7,代码来源:test_mu.py


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