當前位置: 首頁>>代碼示例>>Python>>正文


Python troposphere.Tags方法代碼示例

本文整理匯總了Python中troposphere.Tags方法的典型用法代碼示例。如果您正苦於以下問題:Python troposphere.Tags方法的具體用法?Python troposphere.Tags怎麽用?Python troposphere.Tags使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在troposphere的用法示例。


在下文中一共展示了troposphere.Tags方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: create_autoscaling_group

# 需要導入模塊: import troposphere [as 別名]
# 或者: from troposphere import Tags [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

示例2: prepare_efs_security_groups

# 需要導入模塊: import troposphere [as 別名]
# 或者: from troposphere import Tags [as 別名]
def prepare_efs_security_groups(self):
        t = self.template
        v = self.get_variables()

        created_groups = []
        for sg in v['SecurityGroups']:
            sg.VpcId = v['VpcId']
            sg.Tags = merge_tags(v['Tags'], getattr(sg, 'Tags', {}))

            sg = t.add_resource(sg)
            created_groups.append(sg)

        created_group_ids = list(map(Ref, created_groups))
        t.add_output(Output(
            'EfsNewSecurityGroupIds',
            Value=Join(',', created_group_ids)))

        groups_ids = created_group_ids + v['ExtraSecurityGroups']
        return groups_ids 
開發者ID:remind101,項目名稱:stacker_blueprints,代碼行數:21,代碼來源:efs.py

示例3: __init__

# 需要導入模塊: import troposphere [as 別名]
# 或者: from troposphere import Tags [as 別名]
def __init__(self, definition, **kwargs):
        super().__init__(definition.name, **kwargs)
        self.Content = definition.ssm_document()
        self.Tags = Tags(definition.get_metadata()) 
開發者ID:awslabs,項目名稱:aws-systems-manager-document-generator,代碼行數:6,代碼來源:definition_troposphere_adapter.py

示例4: tags

# 需要導入模塊: import troposphere [as 別名]
# 或者: from troposphere import Tags [as 別名]
def tags(self):
        """Return tags that should be applied to any resource being created.

        Returns:
            troposphere.Tags

        """
        return Tags(**dict(self.context.tags, **self.args.tags.data)) 
開發者ID:onicagroup,項目名稱:runway,代碼行數:10,代碼來源:base.py

示例5: merge_tags

# 需要導入模塊: import troposphere [as 別名]
# 或者: from troposphere import Tags [as 別名]
def merge_tags(left, right, factory=Tags):
    """
    Merge two sets of tags into a new troposphere object

    Args:
        left (Union[dict, troposphere.Tags]): dictionary or Tags object to be
            merged with lower priority
        right (Union[dict, troposphere.Tags]): dictionary or Tags object to be
            merged with higher priority
        factory (type): Type of object to create. Defaults to the troposphere
            Tags class.
    """

    if isinstance(left, Mapping):
        tags = dict(left)
    elif hasattr(left, 'tags'):
        tags = _tags_to_dict(left.tags)
    else:
        tags = _tags_to_dict(left)

    if isinstance(right, Mapping):
        tags.update(right)
    elif hasattr(left, 'tags'):
        tags.update(_tags_to_dict(right.tags))
    else:
        tags.update(_tags_to_dict(right))

    return factory(**tags) 
開發者ID:remind101,項目名稱:stacker_blueprints,代碼行數:30,代碼來源:util.py

示例6: create_efs_filesystem

# 需要導入模塊: import troposphere [as 別名]
# 或者: from troposphere import Tags [as 別名]
def create_efs_filesystem(self):
        t = self.template
        v = self.get_variables()

        fs = t.add_resource(efs.FileSystem(
            'EfsFileSystem',
            FileSystemTags=Tags(v['Tags']),
            PerformanceMode=v['PerformanceMode']))

        t.add_output(Output(
            'EfsFileSystemId',
            Value=Ref(fs)))

        return fs 
開發者ID:remind101,項目名稱:stacker_blueprints,代碼行數:16,代碼來源:efs.py


注:本文中的troposphere.Tags方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。