本文整理汇总了Python中boto.vpc.VPCConnection.get_all_vpn_gateways方法的典型用法代码示例。如果您正苦于以下问题:Python VPCConnection.get_all_vpn_gateways方法的具体用法?Python VPCConnection.get_all_vpn_gateways怎么用?Python VPCConnection.get_all_vpn_gateways使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boto.vpc.VPCConnection
的用法示例。
在下文中一共展示了VPCConnection.get_all_vpn_gateways方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: zones_rm
# 需要导入模块: from boto.vpc import VPCConnection [as 别名]
# 或者: from boto.vpc.VPCConnection import get_all_vpn_gateways [as 别名]
# Zones
maps['zones'].append(
zones_rm(
region_id, ec2regionconn.get_all_zones())
)
# VPCs
maps['VPCs'].append(
vpcs_rm(
region_id, vpcregionconn.get_all_vpcs())
)
# VPNGateways
maps['VPNGateways'].append(
vpn_gateways_rm(
region_id, vpcregionconn.get_all_vpn_gateways()
)
)
if sqsconnection:
maps['queues'].append(vpn_queues_rm(
region_id, sqsconnection.get_all_queues()
))
else:
log.error(
'Cannot initiate SQSConnection to %s region, '
'VPN Queues will not be populated for this region',
region.name)
maps['VPC subnets'].append(vpc_subnets_rm(
region_id, vpcregionconn.get_all_subnets()
示例2: process
# 需要导入模块: from boto.vpc import VPCConnection [as 别名]
# 或者: from boto.vpc.VPCConnection import get_all_vpn_gateways [as 别名]
def process(self, device, results, log):
log.info(
'Modeler %s processing data for device %s',
self.name(), device.id)
accesskey = getattr(device, 'ec2accesskey', None)
secretkey = getattr(device, 'ec2secretkey', None)
old_logger = boto.log.error
boto.log.error = lambda x: x
try:
if not secretkey or not accesskey:
raise EC2ResponseError('', '', '')
ec2conn = EC2Connection(accesskey, secretkey)
s3connection = S3Connection(accesskey, secretkey)
ec2_regions = ec2conn.get_all_regions()
except EC2ResponseError:
log.error('Invalid Keys. '
'Check your EC2 Access Key and EC2 Secret Key.')
return
finally:
boto.log.error = old_logger
maps = collections.OrderedDict([
('regions', []),
('s3buckets', []),
('instance types', []),
('zones', []),
('VPCs', []),
('VPC subnets', []),
('VPNGateways', []),
('images', []),
('instances', []),
('volumes', []),
('snapshots', []),
('queues', []),
('elastic_ips', []),
('reservations', []),
('account', []),
('reserved_instances', []),
])
image_filters = []
region_oms = []
for region in ec2_regions:
region_id = prepId(region.name)
region_oms.append(ObjectMap(data={
'id': region_id,
'title': region.name,
}))
ec2regionconn = EC2Connection(accesskey, secretkey, region=region)
vpcregionconn = VPCConnection(accesskey, secretkey, region=region)
sqsconnection = boto.sqs.connect_to_region(
region.name,
aws_access_key_id=accesskey,
aws_secret_access_key=secretkey
)
# Zones
maps['zones'].append(
zones_rm(
region_id, ec2regionconn.get_all_zones())
)
# VPCs
maps['VPCs'].append(
vpcs_rm(
region_id, vpcregionconn.get_all_vpcs())
)
# VPNGateways
maps['VPNGateways'].append(
vpn_gateways_rm(
region_id, vpcregionconn.get_all_vpn_gateways()
)
)
maps['queues'].append(vpn_queues_rm(
region_id, sqsconnection.get_all_queues()
))
maps['VPC subnets'].append(vpc_subnets_rm(
region_id, vpcregionconn.get_all_subnets()
))
# Instances
maps['instances'].append(instances_rm(
region_id,
device,
ec2regionconn.get_only_instances(filters=INSTANCE_FILTERS),
image_filters
))
# Images
if image_filters:
maps['images'].append(
images_rm(region_id, ec2regionconn.get_all_images(
image_ids=image_filters))
#.........这里部分代码省略.........