region API Requests
178629
public HttpJsonRequest createConversationTokenRequest(ConversationTokenRequest conversationTokenRequest, HttpRequest.Listener<HttpJsonRequest> listener) {
		HttpJsonRequest request = createJsonRequest(ENDPOINT_CONVERSATION, conversationTokenRequest, HttpRequestMethod.POST);
		request.addListener(listener);
		return request;
	}
1333493
public function canCall( string $api_key, string $region, string $resource, string $endpoint): bool
	{
		$appLimits = $this->getAppLimits($api_key, $region);
		if (is_array($appLimits) && $resource != LeagueAPI::RESOURCE_STATICDATA)
		{
			foreach ($appLimits as $timeInterval => $limits)
			{
				//  Check all saved intervals for this region
				if ($limits['used'] >= $limits['limit'] && $limits['expires'] > time())
					return false;
			}
		}

		$methodLimits = $this->getMethodLimits($api_key, $region, $endpoint);
		if (is_array($methodLimits))
		{
			foreach ($methodLimits as $timeInterval => $limits)
			{
				//  Check all saved intervals for this endpoint
				if ($limits['used'] >= $limits['limit'] && $limits['expires'] > time())
					return false;
			}
		}

		return true;
	}
1316490
def regions(self):
        
        json = self.request('/regions', method='GET')
        status = json.get('status')
        if status == 'OK':
            regions_json = json.get('regions', [])
            regions = [Region.from_json(region) for region in regions_json]
            return regions
        else:
            message = json.get('message')
            raise DOPException('[%s]: %s' % (status, message))
598149
function checkExecParamsRegion(region)
{
	var caller = checkExecParamsRegion.caller.name

	if (typeof region != 'object') {
		console.error('Error: region parameter is not an object in: ' + caller);
		return false;
	}

	return true;
}
123257
def list_regions(self):
        

        url = '{0}/v3/regions'.format(self.host)
        return http._get_with_qiniu_mac(url, None, self.auth)
274488
def request(
        minion_id,
        dns_name=None,
        zone='default',
        request_id=None,
        country='US',
        state='California',
        loc='Palo Alto',
        org='Beta Organization',
        org_unit='Beta Group',
        password=None,
        zone_id=None,
    ):
    '''
    
    '''
    if password is not None:
        if password.startswith('sdb://'):
            password = __salt__['sdb.get'](password)

    if zone_id is None:
        zone_id = __opts__.get('venafi', {}).get('zone_id')

    if zone_id is None and zone is not None:
        zone_id = get_zone_id(zone)

    if zone_id is None:
        raise CommandExecutionError(
            'Either a zone or a zone_id must be passed in or '
            'configured in the master file. This id can be retreived using '
            'venafi.show_company <domain>'
        )

    private_key = gen_key(minion_id, dns_name, zone, password)

    csr = gen_csr(
        minion_id,
        dns_name,
        zone=zone,
        country=country,
        state=state,
        loc=loc,
        org=org,
        org_unit=org_unit,
        password=password,
    )

    pdata = salt.utils.json.dumps({
        'zoneId': zone_id,
        'certificateSigningRequest': csr,
    })

    qdata = __utils__['http.query'](
        '{0}/certificaterequests'.format(_base_url()),
        method='POST',
        data=pdata,
        decode=True,
        decode_type='json',
        header_dict={
            'tppl-api-key': _api_key(),
            'Content-Type': 'application/json',
        },
    )

    request_id = qdata['dict']['certificateRequests'][0]['id']
    ret = {
        'request_id': request_id,
        'private_key': private_key,
        'csr': csr,
        'zone': zone,
    }

    bank = 'venafi/domains'
    cache = salt.cache.Cache(__opts__, syspaths.CACHE_DIR)
    data = cache.fetch(bank, dns_name)
    if data is None:
        data = {}
    data.update({
        'minion_id': minion_id,
        'request_id': request_id,
        'private_key': private_key,
        'zone': zone,
        'csr': csr,
    })
    cache.store(bank, dns_name, data)
    _id_map(minion_id, dns_name)

    return ret
568465
def describe_api_resources(restApiId, region=None, key=None, keyid=None, profile=None):
    '''
    

    '''
    try:
        conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
        resources = sorted(_multi_call(conn.get_resources, 'items', restApiId=restApiId),
                           key=lambda k: k['path'])

        return {'resources': resources}
    except ClientError as e:
        return {'error': __utils__['boto3.get_error'](e)}
106746
def switch_region(request, region_name,
                  redirect_field_name=auth.REDIRECT_FIELD_NAME):
    
    if region_name in request.user.available_services_regions:
        request.session['services_region'] = region_name
        LOG.debug('Switching services region to %s for user "%s".',
                  region_name, request.user.username)

    redirect_to = request.GET.get(redirect_field_name, '')
    if not is_safe_url(url=redirect_to, host=request.get_host()):
        redirect_to = settings.LOGIN_REDIRECT_URL

    response = shortcuts.redirect(redirect_to)
    utils.set_response_cookie(response, 'services_region',
                              request.session['services_region'])
    return response
506163
def print_region_quota(access_token, sub_id, region):
    ''''''
    print(region + ':')
    quota = azurerm.get_compute_usage(access_token, sub_id, region)
    if SUMMARY is False:
        print(json.dumps(quota, sort_keys=False, indent=2, separators=(',', ': ')))
    try:
        for resource in quota['value']:
            if resource['name']['value'] == 'cores':
                print('   Current: ' + str(resource['currentValue']) + ', limit: '
                      + str(resource['limit']))
                break
    except KeyError:
        print('Invalid data for region: ' + region)
399316
async def regions(self, *args, **kwargs):
        

        return await self._makeApiCall(self.funcinfo["regions"], *args, **kwargs)
1016362
def api_request(request, *args, **kwargs):
    
    plugin = pm.api_plugin_for_request(request)
    if plugin and plugin.request_class:
        req = plugin.request_class(*args, **kwargs)
    else:
        raise Exception("Invalid request type")
    return req
572532
public function initMethod( string $api_key, string $region, string $endpoint, array $limits )
	{
		$output = [];
		foreach ($limits as $interval => $limit)
		{
			$output[$interval] = [
				'used'    => 0,
				'limit'   => $limit,
				'expires' => time() + $interval,
			];
		}
		$this->limits[$region][$api_key]['method'][$endpoint] = $output;
	}
1126936
@Override
	void requestSubpartition(int subpartitionIndex) throws IOException, InterruptedException {

		boolean retriggerRequest = false;

		// The lock is required to request only once in the presence of retriggered requests.
		synchronized (requestLock) {
			checkState(!isReleased, "LocalInputChannel has been released already");

			if (subpartitionView == null) {
				LOG.debug("{}: Requesting LOCAL subpartition {} of partition {}.",
					this, subpartitionIndex, partitionId);

				try {
					ResultSubpartitionView subpartitionView = partitionManager.createSubpartitionView(
						partitionId, subpartitionIndex, this);

					if (subpartitionView == null) {
						throw new IOException("Error requesting subpartition.");
					}

					// make the subpartition view visible
					this.subpartitionView = subpartitionView;

					// check if the channel was released in the meantime
					if (isReleased) {
						subpartitionView.releaseAllResources();
						this.subpartitionView = null;
					}
				} catch (PartitionNotFoundException notFound) {
					if (increaseBackoff()) {
						retriggerRequest = true;
					} else {
						throw notFound;
					}
				}
			}
		}

		// Do this outside of the lock scope as this might lead to a
		// deadlock with a concurrent release of the channel via the
		// input gate.
		if (retriggerRequest) {
			inputGate.retriggerPartitionRequest(partitionId.getPartitionId());
		}
	}
520951
public GetAnyLocationsResponse getAnyLocations(String region) throws ApiException {
        ApiResponse<GetAnyLocationsResponse> resp = getAnyLocationsWithHttpInfo(region);
        return resp.getData();
    }
892121
public function initApp( string $api_key, string $region, array $limits )
	{
		$output = [];
		foreach ($limits as $interval => $limit)
		{
			$output[$interval] = [
				'used'    => 0,
				'limit'   => $limit,
				'expires' => time() + $interval,
			];
		}
		$this->limits[$region][$api_key]['app'] = $output;
	}
111857
def requests_list(self, status=None, **kwargs):
        ""
        api_path = "/api/v2/requests.json"
        api_query = {}
        if "query" in kwargs.keys():
            api_query.update(kwargs["query"])
            del kwargs["query"]
        if status:
            api_query.update({
                "status": status,
            })
        return self.call(api_path, query=api_query, **kwargs)
2339
function updateReqBucketRegion(request, region) {
    var httpRequest = request.httpRequest;
    if (typeof region === 'string' && region.length) {
      httpRequest.region = region;
    }
    if (!httpRequest.endpoint.host.match(/s3(?!-accelerate).*\.amazonaws\.com$/)) {
      return;
    }
    var service = request.service;
    var s3Config = service.config;
    var s3BucketEndpoint = s3Config.s3BucketEndpoint;
    if (s3BucketEndpoint) {
      delete s3Config.s3BucketEndpoint;
    }
    var newConfig = AWS.util.copy(s3Config);
    delete newConfig.endpoint;
    newConfig.region = httpRequest.region;

    httpRequest.endpoint = (new AWS.S3(newConfig)).endpoint;
    service.populateURI(request);
    s3Config.s3BucketEndpoint = s3BucketEndpoint;
    httpRequest.headers.Host = httpRequest.endpoint.host;

    if (request._asm.currentState === 'validate') {
      request.removeListener('build', service.populateURI);
      request.addListener('build', service.removeVirtualHostedBucketFromPath);
    }
  }