Utility method to get the S3 client for a credentials provider.
184112
protected static AmazonS3 getS3Client(URI stashRoot, AWSCredentialsProvider credentialsProvider) {
        return getS3Client(stashRoot, credentialsProvider, null);
    }
643245
def client_getter():
    """"""
    def wrapper(f):
        @wraps(f)
        def decorated(*args, **kwargs):
            if 'client_id' not in kwargs:
                abort(500)

            client = Client.query.filter_by(
                client_id=kwargs.pop('client_id'),
                user_id=current_user.get_id(),
            ).first()

            if client is None:
                abort(404)

            return f(client, *args, **kwargs)
        return decorated
    return wrapper
878004
def _get_connection(self):
        """"""
        kwargs = {
            'username': self.account,
            'api_key': self.secret_key,
        }

        # Only add kwarg for servicenet if True because user could set
        # environment variable 'RACKSPACE_SERVICENET' separately.
        if self.servicenet:
            kwargs['servicenet'] = True

        if self.authurl:
            kwargs['authurl'] = self.authurl

        return cloudfiles.get_connection(**kwargs)
1240436
function getClient(credentials) {
	return new Promise((resolve, reject) => {
		const ftp = new Ftp(credentials);
		ftp.once('connect', () => {
			resolve(ftp);
		});
	});
}
770671
public ClientCredentialsRequest.Builder clientCredentials() {
    return new ClientCredentialsRequest.Builder(clientId, clientSecret)
            .setDefaults(httpManager, scheme, host, port)
            .grant_type("client_credentials");
  }
116462
def get_client(url, username, password, allow_insecure, ca_bundle):
    """"""
    return _HNVClient(url, username, password, allow_insecure, ca_bundle)
83844
private AWSKMSClient newAWSKMSClient(
            AWSCredentialsProvider credentialsProvider,
            ClientConfiguration clientConfig,
            CryptoConfiguration cryptoConfig,
            RequestMetricCollector requestMetricCollector
    ) {
        final AWSKMSClient kmsClient = new AWSKMSClient(
            credentialsProvider, clientConfig, requestMetricCollector);
        final Region kmsRegion = cryptoConfig.getAwsKmsRegion();
        if (kmsRegion != null)
            kmsClient.setRegion(kmsRegion);
        return kmsClient;
    }
1195419
def _try_inject_s3_credentials(url):
    
    assert url.startswith('s3://')
    path = url[5:]
    # Check if the path already contains credentials
    tokens = path.split(':')
    # If there are two ':', its possible that we have already injected credentials
    if len(tokens) == 3:
        # Edge case: there are exactly two ':'s in the object key which is a false alarm.
        # We prevent this by checking that '/' is not in the assumed key and id.
        if ('/' not in tokens[0]) and ('/' not in tokens[1]):
            return url

    # S3 url does not contain secret key/id pair, query the environment variables
    (k, v) = _get_aws_credentials()
    return 's3://' + k + ':' + v + ':' + path
809299
def client(host='localhost', port=2379,
           ca_cert=None, cert_key=None, cert_cert=None,
           timeout=None, protocol="http"):
    """"""
    return Etcd3Client(host=host,
                       port=port,
                       ca_cert=ca_cert,
                       cert_key=cert_key,
                       cert_cert=cert_cert,
                       timeout=timeout,
                       protocol=protocol)
467444
def get_conn():
    '''
    
    '''
    if __active_provider_name__ in __context__:
        return __context__[__active_provider_name__]
    vm_ = get_configured_provider()
    profile = vm_.pop('profile', None)
    if profile is not None:
        vm_ = __utils__['dictupdate.update'](os_client_config.vendors.get_profile(profile), vm_)
    conn = shade.openstackcloud.OpenStackCloud(cloud_config=None, **vm_)
    if __active_provider_name__ is not None:
        __context__[__active_provider_name__] = conn
    return conn
533609
public static AWSCredentialsProvider getInstance(final String credentialAccessKey, final String credentialSecretKey) {
        return getInstance(credentialAccessKey, credentialSecretKey, null, null, null);
    }
1129168
def _get_twilio(profile):
    '''
    
    '''
    creds = __salt__['config.option'](profile)
    client = TwilioRestClient(
        creds.get('twilio.account_sid'),
        creds.get('twilio.auth_token'),
    )

    return client
612362
def get_boto_resource(
        resource,
        region=None,
        aws_access_key_id=None,
        aws_secret_access_key=None,
        aws_session_token=None,
        endpoint_url=None
        ):
    """"""
    cache_key = '{0}:{1}:{2}:{3}'.format(
        resource,
        region,
        aws_access_key_id,
        endpoint_url or ''
    )
    if not aws_session_token:
        if cache_key in RESOURCE_CACHE:
            return RESOURCE_CACHE[cache_key]
    session = get_boto_session(
        region,
        aws_access_key_id,
        aws_secret_access_key,
        aws_session_token
    )
    if not session:
        logging.error("Failed to get {0} resource.".format(resource))
        return None

    RESOURCE_CACHE[cache_key] = session.resource(
        resource,
        endpoint_url=endpoint_url
    )
    return RESOURCE_CACHE[cache_key]
794073
public function getClient()
    {
        if ($this->_client === null) {
            try {
                $s3Client = new Aws\S3\S3Client(
                    [
                        'key' => $this->getKey(),
                        'secret' => $this->getSecret(),
                    ]
                );
            } catch (InvalidArgumentException $e) {
                throw new BuildException($e);
            }

            $this->_client = $s3Client;
        }

        return $this->_client;
    }
121845
def client(host='localhost', port=2379,
           ca_cert=None, cert_key=None, cert_cert=None, timeout=None,
           user=None, password=None, grpc_options=None):
    """"""
    return Etcd3Client(host=host,
                       port=port,
                       ca_cert=ca_cert,
                       cert_key=cert_key,
                       cert_cert=cert_cert,
                       timeout=timeout,
                       user=user,
                       password=password,
                       grpc_options=grpc_options)
337819
public static AmazonCloudWatch cloudWatch(AWSCredentialsProvider credentials) {
    AmazonCloudWatch client = new AmazonCloudWatchClient(credentials);
    client.setEndpoint(System.getProperty(AwsPropertyKeys.AWS_CLOUD_WATCH_END_POINT.getBundle(),
        "monitoring.amazonaws.com"));
    return client;
  }
179188
def get_client(site=None):
    """"""
    if 'CITRINATION_API_KEY' not in environ:
        raise ValueError("'CITRINATION_API_KEY' is not set as an environment variable")
    if not site:
        site = environ.get("CITRINATION_SITE", "https://citrination.com")
    return CitrinationClient(environ['CITRINATION_API_KEY'], site)