Adds a regional client for the specified region if it does not already exist.

        :param str region_name: AWS Region ID (ex: us-east-1)
19881
def add_regional_client(self, region_name):
        
        if region_name not in self._regional_clients:
            session = boto3.session.Session(region_name=region_name, botocore_session=self.config.botocore_session)
            client = session.client("kms", config=self._user_agent_adding_config)
            self._register_client(client, region_name)
            self._regional_clients[region_name] = client
1097053
def add_instance(self, instance, region):
        '''  '''

        # Only return instances with desired instance states
        if instance.state not in self.ec2_instance_states:
            return

        # Select the best destination address
        if instance.subnet_id:
            dest = getattr(instance, self.vpc_destination_variable, None)
            if dest is None:
                dest = getattr(instance, 'tags').get(self.vpc_destination_variable, None)
        else:
            dest = getattr(instance, self.destination_variable, None)
            if dest is None:
                dest = getattr(instance, 'tags').get(self.destination_variable, None)

        if not dest:
            # Skip instances we cannot address (e.g. private VPC subnet)
            return

        # if we only want to include hosts that match a pattern, skip those that don't
        if self.pattern_include and not self.pattern_include.match(dest):
            return

        # if we need to exclude hosts that match a pattern, skip those
        if self.pattern_exclude and self.pattern_exclude.match(dest):
            return

        # Add to index
        self.index[dest] = [region, instance.id]

        # Inventory: Group by instance ID (always a group of 1)
        if self.group_by_instance_id:
            self.inventory[instance.id] = [dest]
            if self.nested_groups:
                self.push_group(self.inventory, 'instances', instance.id)

        # Inventory: Group by region
        if self.group_by_region:
            self.push(self.inventory, region, dest)
            if self.nested_groups:
                self.push_group(self.inventory, 'regions', region)

        # Inventory: Group by availability zone
        if self.group_by_availability_zone:
            self.push(self.inventory, instance.placement, dest)
            if self.nested_groups:
                if self.group_by_region:
                    self.push_group(self.inventory, region, instance.placement)
                self.push_group(self.inventory, 'zones', instance.placement)

        # Inventory: Group by Amazon Machine Image (AMI) ID
        if self.group_by_ami_id:
            ami_id = self.to_safe(instance.image_id)
            self.push(self.inventory, ami_id, dest)
            if self.nested_groups:
                self.push_group(self.inventory, 'images', ami_id)

        # Inventory: Group by instance type
        if self.group_by_instance_type:
            type_name = self.to_safe('type_' + instance.instance_type)
            self.push(self.inventory, type_name, dest)
            if self.nested_groups:
                self.push_group(self.inventory, 'types', type_name)

        # Inventory: Group by key pair
        if self.group_by_key_pair and instance.key_name:
            key_name = self.to_safe('key_' + instance.key_name)
            self.push(self.inventory, key_name, dest)
            if self.nested_groups:
                self.push_group(self.inventory, 'keys', key_name)

        # Inventory: Group by VPC
        if self.group_by_vpc_id and instance.vpc_id:
            vpc_id_name = self.to_safe('vpc_id_' + instance.vpc_id)
            self.push(self.inventory, vpc_id_name, dest)
            if self.nested_groups:
                self.push_group(self.inventory, 'vpcs', vpc_id_name)

        # Inventory: Group by security group
        if self.group_by_security_group:
            try:
                for group in instance.groups:
                    key = self.to_safe("security_group_" + group.name)
                    self.push(self.inventory, key, dest)
                    if self.nested_groups:
                        self.push_group(self.inventory, 'security_groups', key)
            except AttributeError:
                self.fail_with_error('\n'.join(['Package boto seems a bit older.', 
                                            'Please upgrade boto >= 2.3.0.']))

        # Inventory: Group by tag keys
        if self.group_by_tag_keys:
            for k, v in instance.tags.items():
                if self.expand_csv_tags and v and ',' in v:
                    values = map(lambda x: x.strip(), v.split(','))
                else:
                    values = [v]

                for v in values:
                    if v:
                        key = self.to_safe("tag_" + k + "=" + v)
                    else:
                        key = self.to_safe("tag_" + k)
                    self.push(self.inventory, key, dest)
                    if self.nested_groups:
                        self.push_group(self.inventory, 'tags', self.to_safe("tag_" + k))
                        if v:
                            self.push_group(self.inventory, self.to_safe("tag_" + k), key)

        # Inventory: Group by Route53 domain names if enabled
        if self.route53_enabled and self.group_by_route53_names:
            route53_names = self.get_instance_route53_names(instance)
            for name in route53_names:
                self.push(self.inventory, name, dest)
                if self.nested_groups:
                    self.push_group(self.inventory, 'route53', name)

        # Global Tag: instances without tags
        if self.group_by_tag_none and len(instance.tags) == 0:
            self.push(self.inventory, 'tag_none', dest)
            if self.nested_groups:
                self.push_group(self.inventory, 'tags', 'tag_none')

        # Global Tag: tag all EC2 instances
        self.push(self.inventory, 'ec2', dest)

        self.inventory["_meta"]["hostvars"][dest] = self.get_host_info_dict_from_instance(instance)
175985
def get_client(self, region):
        
        ep = self._ep_for_region(region)
        if not ep:
            raise exc.NoEndpointForRegion("There is no endpoint defined for the "
                    "region '%s' for the '%s' service." % (region,
                    self.service_type))
        return ep.client
962554
def get(provider_name, region_name, az_name)
      provider_az = "#{provider_name}/#{region_name}/#{az_name}"
      response = http_get(resource_url(provider_az))
      format_object(response, TYPE)
    end
509601
def _safe_region(region=None, context=None):
    """"""
    ret = region or settings.get("region")
    context = context or identity
    if not ret:
        # Nothing specified; get the default from the identity object.
        if not context:
            _create_identity()
            context = identity
        ret = context.get_default_region()
    if not ret:
        # Use the first available region
        try:
            ret = regions[0]
        except IndexError:
            ret = ""
    return ret
499937
def _initialize(self, boto_session, sagemaker_client, sagemaker_runtime_client):
        
        self.boto_session = boto_session or boto3.Session()

        self._region_name = self.boto_session.region_name
        if self._region_name is None:
            raise ValueError('Must setup local AWS configuration with a region supported by SageMaker.')

        self.sagemaker_client = sagemaker_client or self.boto_session.client('sagemaker')
        prepend_user_agent(self.sagemaker_client)

        if sagemaker_runtime_client is not None:
            self.sagemaker_runtime_client = sagemaker_runtime_client
        else:
            config = botocore.config.Config(read_timeout=80)
            self.sagemaker_runtime_client = self.boto_session.client('runtime.sagemaker', config=config)

        prepend_user_agent(self.sagemaker_runtime_client)

        self.local_mode = False
1172961
def by_name(self, region, summoner_name):
        
        url, query = SummonerApiV4Urls.by_name(
            region=region, summoner_name=summoner_name
        )
        return self._raw_request(self.by_name.__name__, region, url, query)
379397
def get_region_products(self, region):
        

        regions, retInfo = self.list_regions()
        if regions is None:
            return None

        for r in regions:
            if r.get('name') == region:
                return r.get('products')
340553
def ensure_key_pair(region)
      pair_name = key_name()
      delete_key_pair(region, pair_name)
      create_new_key_pair(region, pair_name)
    end
1214601
def get_region(service, region, profile):
    
    _, region, _, _ = _get_profile(service, region, None, None, profile)

    return region
1013028
def _connectS3(self):
        
        s3 = boto.s3.connect_to_region(self.region)
        if s3 is None:
            raise ValueError("Could not connect to S3. Make sure '%s' is a valid S3 region." %
                             self.region)
        return s3
1070937
def delete(client, region = 'AWS_REGION')
      super
      api_id = get_id_for_api(@api_name)
      if api_id
        options = {
          rest_api_id: api_id
        }
        @client.delete_rest_api(options)
        puts "Deleted API: #{@api_name} ID:#{api_id}"
      else
        puts "API Gateway Object #{@api_name} not found. Nothing to delete."
      end
      true
    end
688117
def upload_to_s3(self, region='us-east-1'):
        
        s3_import_cmd = "aws s3 cp {} s3://{} --profile '{}' --region {}".format(self.upload_file, self.bucket_name,
                                                                                 self.aws_project, region)
        print "Uploading to bucket {} in s3 with the cmd: {}".format(self.bucket_name, s3_import_cmd)
        # s3 upload puts DL progress to stderr
        s3_upload = subprocess.Popen(shlex.split(s3_import_cmd), stderr=subprocess.PIPE)
        while True:
            progress = s3_upload.stderr.readline()
            if progress == '' and s3_upload.poll() is not None:
                break
            if progress:
                print (progress)
        rc = s3_upload.poll()
        if rc != 0:
            raise subprocess.CalledProcessError(rc)
        print "Upload completed successfully"
677574
public void addRegion(InfinispanBaseRegion region) {
		allRegions.put(ByteString.fromString(region.getCache().getName()), region);
	}
311394
def region_option(f):
    
    def callback(ctx, param, value):
        state = ctx.ensure_object(Context)
        state.region = value
        return value

    return click.option('--region',
                        expose_value=False,
                        help='Set the AWS Region of the service (e.g. us-east-1).',
                        callback=callback)(f)
1194159
public void addRegion(Region region) {
        if (!regions.contains(region)) {
            if (serviceConnected) {
                try {
                    beaconManager.startMonitoringBeaconsInRegion(region);
                } catch (RemoteException e) {
                    LogManager.e(e, TAG, "Can't add bootstrap region");
                }
            } else {
                LogManager.w(TAG, "Adding a region: service not yet Connected");
            }
            regions.add(region);
        }
    }
672701
def target_group_exists(name,
                        region=None,
                        key=None,
                        keyid=None,
                        profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    try:
        if name.startswith('arn:aws:elasticloadbalancing'):
            alb = conn.describe_target_groups(TargetGroupArns=[name])
        else:
            alb = conn.describe_target_groups(Names=[name])
        if alb:
            return True
        else:
            log.warning('The target group does not exist in region %s', region)
            return False
    except ClientError as error:
        log.warning('target_group_exists check for %s returned: %s', name, error)
        return False