本文整理汇总了Python中boto.ec2.volume.Volume.zone方法的典型用法代码示例。如果您正苦于以下问题:Python Volume.zone方法的具体用法?Python Volume.zone怎么用?Python Volume.zone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boto.ec2.volume.Volume
的用法示例。
在下文中一共展示了Volume.zone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_template_ebs_volume
# 需要导入模块: from boto.ec2.volume import Volume [as 别名]
# 或者: from boto.ec2.volume.Volume import zone [as 别名]
def _create_template_ebs_volume(self, operation):
"""
Helper function to create template EBS volume to work on.
:param NamedConstant operation: Intended use of created template.
A value from ``VolumeOperations``.
:returns: Suitable volume in the right start state for input operation.
:rtype: boto.ec2.volume.Volume
"""
volume = EbsVolume()
# Irrelevant volume attributes.
volume.id = u'vol-9c48a689'
volume.create_time = u'2015-07-14T22:46:00.447Z'
volume.size = 1
volume.snapshot_id = ''
volume.zone = u'us-west-2b'
volume.type = u'standard'
volume_state_table = VolumeStateTable()
state_flow = volume_state_table.table[operation]
start_state = state_flow.start_state.value
# Interesting volume attribute.
volume.status = start_state
return volume
示例2: create_volume
# 需要导入模块: from boto.ec2.volume import Volume [as 别名]
# 或者: from boto.ec2.volume.Volume import zone [as 别名]
def create_volume(self, size, zone, **kwargs):
volume = Volume()
volume.id = 'vol-' + new_id()
volume.size = size
volume.zone = zone
volume.status = 'available'
self.volumes[volume.id] = volume
return volume