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


Python Template.to_json方法代码示例

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


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

示例1: test_mutualexclusion

# 需要导入模块: from troposphere import Template [as 别名]
# 或者: from troposphere.Template import to_json [as 别名]
 def test_mutualexclusion(self):
     t = Template()
     t.add_resource(FakeAWSObject(
         'fake', callcorrect=True, singlelist=[10])
     )
     with self.assertRaises(ValueError):
         t.to_json()
开发者ID:gscalise,项目名称:troposphere,代码行数:9,代码来源:test_basic.py

示例2: test_s3_filter

# 需要导入模块: from troposphere import Template [as 别名]
# 或者: from troposphere.Template import to_json [as 别名]
 def test_s3_filter(self):
     t = Template()
     t.add_resource(
         Function(
             "ProcessorFunction",
             Handler='process_file.handler',
             CodeUri='.',
             Runtime='python3.6',
             Policies='AmazonS3FullAccess',
             Events={
                 'FileUpload': S3Event(
                     'FileUpload',
                     Bucket="bucket",
                     Events=['s3:ObjectCreated:*'],
                     Filter=Filter(S3Key=S3Key(
                         Rules=[
                             Rules(Name="prefix", Value="upload/"),
                             Rules(Name="suffix", Value=".txt"),
                         ],
                     ))
                 )
             }
         )
     )
     t.to_json()
开发者ID:cigan1,项目名称:troposphere,代码行数:27,代码来源:test_serverless.py

示例3: test_simple_table

# 需要导入模块: from troposphere import Template [as 别名]
# 或者: from troposphere.Template import to_json [as 别名]
 def test_simple_table(self):
     serverless_table = SimpleTable(
         "SomeTable"
     )
     t = Template()
     t.add_resource(serverless_table)
     t.to_json()
开发者ID:cigan1,项目名称:troposphere,代码行数:9,代码来源:test_serverless.py

示例4: test_no_required

# 需要导入模块: from troposphere import Template [as 别名]
# 或者: from troposphere.Template import to_json [as 别名]
 def test_no_required(self):
     stack = Stack(
         "mystack",
     )
     t = Template()
     t.add_resource(stack)
     with self.assertRaises(ValueError):
         t.to_json()
开发者ID:3dsorcery,项目名称:troposphere,代码行数:10,代码来源:test_opsworks.py

示例5: test_api_no_definition

# 需要导入模块: from troposphere import Template [as 别名]
# 或者: from troposphere.Template import to_json [as 别名]
 def test_api_no_definition(self):
     serverless_api = Api(
         "SomeApi",
         StageName='test',
     )
     t = Template()
     t.add_resource(serverless_api)
     t.to_json()
开发者ID:cloudtools,项目名称:troposphere,代码行数:10,代码来源:test_serverless.py

示例6: test_required_api_definitionuri

# 需要导入模块: from troposphere import Template [as 别名]
# 或者: from troposphere.Template import to_json [as 别名]
 def test_required_api_definitionuri(self):
     serverless_api = Api(
         "SomeApi",
         StageName='test',
         DefinitionUri='s3://bucket/swagger.yml',
     )
     t = Template()
     t.add_resource(serverless_api)
     t.to_json()
开发者ID:cigan1,项目名称:troposphere,代码行数:11,代码来源:test_serverless.py

示例7: test_required_api_definitionbody

# 需要导入模块: from troposphere import Template [as 别名]
# 或者: from troposphere.Template import to_json [as 别名]
 def test_required_api_definitionbody(self):
     serverless_api = Api(
         "SomeApi",
         StageName='test',
         DefinitionBody=self.swagger,
     )
     t = Template()
     t.add_resource(serverless_api)
     t.to_json()
开发者ID:cigan1,项目名称:troposphere,代码行数:11,代码来源:test_serverless.py

示例8: test_required

# 需要导入模块: from troposphere import Template [as 别名]
# 或者: from troposphere.Template import to_json [as 别名]
 def test_required(self):
     stack = Stack(
         "mystack",
         DefaultInstanceProfileArn="instancearn",
         Name="myopsworksname",
         ServiceRoleArn="arn",
     )
     t = Template()
     t.add_resource(stack)
     t.to_json()
开发者ID:3dsorcery,项目名称:troposphere,代码行数:12,代码来源:test_opsworks.py

示例9: test_required_function

# 需要导入模块: from troposphere import Template [as 别名]
# 或者: from troposphere.Template import to_json [as 别名]
 def test_required_function(self):
     serverless_func = Function(
         "SomeHandler",
         Handler="index.handler",
         Runtime="nodejs",
         CodeUri="s3://bucket/handler.zip"
     )
     t = Template()
     t.add_resource(serverless_func)
     t.to_json()
开发者ID:cigan1,项目名称:troposphere,代码行数:12,代码来源:test_serverless.py

示例10: test_required_api_both

# 需要导入模块: from troposphere import Template [as 别名]
# 或者: from troposphere.Template import to_json [as 别名]
 def test_required_api_both(self):
     serverless_api = Api(
         "SomeApi",
         StageName='test',
         DefinitionUri='s3://bucket/swagger.yml',
         DefinitionBody=self.swagger,
     )
     t = Template()
     t.add_resource(serverless_api)
     with self.assertRaises(ValueError):
         t.to_json()
开发者ID:cigan1,项目名称:troposphere,代码行数:13,代码来源:test_serverless.py

示例11: test_optional_auto_publish_alias

# 需要导入模块: from troposphere import Template [as 别名]
# 或者: from troposphere.Template import to_json [as 别名]
 def test_optional_auto_publish_alias(self):
     serverless_func = Function(
         "SomeHandler",
         Handler="index.handler",
         Runtime="nodejs",
         CodeUri="s3://bucket/handler.zip",
         AutoPublishAlias="alias"
     )
     t = Template()
     t.add_resource(serverless_func)
     t.to_json()
开发者ID:cigan1,项目名称:troposphere,代码行数:13,代码来源:test_serverless.py

示例12: test_exclusive

# 需要导入模块: from troposphere import Template [as 别名]
# 或者: from troposphere.Template import to_json [as 别名]
 def test_exclusive(self):
     lambda_func = Function(
         "AMIIDLookup",
         Handler="index.handler",
         Role=GetAtt("LambdaExecutionRole", "Arn"),
         Code=Code(S3Bucket="lambda-functions", S3Key="amilookup.zip"),
         Runtime="nodejs",
         Timeout="25",
     )
     t = Template()
     t.add_resource(lambda_func)
     t.to_json()
开发者ID:RamSinha,项目名称:troposphere,代码行数:14,代码来源:test_awslambda.py

示例13: test_valid_data

# 需要导入模块: from troposphere import Template [as 别名]
# 或者: from troposphere.Template import to_json [as 别名]
 def test_valid_data(self):
     t = Template()
     cd = ecs.ContainerDefinition.from_dict("mycontainer", self.d)
     self.assertEquals(cd.Links[0], "containerA")
     td = ecs.TaskDefinition(
             "taskdef",
             ContainerDefinitions=[cd],
             Volumes=[ecs.Volume(Name="myvol")],
             TaskRoleArn=Ref(iam.Role("myecsrole"))
     )
     t.add_resource(td)
     t.to_json()
开发者ID:cloudtools,项目名称:troposphere,代码行数:14,代码来源:test_dict.py

示例14: test_s3_location

# 需要导入模块: from troposphere import Template [as 别名]
# 或者: from troposphere.Template import to_json [as 别名]
 def test_s3_location(self):
     serverless_func = Function(
         "SomeHandler",
         Handler="index.handler",
         Runtime="nodejs",
         CodeUri=S3Location(
             Bucket="mybucket",
             Key="mykey",
         )
     )
     t = Template()
     t.add_resource(serverless_func)
     t.to_json()
开发者ID:cigan1,项目名称:troposphere,代码行数:15,代码来源:test_serverless.py

示例15: test_optional_deployment_preference

# 需要导入模块: from troposphere import Template [as 别名]
# 或者: from troposphere.Template import to_json [as 别名]
 def test_optional_deployment_preference(self):
     serverless_func = Function(
         "SomeHandler",
         Handler="index.handler",
         Runtime="nodejs",
         CodeUri="s3://bucket/handler.zip",
         AutoPublishAlias="alias",
         DeploymentPreference=DeploymentPreference(
             Type="AllAtOnce"
         )
     )
     t = Template()
     t.add_resource(serverless_func)
     t.to_json()
开发者ID:cigan1,项目名称:troposphere,代码行数:16,代码来源:test_serverless.py


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