当前位置: 首页>>代码示例>>Python>>正文


Python ec2.regions方法代码示例

本文整理汇总了Python中boto.ec2.regions方法的典型用法代码示例。如果您正苦于以下问题:Python ec2.regions方法的具体用法?Python ec2.regions怎么用?Python ec2.regions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在boto.ec2的用法示例。


在下文中一共展示了ec2.regions方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: do_api_calls_update_cache

# 需要导入模块: from boto import ec2 [as 别名]
# 或者: from boto.ec2 import regions [as 别名]
def do_api_calls_update_cache(self):
        ''' Do API calls to each region, and save data in cache files '''

        if self.route53_enabled:
            self.get_route53_records()

        for region in self.regions:
            self.get_instances_by_region(region)
            if self.rds_enabled:
                self.get_rds_instances_by_region(region)
            if self.elasticache_enabled:
                self.get_elasticache_clusters_by_region(region)
                self.get_elasticache_replication_groups_by_region(region)
            if self.include_rds_clusters:
                self.include_rds_clusters_by_region(region)

        self.write_to_cache(self.inventory, self.cache_path_cache)
        self.write_to_cache(self.index, self.cache_path_index) 
开发者ID:PacktPublishing,项目名称:Hands-On-Auto-DevOps-with-GitLab-CI,代码行数:20,代码来源:ec2.py

示例2: do_api_calls_update_cache

# 需要导入模块: from boto import ec2 [as 别名]
# 或者: from boto.ec2 import regions [as 别名]
def do_api_calls_update_cache(self):
        ''' Do API calls to each region, and save data in cache files '''

        if self.route53_enabled:
            self.get_route53_records()

        for region in self.regions:
            self.get_instances_by_region(region)
            if self.rds_enabled:
                self.get_rds_instances_by_region(region)
            if self.elasticache_enabled:
                self.get_elasticache_clusters_by_region(region)
                self.get_elasticache_replication_groups_by_region(region)

        self.write_to_cache(self.inventory, self.cache_path_cache)
        self.write_to_cache(self.index, self.cache_path_index) 
开发者ID:openshift,项目名称:origin-ci-tool,代码行数:18,代码来源:ec2.py

示例3: __init__

# 需要导入模块: from boto import ec2 [as 别名]
# 或者: from boto.ec2 import regions [as 别名]
def __init__(self):
        ''' Main execution path '''

        # Inventory grouped by instance IDs, tags, security groups, regions,
        # and availability zones
        self.inventory = self._empty_inventory()

        # Index of hostname (address) to instance ID
        self.index = {}

        # Boto profile to use (if any)
        self.boto_profile = None

        # Read settings and parse CLI arguments
        self.parse_cli_args()
        self.read_settings()

        # Make sure that profile_name is not passed at all if not set
        # as pre 2.24 boto will fall over otherwise
        if self.boto_profile:
            if not hasattr(boto.ec2.EC2Connection, 'profile_name'):
                self.fail_with_error("boto version must be >= 2.24 to use profile")

        # Cache
        if self.args.refresh_cache:
            self.do_api_calls_update_cache()
        elif not self.is_cache_valid():
            self.do_api_calls_update_cache()

        # Data to print
        if self.args.host:
            data_to_print = self.get_host_info()

        elif self.args.list:
            # Display list of instances for inventory
            if self.inventory == self._empty_inventory():
                data_to_print = self.get_inventory_from_cache()
            else:
                data_to_print = self.json_format_dict(self.inventory, True)

        print(data_to_print) 
开发者ID:openshift,项目名称:origin-ci-tool,代码行数:43,代码来源:ec2.py

示例4: fetch_region_names

# 需要导入模块: from boto import ec2 [as 别名]
# 或者: from boto.ec2 import regions [as 别名]
def fetch_region_names(self):
        return [region.name for region in ec2.regions()] 
开发者ID:Scout24,项目名称:aws-monocyte,代码行数:4,代码来源:ec2.py

示例5: __init__

# 需要导入模块: from boto import ec2 [as 别名]
# 或者: from boto.ec2 import regions [as 别名]
def __init__(self):
        ''' Main execution path '''

        # Inventory grouped by instance IDs, tags, security groups, regions,
        # and availability zones
        self.inventory = self._empty_inventory()

        # Index of hostname (address) to instance ID
        self.index = {}

        # Read settings and parse CLI arguments
        self.read_settings()
        self.parse_cli_args()

        # Cache
        if self.args.refresh_cache:
            self.do_api_calls_update_cache()
        elif not self.is_cache_valid():
            self.do_api_calls_update_cache()

        # Data to print
        if self.args.host:
            data_to_print = self.get_host_info()

        elif self.args.list:
            # Display list of instances for inventory
            if self.inventory == self._empty_inventory():
                data_to_print = self.get_inventory_from_cache()
            else:
                data_to_print = self.json_format_dict(self.inventory, True)

        print data_to_print 
开发者ID:d1vious,项目名称:splunk-ansible-advance,代码行数:34,代码来源:ec2.py

示例6: do_api_calls_update_cache

# 需要导入模块: from boto import ec2 [as 别名]
# 或者: from boto.ec2 import regions [as 别名]
def do_api_calls_update_cache(self):
        ''' Do API calls to each region, and save data in cache files '''

        if self.route53_enabled:
            self.get_route53_records()

        for region in self.regions:
            self.get_instances_by_region(region)
            self.get_rds_instances_by_region(region)

        self.write_to_cache(self.inventory, self.cache_path_cache)
        self.write_to_cache(self.index, self.cache_path_index) 
开发者ID:d1vious,项目名称:splunk-ansible-advance,代码行数:14,代码来源:ec2.py

示例7: __init__

# 需要导入模块: from boto import ec2 [as 别名]
# 或者: from boto.ec2 import regions [as 别名]
def __init__(self):
        ''' Main execution path '''

        # Inventory grouped by instance IDs, tags, security groups, regions,
        # and availability zones
        self.inventory = self._empty_inventory()

        # Index of hostname (address) to instance ID
        self.index = {}

        # Read settings and parse CLI arguments
        self.read_settings()
        self.parse_cli_args()

        # Cache
        if self.args.refresh_cache:
            self.do_api_calls_update_cache()
        elif not self.is_cache_valid():
            self.do_api_calls_update_cache()

        # Data to print
        if self.args.host:
            data_to_print = self.get_host_info()

        elif self.args.list:
            # Display list of instances for inventory
            if self.inventory == self._empty_inventory():
                data_to_print = self.get_inventory_from_cache()
            else:
                data_to_print = self.json_format_dict(self.inventory, True)

        print(data_to_print) 
开发者ID:HighOps,项目名称:ansible_ec2_vpc_nat_asg,代码行数:34,代码来源:ec2.py

示例8: do_api_calls_update_cache

# 需要导入模块: from boto import ec2 [as 别名]
# 或者: from boto.ec2 import regions [as 别名]
def do_api_calls_update_cache(self):
        ''' Do API calls to each region, and save data in cache files '''

        if self.route53_enabled:
            self.get_route53_records()

        for region in self.regions:
            self.get_instances_by_region(region)
            if self.rds_enabled:
                self.get_rds_instances_by_region(region)

        self.write_to_cache(self.inventory, self.cache_path_cache)
        self.write_to_cache(self.index, self.cache_path_index) 
开发者ID:HighOps,项目名称:ansible_ec2_vpc_nat_asg,代码行数:15,代码来源:ec2.py

示例9: __init__

# 需要导入模块: from boto import ec2 [as 别名]
# 或者: from boto.ec2 import regions [as 别名]
def __init__(self):
        ''' Main execution path '''
 
        # Inventory grouped by instance IDs, tags, security groups, regions,
        # and availability zones
        self.inventory = self._empty_inventory()
 
        # Index of hostname (address) to instance ID
        self.index = {}
 
        # Read settings and parse CLI arguments
        self.read_settings()
        self.parse_cli_args()
 
        # Cache
        if self.args.refresh_cache:
            self.do_api_calls_update_cache()
        elif not self.is_cache_valid():
            self.do_api_calls_update_cache()
 
        # Data to print
        if self.args.host:
            data_to_print = self.get_host_info()
 
        elif self.args.list:
            # Display list of instances for inventory
            if self.inventory == self._empty_inventory():
                data_to_print = self.get_inventory_from_cache()
            else:
                data_to_print = self.json_format_dict(self.inventory, True)
 
        print data_to_print 
开发者ID:geerlingguy,项目名称:ansible-for-devops,代码行数:34,代码来源:ec2.py


注:本文中的boto.ec2.regions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。