Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php
/*
* Copyright 2026 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START aiplatform_v1_generated_ReasoningEngineExecutionService_CancelAsyncQueryReasoningEngine_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\CancelAsyncQueryReasoningEngineRequest;
use Google\Cloud\AIPlatform\V1\CancelAsyncQueryReasoningEngineResponse;
use Google\Cloud\AIPlatform\V1\Client\ReasoningEngineExecutionServiceClient;

/**
* Cancels an AsyncQueryReasoningEngine operation.
*
* @param string $formattedName The name of the ReasoningEngine resource to use.
* Format:
* `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`
* Please see {@see ReasoningEngineExecutionServiceClient::reasoningEngineName()} for help formatting this field.
* @param string $operationName The name of the longrunning operation returned from
* AsyncQueryReasoningEngine.
* Format:
* `projects/{project}/locations/{location}/operations/{operation}`
*/
function cancel_async_query_reasoning_engine_sample(
string $formattedName,
string $operationName
): void {
// Create a client.
$reasoningEngineExecutionServiceClient = new ReasoningEngineExecutionServiceClient();

// Prepare the request message.
$request = (new CancelAsyncQueryReasoningEngineRequest())
->setName($formattedName)
->setOperationName($operationName);

// Call the API and handle any network failures.
try {
/** @var CancelAsyncQueryReasoningEngineResponse $response */
$response = $reasoningEngineExecutionServiceClient->cancelAsyncQueryReasoningEngine($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}

/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = ReasoningEngineExecutionServiceClient::reasoningEngineName(
'[PROJECT]',
'[LOCATION]',
'[REASONING_ENGINE]'
);
$operationName = '[OPERATION_NAME]';

cancel_async_query_reasoning_engine_sample($formattedName, $operationName);
}
// [END aiplatform_v1_generated_ReasoningEngineExecutionService_CancelAsyncQueryReasoningEngine_sync]
122 changes: 122 additions & 0 deletions AiPlatform/src/V1/CancelAsyncQueryReasoningEngineRequest.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions AiPlatform/src/V1/CancelAsyncQueryReasoningEngineResponse.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
use Google\Auth\FetchAuthTokenInterface;
use Google\Cloud\AIPlatform\V1\AsyncQueryReasoningEngineRequest;
use Google\Cloud\AIPlatform\V1\AsyncQueryReasoningEngineResponse;
use Google\Cloud\AIPlatform\V1\CancelAsyncQueryReasoningEngineRequest;
use Google\Cloud\AIPlatform\V1\CancelAsyncQueryReasoningEngineResponse;
use Google\Cloud\AIPlatform\V1\QueryReasoningEngineRequest;
use Google\Cloud\AIPlatform\V1\QueryReasoningEngineResponse;
use Google\Cloud\AIPlatform\V1\StreamQueryReasoningEngineRequest;
Expand Down Expand Up @@ -67,6 +69,7 @@
* contained within formatted names that are returned by the API.
*
* @method PromiseInterface<OperationResponse> asyncQueryReasoningEngineAsync(AsyncQueryReasoningEngineRequest $request, array $optionalArgs = [])
* @method PromiseInterface<CancelAsyncQueryReasoningEngineResponse> cancelAsyncQueryReasoningEngineAsync(CancelAsyncQueryReasoningEngineRequest $request, array $optionalArgs = [])
* @method PromiseInterface<QueryReasoningEngineResponse> queryReasoningEngineAsync(QueryReasoningEngineRequest $request, array $optionalArgs = [])
* @method PromiseInterface<Location> getLocationAsync(GetLocationRequest $request, array $optionalArgs = [])
* @method PromiseInterface<PagedListResponse> listLocationsAsync(ListLocationsRequest $request, array $optionalArgs = [])
Expand Down Expand Up @@ -330,6 +333,36 @@ public function asyncQueryReasoningEngine(
return $this->startApiCall('AsyncQueryReasoningEngine', $request, $callOptions)->wait();
}

/**
* Cancels an AsyncQueryReasoningEngine operation.
*
* The async variant is
* {@see ReasoningEngineExecutionServiceClient::cancelAsyncQueryReasoningEngineAsync()}
* .
*
* @example samples/V1/ReasoningEngineExecutionServiceClient/cancel_async_query_reasoning_engine.php
*
* @param CancelAsyncQueryReasoningEngineRequest $request A request to house fields associated with the call.
* @param array $callOptions {
* Optional.
*
* @type RetrySettings|array $retrySettings
* Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
* associative array of retry settings parameters. See the documentation on
* {@see RetrySettings} for example usage.
* }
*
* @return CancelAsyncQueryReasoningEngineResponse
*
* @throws ApiException Thrown if the API call fails.
*/
public function cancelAsyncQueryReasoningEngine(
CancelAsyncQueryReasoningEngineRequest $request,
array $callOptions = []
): CancelAsyncQueryReasoningEngineResponse {
return $this->startApiCall('CancelAsyncQueryReasoningEngine', $request, $callOptions)->wait();
}

/**
* Queries using a reasoning engine.
*
Expand Down
5 changes: 5 additions & 0 deletions AiPlatform/src/V1/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2140,6 +2140,11 @@
"asyncQueryReasoningEngine"
]
},
"CancelAsyncQueryReasoningEngine": {
"methods": [
"cancelAsyncQueryReasoningEngine"
]
},
"QueryReasoningEngine": {
"methods": [
"queryReasoningEngine"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
"retry_codes_name": "no_retry_codes",
"retry_params_name": "no_retry_params"
},
"CancelAsyncQueryReasoningEngine": {
"timeout_millis": 60000,
"retry_codes_name": "no_retry_codes",
"retry_params_name": "no_retry_params"
},
"QueryReasoningEngine": {
"timeout_millis": 60000,
"retry_codes_name": "no_retry_codes",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@
],
],
],
'CancelAsyncQueryReasoningEngine' => [
'callType' => \Google\ApiCore\Call::UNARY_CALL,
'responseType' => 'Google\Cloud\AIPlatform\V1\CancelAsyncQueryReasoningEngineResponse',
'headerParams' => [
[
'keyName' => 'name',
'fieldAccessors' => [
'getName',
],
],
],
],
'QueryReasoningEngine' => [
'callType' => \Google\ApiCore\Call::UNARY_CALL,
'responseType' => 'Google\Cloud\AIPlatform\V1\QueryReasoningEngineResponse',
Expand Down
Loading
Loading