當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。