本文整理汇总了Python中boto3.Session.get_available_regions方法的典型用法代码示例。如果您正苦于以下问题:Python Session.get_available_regions方法的具体用法?Python Session.get_available_regions怎么用?Python Session.get_available_regions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boto3.Session
的用法示例。
在下文中一共展示了Session.get_available_regions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: stop_configuration_recorder
# 需要导入模块: from boto3 import Session [as 别名]
# 或者: from boto3.Session import get_available_regions [as 别名]
def stop_configuration_recorder(self, recorder_name):
if not self.recorders.get(recorder_name):
raise NoSuchConfigurationRecorderException(recorder_name)
# Stop recording:
self.recorders[recorder_name].status.stop()
def delete_configuration_recorder(self, recorder_name):
if not self.recorders.get(recorder_name):
raise NoSuchConfigurationRecorderException(recorder_name)
del self.recorders[recorder_name]
def delete_delivery_channel(self, channel_name):
if not self.delivery_channels.get(channel_name):
raise NoSuchDeliveryChannelException(channel_name)
# Check if a channel is recording -- if so, bad -- (there can only be 1 recorder):
for recorder in self.recorders.values():
if recorder.status.recording:
raise LastDeliveryChannelDeleteFailedException(channel_name)
del self.delivery_channels[channel_name]
config_backends = {}
boto3_session = Session()
for region in boto3_session.get_available_regions('config'):
config_backends[region] = ConfigBackend()
示例2: _get_regions
# 需要导入模块: from boto3 import Session [as 别名]
# 或者: from boto3.Session import get_available_regions [as 别名]
def _get_regions(self):
s = Session()
return s.get_available_regions("ec2")