Return a cloud client
494179
def _get_client():
    '''
    
    '''
    client = salt.cloud.CloudClient(
        os.path.join(os.path.dirname(__opts__['conf_file']), 'cloud'),
        pillars=copy.deepcopy(__pillar__.get('cloud', {}))
    )
    return client
896925
def Get(self):
    """"""

    args = client_pb2.ApiGetClientArgs(client_id=self.client_id)
    result = self._context.SendRequest("GetClient", args)
    return Client(data=result, context=self._context)
202771
def client(*args, loop=None, **kwargs):
    
    return _get_default_session(loop=loop).client(*args, **kwargs)
703990
def get_client(self, provider):
        ""
        if self.client_class is not None:
            return self.client_class(provider)
        return get_client(provider)
1321080
def get_conn(service='SoftLayer_Virtual_Guest'):
    '''
    
    '''
    client = SoftLayer.Client(
        username=config.get_cloud_config_value(
            'user', get_configured_provider(), __opts__, search_global=False
        ),
        api_key=config.get_cloud_config_value(
            'apikey', get_configured_provider(), __opts__, search_global=False
        ),
    )
    return client[service]
309391
def get_conn(client_type):
    '''
    
    '''
    conn_kwargs = {}

    conn_kwargs['subscription_id'] = salt.utils.stringutils.to_str(
        config.get_cloud_config_value(
            'subscription_id',
            get_configured_provider(), __opts__, search_global=False
        )
    )

    cloud_env = config.get_cloud_config_value(
        'cloud_environment',
        get_configured_provider(), __opts__, search_global=False
    )

    if cloud_env is not None:
        conn_kwargs['cloud_environment'] = cloud_env

    tenant = config.get_cloud_config_value(
        'tenant',
        get_configured_provider(), __opts__, search_global=False
    )

    if tenant is not None:
        client_id = config.get_cloud_config_value(
            'client_id',
            get_configured_provider(), __opts__, search_global=False
        )
        secret = config.get_cloud_config_value(
            'secret',
            get_configured_provider(), __opts__, search_global=False
        )
        conn_kwargs.update({'client_id': client_id, 'secret': secret,
                            'tenant': tenant})

    username = config.get_cloud_config_value(
        'username',
        get_configured_provider(), __opts__, search_global=False
    )

    if username is not None:
        password = config.get_cloud_config_value(
            'password',
            get_configured_provider(), __opts__, search_global=False
        )
        conn_kwargs.update({'username': username, 'password': password})

    client = __utils__['azurearm.get_client'](
        client_type=client_type, **conn_kwargs
    )

    return client
684735
def get_boto_client(
        client,
        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(
        client,
        region,
        aws_access_key_id,
        endpoint_url or ''
    )
    if not aws_session_token:
        if cache_key in CLIENT_CACHE:
            return CLIENT_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} client.".format(client))
        return None

    CLIENT_CACHE[cache_key] = session.client(
        client,
        endpoint_url=endpoint_url
    )
    return CLIENT_CACHE[cache_key]
13468
def get_client(self, email=None, password=None, **__):
        """"""
        if self.client is not None:
            return self.client
        return Auth(email, password)
911202
def get_client(client_id):
    
    client = Client.query.get(client_id)
    if client and client.user.active:
        return client
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)
564942
def clouds(opts):
    '''
    
    '''
    # Let's bring __active_provider_name__, defaulting to None, to all cloud
    # drivers. This will get temporarily updated/overridden with a context
    # manager when needed.
    functions = LazyLoader(
        _module_dirs(opts,
                     'clouds',
                     'cloud',
                     base_path=os.path.join(SALT_BASE_PATH, 'cloud'),
                     int_type='clouds'),
        opts,
        tag='clouds',
        pack={'__utils__': salt.loader.utils(opts),
              '__active_provider_name__': None},
    )
    for funcname in LIBCLOUD_FUNCS_NOT_SUPPORTED:
        log.trace(
            '\'%s\' has been marked as not supported. Removing from the '
            'list of supported cloud functions', funcname
        )
        functions.pop(funcname, None)
    return functions
199973
def _build_ftp_client(cls, session: AppSession):
        ''''''
        return session.factory.new(
            'FTPClient',
            connection_pool=session.factory['ConnectionPool'],
            # TODO: recorder
            # recorder=session.factory['DemuxRecorder'],
        )
316065
def connect_to_cloudfiles(region=None, public=None):
    """"""
    if public is None:
        is_public = not bool(get_setting("use_servicenet"))
    else:
        is_public = public
    ret = _create_client(ep_name="object_store", region=region,
            public=is_public)
    if ret:
        # Add CDN endpoints, if available
        region = _safe_region(region)
        ret.cdn_management_url = _get_service_endpoint(None, "object_cdn",
                region, public=is_public)
    return ret
1104216
def get_cloudformation_client(service_name, environment_name):
    
    region = service_registry.service_region(service_name)

    if whereami() == 'ec2':
        profile = None
    else:
        profile = get_account_alias(environment_name)

    clients = create_aws_clients(region, profile, 'cloudformation')
    return clients['cloudformation']
912689
public Object getCloudantClient(ResourceInfo info) throws Exception {
        return cloudantSvc.getCloudantClient(
                                             info == null ? ResourceInfo.AUTH_APPLICATION : info.getAuth(),
                                             info == null ? null : info.getLoginPropertyList());
    }
506387
def _get_client():
        """"""
        return utils.get_client(url=CONFIG.HNV.url,
                                username=CONFIG.HNV.username,
                                password=CONFIG.HNV.password,
                                allow_insecure=CONFIG.HNV.https_allow_insecure,
                                ca_bundle=CONFIG.HNV.https_ca_bundle)
422343
async function Client() {
  if (!esClient) {
    esClient = await connect()
    console.log('connected to elasticsearch');
  } else {
    console.log('using existing elasticsearch connection')
  }
  return esClient
}