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


Python troposphere.GetAtt方法代码示例

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


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

示例1: add_cname

# 需要导入模块: import troposphere [as 别名]
# 或者: from troposphere import GetAtt [as 别名]
def add_cname(self):
        """
        Wrapper method to encapsulate process of creating a CNAME DNS record for the ELB
        Requires InternalHostedZone parameter
        Sets self.cname_record with the record resource
        """

        if not self.cname:
            return

        hosted_zone = self.add_parameter(Parameter(
            'InternalHostedZone',
            Description='Internal Hosted Zone Name',
            Type='String'))

        self.cname_record = self.add_resource(route53.RecordSetType(
            self.name.lower() + 'DnsRecord',
            HostedZoneId=Ref(hosted_zone),
            Comment='CNAME record for %s' % self.name,
            Name=self.cname,
            Type='CNAME',
            TTL='300',
            ResourceRecords=[GetAtt(self.cluster_elb, 'DNSName')])) 
开发者ID:DualSpark,项目名称:cloudformation-environmentbase,代码行数:25,代码来源:ha_cluster.py

示例2: create_autoscaling_group

# 需要导入模块: import troposphere [as 别名]
# 或者: from troposphere import GetAtt [as 别名]
def create_autoscaling_group(self):
        t = self.template
        t.add_resource(
            autoscaling.LaunchConfiguration(
                "EmpireMinionLaunchConfig",
                IamInstanceProfile=GetAtt("EmpireMinionProfile", "Arn"),
                ImageId=FindInMap(
                    "AmiMap",
                    Ref("AWS::Region"),
                    Ref("ImageName")),
                BlockDeviceMappings=self.build_block_device(),
                InstanceType=Ref("InstanceType"),
                KeyName=Ref("SshKeyName"),
                UserData=self.generate_user_data(),
                SecurityGroups=[Ref("DefaultSG"), Ref(CLUSTER_SG_NAME)]))
        t.add_resource(
            autoscaling.AutoScalingGroup(
                "EmpireMinionAutoscalingGroup",
                AvailabilityZones=Ref("AvailabilityZones"),
                LaunchConfigurationName=Ref("EmpireMinionLaunchConfig"),
                MinSize=Ref("MinHosts"),
                MaxSize=Ref("MaxHosts"),
                VPCZoneIdentifier=Ref("PrivateSubnets"),
                Tags=[ASTag("Name", "empire_minion", True)])) 
开发者ID:remind101,项目名称:stacker_blueprints,代码行数:26,代码来源:minion.py

示例3: add_role

# 需要导入模块: import troposphere [as 别名]
# 或者: from troposphere import GetAtt [as 别名]
def add_role(c, RoleName, model, named=False):
    cfn_name = scrub_name(RoleName + "Role")
    kw_args = {
        "Path": "/",
        "AssumeRolePolicyDocument": build_role_trust(c, model['trusts']),
        "ManagedPolicyArns": [],
        "Policies": []
    }

    if named:
        kw_args["RoleName"] = RoleName

    if "managed_policies" in model:
        kw_args["ManagedPolicyArns"] = parse_managed_policies(
                                        c, model["managed_policies"], RoleName)

    if "max_role_duration" in model:
        kw_args['MaxSessionDuration'] = int(model["max_role_duration"])

    if "retain_on_delete" in model:
        if model["retain_on_delete"] is True:
            kw_args["DeletionPolicy"] = "Retain"

    c.template[c.current_account].add_resource(Role(
        cfn_name,
        **kw_args
    ))
    if c.config['global']['template_outputs'] == "enabled":
        c.template[c.current_account].add_output([
            Output(
                cfn_name + "Arn",
                Description="Role " + RoleName + " ARN",
                Value=GetAtt(cfn_name, "Arn"),
                Export=Export(Sub("${AWS::StackName}-" + cfn_name + "Arn"))
            )
        ]) 
开发者ID:awslabs,项目名称:aws-iam-generator,代码行数:38,代码来源:iam_template_build.py

示例4: add_group

# 需要导入模块: import troposphere [as 别名]
# 或者: from troposphere import GetAtt [as 别名]
def add_group(c, GroupName, model, named=False):
    cfn_name = scrub_name(GroupName + "Group")
    kw_args = {
        "Path": "/",
        "ManagedPolicyArns": [],
        "Policies": []
    }

    if named:
        kw_args["GroupName"] = GroupName

    if "managed_policies" in model:
        kw_args["ManagedPolicyArns"] = parse_managed_policies(
            c,
            model["managed_policies"], GroupName
        )

    if "retain_on_delete" in model:
        if model["retain_on_delete"] is True:
            kw_args["DeletionPolicy"] = "Retain"

    c.template[c.current_account].add_resource(Group(
        scrub_name(cfn_name),
        **kw_args
    ))
    if c.config['global']['template_outputs'] == "enabled":
        c.template[c.current_account].add_output([
            Output(
                cfn_name + "Arn",
                Description="Group " + GroupName + " ARN",
                Value=GetAtt(cfn_name, "Arn"),
                Export=Export(Sub("${AWS::StackName}-" + cfn_name + "Arn"))
            )
        ]) 
开发者ID:awslabs,项目名称:aws-iam-generator,代码行数:36,代码来源:iam_template_build.py

示例5: add_outputs

# 需要导入模块: import troposphere [as 别名]
# 或者: from troposphere import GetAtt [as 别名]
def add_outputs(self):
        """
        Wrapper method to encapsulate creation of stack outputs for this template
        """
        self.add_output(Output('%sELBDNSName' % self.name, Value=GetAtt(self.cluster_elb, 'DNSName')))
        self.add_output(Output('%sSecurityGroupId' % self.name, Value=Ref(self.security_groups['ha_cluster'])))
        self.add_output(Output('%sElbSecurityGroupId' % self.name, Value=Ref(self.security_groups['elb']))) 
开发者ID:DualSpark,项目名称:cloudformation-environmentbase,代码行数:9,代码来源:ha_cluster.py

示例6: build_hook

# 需要导入模块: import troposphere [as 别名]
# 或者: from troposphere import GetAtt [as 别名]
def build_hook(self):
        """
        Hook to add tier-specific assets within the build stage of initializing this class.
        """

        if not self.dist_config:
            self.dist_config = DistributionConfig(
                Origins=[Origin(
                    Id="Origin",
                    DomainName=self.domain_name,
                    OriginPath=self.origin_path,
                    S3OriginConfig=S3Origin(),
                )],
                DefaultCacheBehavior=DefaultCacheBehavior(
                    TargetOriginId="Origin",
                    ForwardedValues=ForwardedValues(
                        QueryString=False
                    ),
                    ViewerProtocolPolicy="allow-all"),
                Enabled=True
            )

        if self.utility_bucket:
            self.dist_config.Logging = Logging(
                Bucket=Join('.', [self.utility_bucket, 's3.amazonaws.com']),
                IncludeCookies=True,
                Prefix=Join('/', ['AWSLogs', Ref(AWS_ACCOUNT_ID), 'CloudFront'])
            )

        cf_distribution = self.add_resource(Distribution(
            self.resource_name,
            DistributionConfig=self.dist_config
        ))

        self.add_output([
            Output("DistributionId", Value=Ref(cf_distribution)),
            Output("DistributionName", Value=Join("", ["http://", GetAtt(cf_distribution, "DomainName")])),
        ]) 
开发者ID:DualSpark,项目名称:cloudformation-environmentbase,代码行数:40,代码来源:cloudfront.py

示例7: build_hook

# 需要导入模块: import troposphere [as 别名]
# 或者: from troposphere import GetAtt [as 别名]
def build_hook(self):
        """
        Hook to add tier-specific assets within the build stage of initializing this class.
        """
        security_groups = self.add_security_groups()

        bastion_elb = self.add_elb(
            resource_name=self.name,
            security_groups=[security_groups['elb']],
            listeners=[{
                'elb_port': self.ingress_port,
                'instance_port': SSH_PORT
            }],
            utility_bucket=self.utility_bucket
        )

        bastion_asg = self.add_asg(
            layer_name=self.name,
            security_groups=[security_groups['bastion'], self.common_security_group],
            load_balancer=bastion_elb,
            user_data=self.user_data,
            instance_type=self.instance_type
        )

        self.add_output(Output(
            'BastionELBDNSName',
            Value=GetAtt(bastion_elb, 'DNSName')
        ))

        self.add_output(Output(
            'BastionELBDNSZoneId',
             Value=GetAtt(bastion_elb, 'CanonicalHostedZoneNameID')
         ))

        self.add_output(Output(
            'BastionSecurityGroupId',
            Value=Ref(security_groups['bastion'])
        )) 
开发者ID:DualSpark,项目名称:cloudformation-environmentbase,代码行数:40,代码来源:bastion.py

示例8: add_child_outputs_to_parameter_binding

# 需要导入模块: import troposphere [as 别名]
# 或者: from troposphere import GetAtt [as 别名]
def add_child_outputs_to_parameter_binding(self, child_template, propagate_up=False):
        """
        This auto-wires the outputs of the child stack to the manual_param of the parent stack
        """
        for output in child_template.outputs:
            self.manual_parameter_bindings[output] = GetAtt(child_template.name, "Outputs." + output)
            if propagate_up:
                self.add_output(Output(output, Value=GetAtt(child_template.name, "Outputs." + output)))
            # TODO: should a custom resource be addeded for each output? 
开发者ID:DualSpark,项目名称:cloudformation-environmentbase,代码行数:11,代码来源:template.py

示例9: match_stack_parameters

# 需要导入模块: import troposphere [as 别名]
# 或者: from troposphere import GetAtt [as 别名]
def match_stack_parameters(self, child_template):
        """
        For all matching parameters between this template and the child template, attempt to
        get the value from this template's parameters, resources, and manual parameter bindings.
        Return the dictionary of stack parameters to deploy the child template with
        """
        stack_params = {}

        for parameter in child_template.parameters.keys():

            # Manual parameter bindings single-namespace
            if parameter in self.manual_parameter_bindings:
                manual_match = self.manual_parameter_bindings[parameter]
                stack_params[parameter] = manual_match

            # Match any child stack parameters that have the same name as this stacks **parameters**
            elif parameter in self.parameters.keys():
                param_match = self.parameters.get(parameter)
                stack_params[parameter] = Ref(param_match)

            # Match any child stack parameters that have the same name as this stacks **resources**
            elif parameter in self.resources.keys():
                resource_match = self.resources.get(parameter)
                stack_params[parameter] = Ref(resource_match)

            # # Match any child stack parameters that have the same name as a top-level **stack_output**
            # TODO: Enable Output autowiring
            # elif parameter in self.stack_outputs:
            #     stack_params[parameter] = GetAtt(self.stack_outputs[parameter], 'Outputs.' + parameter)

            # Finally if nothing else matches copy the child templates parameter to this template's parameter list
            # so the value will pass through this stack down to the child.
            else:
                new_param = self.add_parameter(child_template.parameters[parameter])
                stack_params[parameter] = Ref(new_param)

        return stack_params 
开发者ID:DualSpark,项目名称:cloudformation-environmentbase,代码行数:39,代码来源:template.py

示例10: create_hook

# 需要导入模块: import troposphere [as 别名]
# 或者: from troposphere import GetAtt [as 别名]
def create_hook(self):
        super(NetworkBase, self).create_hook()

        network_config = self.config.get('network', {})
        nat_config = self.config.get('nat')

        base_network_template = BaseNetwork('BaseNetwork', network_config, nat_config)
        self.add_child_template(base_network_template)

        self.template._subnets = base_network_template._subnets.copy()
        self.template._vpc_id = GetAtt(base_network_template.name, 'Outputs.vpcId') 
开发者ID:DualSpark,项目名称:cloudformation-environmentbase,代码行数:13,代码来源:networkbase.py

示例11: __init__

# 需要导入模块: import troposphere [as 别名]
# 或者: from troposphere import GetAtt [as 别名]
def __init__(self, title, template=None, *args, **kwargs):
        super(Certificate, self).__init__(
            title, template, *args, ServiceToken=GetAtt(CERTIFICATE_LAMBDA, 'Arn'), **kwargs
        ) 
开发者ID:dflook,项目名称:cloudformation-dns-certificate,代码行数:6,代码来源:certificatemanager.py

示例12: create_delivery_stream

# 需要导入模块: import troposphere [as 别名]
# 或者: from troposphere import GetAtt [as 别名]
def create_delivery_stream(self):
        t = self.template
        variables = self.get_variables()

        s3_dest_config = firehose.S3Configuration(
            **self.s3_destination_config_dict()
        )

        redshift_config = firehose.RedshiftDestinationConfiguration(
            RoleARN=GetAtt(self.role, "Arn"),
            ClusterJDBCURL=variables['JDBCURL'],
            CopyCommand=firehose.CopyCommand(
                CopyOptions=variables["CopyOptions"],
                DataTableName=variables['TableName']
            ),
            Username=variables['Username'],
            Password=variables['Password'].ref,
            S3Configuration=s3_dest_config,
            CloudWatchLoggingOptions=self.cloudwatch_logging_options(
                self.log_group,
                self.redshift_log_stream
            )
        )

        self.delivery_stream = t.add_resource(
            firehose.DeliveryStream(
                DELIVERY_STREAM,
                RedshiftDestinationConfiguration=redshift_config
            )
        ) 
开发者ID:remind101,项目名称:stacker_blueprints,代码行数:32,代码来源:redshift.py

示例13: test_create_template

# 需要导入模块: import troposphere [as 别名]
# 或者: from troposphere import GetAtt [as 别名]
def test_create_template(self):
        blueprint = SubscriptionFilters(
            'test_cloudwatch_logs_subscription_filters',
            self.ctx
        )

        blueprint.resolve_variables(
            [
                Variable(
                    "SubscriptionFilters",
                    {
                        "Filter1": {
                            "DestinationArn": GetAtt("KinesisStream1", "Arn"),
                            "FilterPattern": "{$.userIdentity.type = Root}",
                            "LogGroupName": Ref("LogGroup1"),
                        },
                        "Filter2": {
                            "DestinationArn": GetAtt("KinesisStream2", "Arn"),
                            "FilterPattern": "{$.userIdentity.type = Root}",
                            "LogGroupName": Ref("LogGroup2"),
                        },
                    }
                )
            ]
        )
        blueprint.create_template()
        self.assertRenderedBlueprint(blueprint) 
开发者ID:remind101,项目名称:stacker_blueprints,代码行数:29,代码来源:test_cloudwatch_logs.py

示例14: add_user

# 需要导入模块: import troposphere [as 别名]
# 或者: from troposphere import GetAtt [as 别名]
def add_user(c, UserName, model, named=False):
    cfn_name = scrub_name(UserName + "User")
    kw_args = {
        "Path": "/",
        "Groups": [],
        "ManagedPolicyArns": [],
        "Policies": [],
    }

    if named:
        kw_args["UserName"] = UserName

    if "groups" in model:
        kw_args["Groups"] = parse_imports(c, "user", model["groups"])

    if "managed_policies" in model:
        kw_args["ManagedPolicyArns"] = parse_managed_policies(
                c,
                model["managed_policies"],
                UserName
            )

    if "password" in model:
        kw_args["LoginProfile"] = LoginProfile(
            Password=model["password"],
            PasswordResetRequired=True
        )

    if "retain_on_delete" in model:
        if model["retain_on_delete"] is True:
            kw_args["DeletionPolicy"] = "Retain"

    c.template[c.current_account].add_resource(User(
        cfn_name,
        **kw_args
    ))
    if c.config['global']['template_outputs'] == "enabled":
        c.template[c.current_account].add_output([
            Output(
                cfn_name + "Arn",
                Description="User " + UserName + " ARN",
                Value=GetAtt(cfn_name, "Arn"),
                Export=Export(Sub("${AWS::StackName}-" + cfn_name + "Arn"))
            )
        ]) 
开发者ID:awslabs,项目名称:aws-iam-generator,代码行数:47,代码来源:iam_template_build.py

示例15: _pipeline_role

# 需要导入模块: import troposphere [as 别名]
# 或者: from troposphere import GetAtt [as 别名]
def _pipeline_role(buckets: Iterable[s3.Bucket]) -> iam.Role:
    """Build and return the IAM Role resource to be used by CodePipeline to run the pipeline."""
    bucket_statements = [
        AWS.Statement(
            Effect=AWS.Allow,
            Action=[S3.GetBucketVersioning, S3.PutBucketVersioning],
            Resource=[GetAtt(bucket, "Arn") for bucket in buckets],
        ),
        AWS.Statement(
            Effect=AWS.Allow,
            Action=[S3.GetObject, S3.PutObject],
            Resource=[Sub("${{{bucket}.Arn}}/*".format(bucket=bucket.title)) for bucket in buckets],
        ),
    ]
    policy = iam.Policy(
        "PipelinePolicy",
        PolicyName="PipelinePolicy",
        PolicyDocument=AWS.PolicyDocument(
            Statement=bucket_statements
            + [
                AllowEverywhere(Action=[CLOUDWATCH.Action("*"), IAM.PassRole]),
                AllowEverywhere(Action=[LAMBDA.InvokeFunction, LAMBDA.ListFunctions]),
                AllowEverywhere(
                    Action=[
                        CLOUDFORMATION.CreateStack,
                        CLOUDFORMATION.DeleteStack,
                        CLOUDFORMATION.DescribeStacks,
                        CLOUDFORMATION.UpdateStack,
                        CLOUDFORMATION.CreateChangeSet,
                        CLOUDFORMATION.DeleteChangeSet,
                        CLOUDFORMATION.DescribeChangeSet,
                        CLOUDFORMATION.ExecuteChangeSet,
                        CLOUDFORMATION.SetStackPolicy,
                        CLOUDFORMATION.ValidateTemplate,
                    ]
                ),
                AllowEverywhere(Action=[CODEBUILD.BatchGetBuilds, CODEBUILD.StartBuild]),
            ]
        ),
    )
    return iam.Role(
        "CodePipelinesRole", AssumeRolePolicyDocument=_service_assume_role(CODEPIPELINE.prefix), Policies=[policy]
    ) 
开发者ID:aws,项目名称:aws-encryption-sdk-python,代码行数:45,代码来源:pipeline.py


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