當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。