Skip to content

Commit

Permalink
chore(php): support new surface LROs (#7355)
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 638666995
Source-Link: googleapis/googleapis@94da39f
Source-Link: https://github.com/googleapis/googleapis-gen/commit/8a9dd85ba56bae37f478b4ad64c4b12bef0e877f
Copy-Tag: eyJwIjoiU2VjdXJlU291cmNlTWFuYWdlci8uT3dsQm90LnlhbWwiLCJoIjoiOGE5ZGQ4NWJhNTZiYWUzN2Y0NzhiNGFkNjRjNGIxMmJlZjBlODc3ZiJ9
Copy-Tag: eyJwIjoiU2VjdXJpdHlDZW50ZXIvLk93bEJvdC55YW1sIiwiaCI6IjhhOWRkODViYTU2YmFlMzdmNDc4YjRhZDY0YzRiMTJiZWYwZTg3N2YifQ==
Copy-Tag: eyJwIjoiU3RvcmFnZUNvbnRyb2wvLk93bEJvdC55YW1sIiwiaCI6IjhhOWRkODViYTU2YmFlMzdmNDc4YjRhZDY0YzRiMTJiZWYwZTg3N2YifQ==
Copy-Tag: eyJwIjoiVGVsY29BdXRvbWF0aW9uLy5Pd2xCb3QueWFtbCIsImgiOiI4YTlkZDg1YmE1NmJhZTM3ZjQ3OGI0YWQ2NGM0YjEyYmVmMGU4NzdmIn0=
Copy-Tag: eyJwIjoiVHB1Ly5Pd2xCb3QueWFtbCIsImgiOiI4YTlkZDg1YmE1NmJhZTM3ZjQ3OGI0YWQ2NGM0YjEyYmVmMGU4NzdmIn0=
Copy-Tag: eyJwIjoiV29ya2Zsb3dzLy5Pd2xCb3QueWFtbCIsImgiOiI4YTlkZDg1YmE1NmJhZTM3ZjQ3OGI0YWQ2NGM0YjEyYmVmMGU4NzdmIn0=
Co-authored-by: Brent Shaffer <[email protected]>
  • Loading branch information
gcf-owl-bot[bot] and bshaffer authored May 30, 2024
1 parent 2376f1d commit fec6fad
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
21 changes: 20 additions & 1 deletion src/V2/Client/TpuClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
use Google\ApiCore\ApiException;
use Google\ApiCore\CredentialsWrapper;
use Google\ApiCore\GapicClientTrait;
use Google\ApiCore\LongRunning\OperationsClient;
use Google\ApiCore\OperationResponse;
use Google\ApiCore\PagedListResponse;
use Google\ApiCore\ResourceHelperTrait;
Expand Down Expand Up @@ -56,6 +55,7 @@
use Google\Cloud\Tpu\V2\StartNodeRequest;
use Google\Cloud\Tpu\V2\StopNodeRequest;
use Google\Cloud\Tpu\V2\UpdateNodeRequest;
use Google\LongRunning\Client\OperationsClient;
use Google\LongRunning\Operation;
use GuzzleHttp\Promise\PromiseInterface;

Expand Down Expand Up @@ -167,6 +167,25 @@ public function resumeOperation($operationName, $methodName = null)
return $operation;
}

/**
* Create the default operation client for the service.
*
* @param array $options ClientOptions for the client.
*
* @return OperationsClient
*/
private function createOperationsClient(array $options)
{
// Unset client-specific configuration options
unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']);

if (isset($options['operationsClient'])) {
return $options['operationsClient'];
}

return new OperationsClient($options);
}

/**
* Formats a string containing the fully-qualified path to represent a
* accelerator_type resource.
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/V2/Client/TpuClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

use Google\ApiCore\ApiException;
use Google\ApiCore\CredentialsWrapper;
use Google\ApiCore\LongRunning\OperationsClient;
use Google\ApiCore\Testing\GeneratedTest;
use Google\ApiCore\Testing\MockTransport;
use Google\Cloud\Location\GetLocationRequest;
Expand Down Expand Up @@ -53,6 +52,7 @@
use Google\Cloud\Tpu\V2\StartNodeRequest;
use Google\Cloud\Tpu\V2\StopNodeRequest;
use Google\Cloud\Tpu\V2\UpdateNodeRequest;
use Google\LongRunning\Client\OperationsClient;
use Google\LongRunning\GetOperationRequest;
use Google\LongRunning\Operation;
use Google\Protobuf\Any;
Expand Down

0 comments on commit fec6fad

Please sign in to comment.