hook ສຳລັບການສົ່ງ REST ແລະ ການຮ້ອງຂໍ token ໃນ google/cloud-bigquery 1.39.3 ສາມາດແບ່ງປັນ PSR request handler ທີ່ຮູ້ຈັກ proxy:

$proxy = 'http://proxy.example:8080';
$http = new \GuzzleHttp\Client();
$send = static function (
    \Psr\Http\Message\RequestInterface $request,
    array $options = []
) use ($http, $proxy) {
    $options['proxy'] = $proxy;
    return $http->send($request, $options);
};

$bigQuery = new \Google\Cloud\BigQuery\BigQueryClient([
    'projectId' => $projectId,
    'httpHandler' => $send,
    'authHttpHandler' => $send,
]);

callable ກຳນົດຕົວເລືອກ proxy ຂອງ Guzzle ໃນທຸກຄຳຮ້ອງຂໍ, ລວມທັງ HTTP endpoint ສາທາລະນະທີ່ເລືອກຈາກ ລາຍຊື່ HTTP proxy, ແລະ constructor ໃຫ້ callable ນັ້ນແກ່ທັງ httpHandler ແລະ authHttpHandler. ສິ່ງນີ້ກວມເອົາການສົ່ງ REST ແລະ ຄຳຮ້ອງຂໍການພິສູດຕົວຕົນທີ່ໃຊ້ hook ນັ້ນ. ຮັກສາການຕັ້ງຄ່າ credential ທີ່ຮອງຮັບ; credential ທີ່ມີ transport ອື່ນຕ້ອງການກວດສອບ transport ນັ້ນນຳ.

ເພີ່ມຂໍ້ຍົກເວັ້ນໂດຍກົງທີ່ຈຳເປັນຜ່ານ ການຕັ້ງຄ່າ proxy ທີ່ Guzzle ຮອງຮັບ. ຮັກສາ endpoint ຂອງ BigQuery API ເປັນປາຍທາງຂອງບໍລິການ: ການໃສ່ທີ່ຢູ່ proxy ໃນ apiEndpoint ຈະເລືອກບໍລິການອື່ນແທນການຕັ້ງຄ່າເສັ້ນທາງນີ້.

ເຫຼົ່ານີ້ແມ່ນຕົວເລືອກ constructor ຂອງ BigQueryClient. ພວກມັນບໍ່ໄດ້ຕັ້ງຄ່າ channel gRPC ທີ່ເປັນເອກະລາດ ແລະ ບໍ່ເຮັດໃຫ້ Google\Client ກົງກັບ interface setHttpClient ໃນໄລບຣາຣີ Google API PHP Client ແຍກຕ່າງຫາກ.

ບົດຄວາມທີ່ກ່ຽວຂ້ອງ