/
githubmirror
/
ydb-php-sdk
Обзор
Документация
Войти
/
githubmirror
/
ydb-php-sdk
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Operations.php
108 строк
2 KB
Alex Mironov
Separated grpc options to own section: `grpc`
12 апр 2024, 15:45
12 апр 2024, 15:45
f53126b
Код
Авторство
О чём код?
<?php namespace YdbPlatform\Ydb; use Psr\Log\LoggerInterface; use Ydb\Operations\V1\OperationServiceClient as ServiceClient; class Operations { use Traits\RequestTrait; use Traits\ParseResultTrait; use Traits\LoggerTrait; /** * @var ServiceClient */ protected $client; /** * @var array */ protected $meta; /** * @var LoggerInterface */ protected $logger; /** * @var Iam */ protected $credentials; /** * @param Ydb $ydb * @param LoggerInterface|null $logger */ public function __construct(Ydb $ydb, LoggerInterface $logger = null) { $this->ydb = $ydb; $this->client = new ServiceClient($ydb->endpoint(), $ydb->grpcOpts()); $this->meta = $ydb->meta(); $this->credentials = $ydb->iam(); $this->logger = $logger; } /** * @param string $id * @return bool|mixed|void */ public function get(string $id) { return $this->request('GetOperation', [ 'id' => $id, ]); } /** * @param string $id * @return bool|mixed|void */ public function cancel(string $id) { return $this->request('CancelOperation', [ 'id' => $id, ]); } /** * @param string $id * @return bool|mixed|void */ public function forget(string $id) { return $this->request('ForgetOperation', [ 'id' => $id, ]); } /** * @param $kind * @param int $page_size * @param string $page_token * @return bool|mixed|void */ public function list($kind, int $page_size = 0, string $page_token = '') { return $this->request('ListOperations', [ 'kind' => $kind, 'page_size' => $page_size, 'page_token' => $page_token, ]); } /** * @param string $method * @param array $data * @return bool|mixed|void */ protected function request(string $method, array $data = []) { return $this->doRequest('Operations', $method, $data); } }