本文整理汇总了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)]))
示例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
示例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))
示例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)
示例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