## createClient Creates an S3 client.
484508
function (options) {
        var s3 = {};
        s3.client = connectToS3(options);
        s3.bucket = options.bucket || '';
        return s3;
    }
710133
public static function create($client, $data) {
    $response = $client->post(static::$path, $data);

    if ($response->statusCode == 201) {
      $class = get_called_class();
      return new $class($client, $response->json());
    }
  }
783769
def create(self):
        
        logger.info("creating snap7 client")
        self.library.Cli_Create.restype = c_void_p
        self.pointer = S7Object(self.library.Cli_Create())
759562
@Override
    protected Client instantiateClient(String persistenceUnit)
    {
        return new ESClient(this, ((TransportClient) getConnectionPoolOrConnection()), this.externalProperties,
                kunderaMetadata, persistenceUnit);
    }
557753
public static S3AUnderFileSystem createInstance(AlluxioURI uri, UnderFileSystemConfiguration conf,
      AlluxioConfiguration alluxioConf) {

    AWSCredentialsProvider credentials = createAwsCredentialsProvider(conf);
    String bucketName = UnderFileSystemUtils.getBucketName(uri);

    // Set the client configuration based on Alluxio configuration values.
    ClientConfiguration clientConf = new ClientConfiguration();

    // Socket timeout
    clientConf
        .setSocketTimeout((int) alluxioConf.getMs(PropertyKey.UNDERFS_S3A_SOCKET_TIMEOUT_MS));

    // HTTP protocol
    if (Boolean.parseBoolean(conf.get(PropertyKey.UNDERFS_S3A_SECURE_HTTP_ENABLED))) {
      clientConf.setProtocol(Protocol.HTTPS);
    } else {
      clientConf.setProtocol(Protocol.HTTP);
    }

    // Proxy host
    if (conf.isSet(PropertyKey.UNDERFS_S3_PROXY_HOST)) {
      clientConf.setProxyHost(conf.get(PropertyKey.UNDERFS_S3_PROXY_HOST));
    }

    // Proxy port
    if (conf.isSet(PropertyKey.UNDERFS_S3_PROXY_PORT)) {
      clientConf.setProxyPort(Integer.parseInt(conf.get(PropertyKey.UNDERFS_S3_PROXY_PORT)));
    }

    // Number of metadata and I/O threads to S3.
    int numAdminThreads = Integer.parseInt(conf.get(PropertyKey.UNDERFS_S3_ADMIN_THREADS_MAX));
    int numTransferThreads =
        Integer.parseInt(conf.get(PropertyKey.UNDERFS_S3_UPLOAD_THREADS_MAX));
    int numThreads = Integer.parseInt(conf.get(PropertyKey.UNDERFS_S3_THREADS_MAX));
    if (numThreads < numAdminThreads + numTransferThreads) {
      LOG.warn("Configured s3 max threads ({}) is less than # admin threads ({}) plus transfer "
          + "threads ({}). Using admin threads + transfer threads as max threads instead.",
              numThreads, numAdminThreads, numTransferThreads);
      numThreads = numAdminThreads + numTransferThreads;
    }
    clientConf.setMaxConnections(numThreads);

    // Set client request timeout for all requests since multipart copy is used,
    // and copy parts can only be set with the client configuration.
    clientConf
        .setRequestTimeout((int) alluxioConf.getMs(PropertyKey.UNDERFS_S3A_REQUEST_TIMEOUT));

    boolean streamingUploadEnabled =
        conf.getBoolean(PropertyKey.UNDERFS_S3A_STREAMING_UPLOAD_ENABLED);

    // Signer algorithm
    if (conf.isSet(PropertyKey.UNDERFS_S3A_SIGNER_ALGORITHM)) {
      clientConf.setSignerOverride(conf.get(PropertyKey.UNDERFS_S3A_SIGNER_ALGORITHM));
    }

    AmazonS3Client amazonS3Client = new AmazonS3Client(credentials, clientConf);

    // Set a custom endpoint.
    if (conf.isSet(PropertyKey.UNDERFS_S3_ENDPOINT)) {
      amazonS3Client.setEndpoint(conf.get(PropertyKey.UNDERFS_S3_ENDPOINT));
    }

    // Disable DNS style buckets, this enables path style requests.
    if (Boolean.parseBoolean(conf.get(PropertyKey.UNDERFS_S3_DISABLE_DNS_BUCKETS))) {
      S3ClientOptions clientOptions = S3ClientOptions.builder().setPathStyleAccess(true).build();
      amazonS3Client.setS3ClientOptions(clientOptions);
    }

    ExecutorService service = ExecutorServiceFactories
        .fixedThreadPool("alluxio-s3-transfer-manager-worker",
            numTransferThreads).create();

    TransferManager transferManager = TransferManagerBuilder.standard()
        .withS3Client(amazonS3Client).withExecutorFactory(() -> service)
        .withMultipartCopyThreshold(MULTIPART_COPY_THRESHOLD)
        .build();

    return new S3AUnderFileSystem(uri, amazonS3Client, bucketName,
        service, transferManager, conf, alluxioConf, streamingUploadEnabled);
  }
62595
protected function createClient()
    {
        $this->client = new OAuthServer([
            'identifier' => Configuration::get('key'),
            'secret' => Configuration::get('secret'),
            'callback_uri' => Configuration::get('callbackUrl'),
            'name' => Configuration::get('name'),
            'expiration' => Configuration::get('expiration'),
            'scope' => Configuration::get('scope'),
        ]);

        return $this;
    }
42150
function SimpleClient(options) {
    options = options || {};
    this.client = new Zookeeper(options);
    this.root = options.root || '/';
  }
438430
protected function createLaravelDriver(): Sdk\Client
    {
        return \tap($this->createHttpClient(), function ($client) {
            if (isset($this->config['client_id']) || isset($this->config['client_secret'])) {
                $client->setClientId($this->config['client_id'])
                        ->setClientSecret($this->config['client_secret']);
            }

            if (isset($this->config['access_token'])) {
                $client->setAccessToken($this->config['access_token']);
            }
        });
    }
517439
@Override
    public void clientCreated(Client client) {
        if (AGENT_PORT_TYPE.equals(getEndpointName(client.getEndpoint()))) {
            return;
        }
        processStart(client.getEndpoint(), EventTypeEnum.CLIENT_CREATE);
    }
769897
protected function createClient()
    {
        return new Client([
            'base_uri' => $this->baseUrl,
            'handler'  => $this->handlerStack,
            RequestOptions::HTTP_ERRORS => false,
            RequestOptions::AUTH => [$this->app->getClientId(), $this->app->getClientSecret()],
            RequestOptions::TIMEOUT => $this->requestTimeout,
        ]);
    }
815139
def create_client():
    """"""
    result = False
    if g.client_id in drivers:
        result = True
    return jsonify({'Success': result})
995692
@SneakyThrows
    public HttpClient createHttpClient() {
        val builder = new StdHttpClient.Builder()
            .url(couchDbProperties.getUrl())
            .maxConnections(couchDbProperties.getMaxConnections())
            .maxCacheEntries(couchDbProperties.getMaxCacheEntries())
            .connectionTimeout(couchDbProperties.getConnectionTimeout())
            .socketTimeout(couchDbProperties.getSocketTimeout())
            .enableSSL(couchDbProperties.isEnableSSL())
            .relaxedSSLSettings(couchDbProperties.isRelaxedSSLSettings())
            .caching(couchDbProperties.isCaching())
            .maxObjectSizeBytes(couchDbProperties.getMaxObjectSizeBytes())
            .useExpectContinue(couchDbProperties.isUseExpectContinue())
            .cleanupIdleConnections(couchDbProperties.isCleanupIdleConnections());


        if (StringUtils.isNotBlank(couchDbProperties.getProxyHost())) {
            builder.proxy(couchDbProperties.getProxyHost());

            if (couchDbProperties.getProxyPort() > 0) {
                builder.proxyPort(couchDbProperties.getProxyPort());
                LOGGER.info("CouchDb proxy settings enabled [{}]:[{}]", couchDbProperties.getProxyHost(), couchDbProperties.getProxyPort());
            } else {
                LOGGER.debug("Proxy port not set for host [{}] clearing proxy host.", couchDbProperties.getProxyHost());
                builder.proxy(null);
            }
        }

        if (StringUtils.isNotBlank(couchDbProperties.getUsername())) {
            builder.username(couchDbProperties.getUsername());
        }

        if (StringUtils.isNotBlank(couchDbProperties.getPassword())) {
            builder.password(couchDbProperties.getPassword());
        }

        val client = builder.build();
        LOGGER.debug("Client created: [{}]", client);
        return client;
    }
339553
function initClient(client) {
  var ws = client.ws;

  client.state = States.CONNECTING;

  // Wait until we get the user's token so we can finish authorizing
  ws.onmessage = function(msg) {
    var data;
    var info;

    try {
      // Keep track of how much data we receive
      info = client.info();
      if(info) {
        info.bytesReceived += Buffer.byteLength(msg.data, 'utf8');
      }

      data = JSON.parse(msg.data);
    } catch(err) {
      log.error({client: client, err: err}, 'Error parsing client token. Data was `%s`', msg.data);
      ClientInfo.remove(token);
      client.close({
        code: 1011,
        message: 'Error: token could not be parsed.'
      });
      return;
    }

    // Authorize user
    var token = data.token;
    var username = WebsocketAuth.getAuthorizedUsername(token);
    if (!username) {
      log.warn({client: client}, 'Client sent an invalid or expired token (could not get username): token=%s', token);
      ClientInfo.remove(token);
      client.close({
        code: 1008,
        message: 'Error: invalid token.'
      });
      return;
    }

    // Update client details now that he/she is authenticated
    client.id = token;
    client.username = username;
    client.fs = filesystem.create(username);
    ClientInfo.update(client);

    log.info({client: client}, 'Client connected');

    runClient(client);
  };
}
1269131
function newClientStub() {
    // First create the appropriate TLS certs with dgraph cert:
    //     $ dgraph cert
    //     $ dgraph cert -n localhost
    //     $ dgraph cert -c user
    const rootCaCert = fs.readFileSync(path.join(__dirname, 'tls', 'ca.crt'));
    const clientCertKey = fs.readFileSync(path.join(__dirname, 'tls', 'client.user.key'));
    const clientCert = fs.readFileSync(path.join(__dirname, 'tls', 'client.user.crt'));
    return new dgraph.DgraphClientStub(
        "localhost:9080",
        grpc.credentials.createSsl(rootCaCert, clientCertKey, clientCert));
}
1244867
function createHandler(options) {
  /**
   * Client request handler
   * Data from the incoming request (plus options) is forwarded to the AWS module
   */
  return async (ctx) => {
    const { credentials, endpoint, region } = options
    const { rawBody: body, header: headers, method, url: path } = ctx.request

    console.log(chalk.cyan(method, path))

    const params = { body, credentials, endpoint, headers, method, path, region }
    const req = createSignedAWSRequest(params)
    const res = await sendAWSRequest(req)

    ctx.status = 200
    ctx.type = 'application/json'
    ctx.response.header = stripProxyResHeaders(res)
    ctx.body = res.body
  }
}
1103089
def create_client(self, name):
        ''''''
        client = {'client':{
            'name': name,
        }}
        response = self.post_request('clients/', client, follow = True)
        if response:
            return Client(self, response['client'])
1369956
function createClient(port, host, password) {
	var client = redis.createClient(port, host, {
		connect_timeout: false, // Never stop trying to connect to Redis...
		max_attempts: null, // ... no matter how many times it slaps us in the face.
		retry_max_delay: 5000, // Decay attempts to reconnect to a max of 5 seconds.
		enable_offline_queue: true // Queue up requests while we wait for a connection to re-establish.
	});

	client.on('error', function(err) {
		// Log the error, but don't quit. Our offline queue will keep us going until Redis comes back.
		log.error(err);
	});

	if (client && password) {
		client.auth(password);
	}

	return client;
}