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


Python Template.add_vpcflowlogs_role方法代码示例

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


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

示例1: EnvironmentBase

# 需要导入模块: from template import Template [as 别名]
# 或者: from template.Template import add_vpcflowlogs_role [as 别名]

#.........这里部分代码省略.........

        # Configure Template class with S3 settings from config
        Template.template_bucket_default = self.template_args.get('s3_bucket')
        Template.s3_path_prefix = self.s3_prefix()
        Template.stack_timeout = self.template_args.get("timeout_in_minutes")
        Template.upload_acl = self.template_args.get('s3_upload_acl')
        Template.include_timestamp = self.template_args.get('include_timestamp')

        Template.include_templateValidationHash_output = self.template_args.get('include_templateValidationHash_output')
        Template.include_dateGenerated_output = self.template_args.get('include_dateGenerated_output')

        # Create the root template object
        self.template = Template(self.globals.get('environment_name', 'default_template'))
        self.template.description = self.template_args.get('description', 'No Description Specified')
        self.template.resource_path = self._root_template_path()

        ec2_key = self.config.get('template').get('ec2_key_default', 'default-key')
        self.template._ec2_key = self.template.add_parameter(Parameter(
           'ec2Key',
            Type='String',
            Default=ec2_key,
            Description='Name of an existing EC2 KeyPair to enable SSH access to the instances',
            AllowedPattern=res.get_str('ec2_key'),
            MinLength=1,
            MaxLength=255,
            ConstraintDescription=res.get_str('ec2_key_message')
        ))

        bucket_name = self.config.get('logging').get('s3_bucket')

        self.template.add_utility_bucket(name=bucket_name)

        self.template.add_log_group()
        self.template.add_vpcflowlogs_role()

        ami_filename = self.config['template'].get('ami_map_file')
        if ami_filename:
            ami_cache = res.load_yaml_file(ami_filename)
            self.template.add_ami_mapping(ami_cache)

    def generate_ami_cache(self):
        """
        Generate ami_cache.json file from defaults
        """
        ami_cache_filename = res.DEFAULT_AMI_CACHE_FILENAME + res.EXTENSIONS[0]

        if os.path.isfile(ami_cache_filename):
            overwrite = raw_input("%s already exists. Overwrite? (y/n) " % ami_cache_filename).lower()
            print
            if not overwrite == 'y':
                return

        with open(ami_cache_filename, 'w') as f:
            f.write(json.dumps(res.FACTORY_DEFAULT_AMI_CACHE, indent=4, separators=(',', ': ')))
            print "Generated AMI cache file at %s\n" % ami_cache_filename

    def to_json(self):
        """
        Centralized method for outputting the root template with a timestamp identifying when it
        was generated and for creating a SHA256 hash representing the template for validation purposes
        Also recursively processess all child templates
        """
        return self.template.to_template_json()

    # Called after add_child_template() has attached common parameters and some instance attributes:
    # - RegionMap: Region to AMI map, allows template to be deployed in different regions without updating AMI ids
开发者ID:devonartis,项目名称:cloudformation-environmentbase,代码行数:70,代码来源:environmentbase.py


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