Skip to content

Commit 345514e

Browse files
feat: [GeminiDataAnalytics] added sync APIs for the CRUD operations of Data Agent (#8858)
* feat: added sync APIs for the CRUD operations of Data Agent PiperOrigin-RevId: 855534426 Source-Link: googleapis/googleapis@fbda01e Source-Link: googleapis/googleapis-gen@b5a77c8 Copy-Tag: eyJwIjoiR2VtaW5pRGF0YUFuYWx5dGljcy8uT3dsQm90LnlhbWwiLCJoIjoiYjVhNzdjODc4MTI5ZGFiNzk5ODg3NDhiNmIyM2E1YTAwZjdhZDQ1ZSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent a9839a7 commit 345514e

File tree

10 files changed

+602
-0
lines changed

10 files changed

+602
-0
lines changed
709 Bytes
Binary file not shown.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
/*
3+
* Copyright 2026 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START geminidataanalytics_v1beta_generated_DataAgentService_CreateDataAgentSync_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Cloud\GeminiDataAnalytics\V1beta\Client\DataAgentServiceClient;
28+
use Google\Cloud\GeminiDataAnalytics\V1beta\CreateDataAgentRequest;
29+
use Google\Cloud\GeminiDataAnalytics\V1beta\DataAgent;
30+
31+
/**
32+
* Creates a new DataAgent in a given project and location synchronously.
33+
*
34+
* @param string $formattedParent Value for parent. Please see
35+
* {@see DataAgentServiceClient::locationName()} for help formatting this field.
36+
*/
37+
function create_data_agent_sync_sample(string $formattedParent): void
38+
{
39+
// Create a client.
40+
$dataAgentServiceClient = new DataAgentServiceClient();
41+
42+
// Prepare the request message.
43+
$dataAgent = new DataAgent();
44+
$request = (new CreateDataAgentRequest())
45+
->setParent($formattedParent)
46+
->setDataAgent($dataAgent);
47+
48+
// Call the API and handle any network failures.
49+
try {
50+
/** @var DataAgent $response */
51+
$response = $dataAgentServiceClient->createDataAgentSync($request);
52+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
53+
} catch (ApiException $ex) {
54+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
55+
}
56+
}
57+
58+
/**
59+
* Helper to execute the sample.
60+
*
61+
* This sample has been automatically generated and should be regarded as a code
62+
* template only. It will require modifications to work:
63+
* - It may require correct/in-range values for request initialization.
64+
* - It may require specifying regional endpoints when creating the service client,
65+
* please see the apiEndpoint client configuration option for more details.
66+
*/
67+
function callSample(): void
68+
{
69+
$formattedParent = DataAgentServiceClient::locationName('[PROJECT]', '[LOCATION]');
70+
71+
create_data_agent_sync_sample($formattedParent);
72+
}
73+
// [END geminidataanalytics_v1beta_generated_DataAgentService_CreateDataAgentSync_sync]
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?php
2+
/*
3+
* Copyright 2026 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START geminidataanalytics_v1beta_generated_DataAgentService_DeleteDataAgentSync_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Cloud\GeminiDataAnalytics\V1beta\Client\DataAgentServiceClient;
28+
use Google\Cloud\GeminiDataAnalytics\V1beta\DeleteDataAgentRequest;
29+
30+
/**
31+
* Deletes a single DataAgent synchronously.
32+
*
33+
* @param string $formattedName Name of the resource. Please see
34+
* {@see DataAgentServiceClient::dataAgentName()} for help formatting this field.
35+
*/
36+
function delete_data_agent_sync_sample(string $formattedName): void
37+
{
38+
// Create a client.
39+
$dataAgentServiceClient = new DataAgentServiceClient();
40+
41+
// Prepare the request message.
42+
$request = (new DeleteDataAgentRequest())
43+
->setName($formattedName);
44+
45+
// Call the API and handle any network failures.
46+
try {
47+
$dataAgentServiceClient->deleteDataAgentSync($request);
48+
printf('Call completed successfully.' . PHP_EOL);
49+
} catch (ApiException $ex) {
50+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
51+
}
52+
}
53+
54+
/**
55+
* Helper to execute the sample.
56+
*
57+
* This sample has been automatically generated and should be regarded as a code
58+
* template only. It will require modifications to work:
59+
* - It may require correct/in-range values for request initialization.
60+
* - It may require specifying regional endpoints when creating the service client,
61+
* please see the apiEndpoint client configuration option for more details.
62+
*/
63+
function callSample(): void
64+
{
65+
$formattedName = DataAgentServiceClient::dataAgentName('[PROJECT]', '[LOCATION]', '[DATA_AGENT]');
66+
67+
delete_data_agent_sync_sample($formattedName);
68+
}
69+
// [END geminidataanalytics_v1beta_generated_DataAgentService_DeleteDataAgentSync_sync]
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
/*
3+
* Copyright 2026 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START geminidataanalytics_v1beta_generated_DataAgentService_UpdateDataAgentSync_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Cloud\GeminiDataAnalytics\V1beta\Client\DataAgentServiceClient;
28+
use Google\Cloud\GeminiDataAnalytics\V1beta\DataAgent;
29+
use Google\Cloud\GeminiDataAnalytics\V1beta\UpdateDataAgentRequest;
30+
31+
/**
32+
* Updates the parameters of a single DataAgent synchronously.
33+
*
34+
* This sample has been automatically generated and should be regarded as a code
35+
* template only. It will require modifications to work:
36+
* - It may require correct/in-range values for request initialization.
37+
* - It may require specifying regional endpoints when creating the service client,
38+
* please see the apiEndpoint client configuration option for more details.
39+
*/
40+
function update_data_agent_sync_sample(): void
41+
{
42+
// Create a client.
43+
$dataAgentServiceClient = new DataAgentServiceClient();
44+
45+
// Prepare the request message.
46+
$dataAgent = new DataAgent();
47+
$request = (new UpdateDataAgentRequest())
48+
->setDataAgent($dataAgent);
49+
50+
// Call the API and handle any network failures.
51+
try {
52+
/** @var DataAgent $response */
53+
$response = $dataAgentServiceClient->updateDataAgentSync($request);
54+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
55+
} catch (ApiException $ex) {
56+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
57+
}
58+
}
59+
// [END geminidataanalytics_v1beta_generated_DataAgentService_UpdateDataAgentSync_sync]

GeminiDataAnalytics/src/V1beta/Client/DataAgentServiceClient.php

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,16 @@
6969
* @experimental
7070
*
7171
* @method PromiseInterface<OperationResponse> createDataAgentAsync(CreateDataAgentRequest $request, array $optionalArgs = [])
72+
* @method PromiseInterface<DataAgent> createDataAgentSyncAsync(CreateDataAgentRequest $request, array $optionalArgs = [])
7273
* @method PromiseInterface<OperationResponse> deleteDataAgentAsync(DeleteDataAgentRequest $request, array $optionalArgs = [])
74+
* @method PromiseInterface<void> deleteDataAgentSyncAsync(DeleteDataAgentRequest $request, array $optionalArgs = [])
7375
* @method PromiseInterface<DataAgent> getDataAgentAsync(GetDataAgentRequest $request, array $optionalArgs = [])
7476
* @method PromiseInterface<Policy> getIamPolicyAsync(GetIamPolicyRequest $request, array $optionalArgs = [])
7577
* @method PromiseInterface<PagedListResponse> listAccessibleDataAgentsAsync(ListAccessibleDataAgentsRequest $request, array $optionalArgs = [])
7678
* @method PromiseInterface<PagedListResponse> listDataAgentsAsync(ListDataAgentsRequest $request, array $optionalArgs = [])
7779
* @method PromiseInterface<Policy> setIamPolicyAsync(SetIamPolicyRequest $request, array $optionalArgs = [])
7880
* @method PromiseInterface<OperationResponse> updateDataAgentAsync(UpdateDataAgentRequest $request, array $optionalArgs = [])
81+
* @method PromiseInterface<DataAgent> updateDataAgentSyncAsync(UpdateDataAgentRequest $request, array $optionalArgs = [])
7982
* @method PromiseInterface<Location> getLocationAsync(GetLocationRequest $request, array $optionalArgs = [])
8083
* @method PromiseInterface<PagedListResponse> listLocationsAsync(ListLocationsRequest $request, array $optionalArgs = [])
8184
*/
@@ -362,6 +365,34 @@ public function createDataAgent(CreateDataAgentRequest $request, array $callOpti
362365
return $this->startApiCall('CreateDataAgent', $request, $callOptions)->wait();
363366
}
364367

368+
/**
369+
* Creates a new DataAgent in a given project and location synchronously.
370+
*
371+
* The async variant is {@see DataAgentServiceClient::createDataAgentSyncAsync()} .
372+
*
373+
* @example samples/V1beta/DataAgentServiceClient/create_data_agent_sync.php
374+
*
375+
* @param CreateDataAgentRequest $request A request to house fields associated with the call.
376+
* @param array $callOptions {
377+
* Optional.
378+
*
379+
* @type RetrySettings|array $retrySettings
380+
* Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
381+
* associative array of retry settings parameters. See the documentation on
382+
* {@see RetrySettings} for example usage.
383+
* }
384+
*
385+
* @return DataAgent
386+
*
387+
* @throws ApiException Thrown if the API call fails.
388+
*
389+
* @experimental
390+
*/
391+
public function createDataAgentSync(CreateDataAgentRequest $request, array $callOptions = []): DataAgent
392+
{
393+
return $this->startApiCall('CreateDataAgentSync', $request, $callOptions)->wait();
394+
}
395+
365396
/**
366397
* Deletes a single DataAgent.
367398
*
@@ -390,6 +421,32 @@ public function deleteDataAgent(DeleteDataAgentRequest $request, array $callOpti
390421
return $this->startApiCall('DeleteDataAgent', $request, $callOptions)->wait();
391422
}
392423

424+
/**
425+
* Deletes a single DataAgent synchronously.
426+
*
427+
* The async variant is {@see DataAgentServiceClient::deleteDataAgentSyncAsync()} .
428+
*
429+
* @example samples/V1beta/DataAgentServiceClient/delete_data_agent_sync.php
430+
*
431+
* @param DeleteDataAgentRequest $request A request to house fields associated with the call.
432+
* @param array $callOptions {
433+
* Optional.
434+
*
435+
* @type RetrySettings|array $retrySettings
436+
* Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
437+
* associative array of retry settings parameters. See the documentation on
438+
* {@see RetrySettings} for example usage.
439+
* }
440+
*
441+
* @throws ApiException Thrown if the API call fails.
442+
*
443+
* @experimental
444+
*/
445+
public function deleteDataAgentSync(DeleteDataAgentRequest $request, array $callOptions = []): void
446+
{
447+
$this->startApiCall('DeleteDataAgentSync', $request, $callOptions)->wait();
448+
}
449+
393450
/**
394451
* Gets details of a single DataAgent.
395452
*
@@ -562,6 +619,34 @@ public function updateDataAgent(UpdateDataAgentRequest $request, array $callOpti
562619
return $this->startApiCall('UpdateDataAgent', $request, $callOptions)->wait();
563620
}
564621

622+
/**
623+
* Updates the parameters of a single DataAgent synchronously.
624+
*
625+
* The async variant is {@see DataAgentServiceClient::updateDataAgentSyncAsync()} .
626+
*
627+
* @example samples/V1beta/DataAgentServiceClient/update_data_agent_sync.php
628+
*
629+
* @param UpdateDataAgentRequest $request A request to house fields associated with the call.
630+
* @param array $callOptions {
631+
* Optional.
632+
*
633+
* @type RetrySettings|array $retrySettings
634+
* Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
635+
* associative array of retry settings parameters. See the documentation on
636+
* {@see RetrySettings} for example usage.
637+
* }
638+
*
639+
* @return DataAgent
640+
*
641+
* @throws ApiException Thrown if the API call fails.
642+
*
643+
* @experimental
644+
*/
645+
public function updateDataAgentSync(UpdateDataAgentRequest $request, array $callOptions = []): DataAgent
646+
{
647+
return $this->startApiCall('UpdateDataAgentSync', $request, $callOptions)->wait();
648+
}
649+
565650
/**
566651
* Gets information about a location.
567652
*

GeminiDataAnalytics/src/V1beta/gapic_metadata.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,21 @@
1515
"createDataAgent"
1616
]
1717
},
18+
"CreateDataAgentSync": {
19+
"methods": [
20+
"createDataAgentSync"
21+
]
22+
},
1823
"DeleteDataAgent": {
1924
"methods": [
2025
"deleteDataAgent"
2126
]
2227
},
28+
"DeleteDataAgentSync": {
29+
"methods": [
30+
"deleteDataAgentSync"
31+
]
32+
},
2333
"GetDataAgent": {
2434
"methods": [
2535
"getDataAgent"
@@ -50,6 +60,11 @@
5060
"updateDataAgent"
5161
]
5262
},
63+
"UpdateDataAgentSync": {
64+
"methods": [
65+
"updateDataAgentSync"
66+
]
67+
},
5368
"GetLocation": {
5469
"methods": [
5570
"getLocation"

GeminiDataAnalytics/src/V1beta/resources/data_agent_service_client_config.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,21 @@
3333
"retry_codes_name": "retry_policy_1_codes",
3434
"retry_params_name": "retry_policy_1_params"
3535
},
36+
"CreateDataAgentSync": {
37+
"timeout_millis": 600000,
38+
"retry_codes_name": "retry_policy_1_codes",
39+
"retry_params_name": "retry_policy_1_params"
40+
},
3641
"DeleteDataAgent": {
3742
"timeout_millis": 600000,
3843
"retry_codes_name": "retry_policy_1_codes",
3944
"retry_params_name": "retry_policy_1_params"
4045
},
46+
"DeleteDataAgentSync": {
47+
"timeout_millis": 600000,
48+
"retry_codes_name": "retry_policy_1_codes",
49+
"retry_params_name": "retry_policy_1_params"
50+
},
4151
"GetDataAgent": {
4252
"timeout_millis": 600000,
4353
"retry_codes_name": "retry_policy_1_codes",
@@ -68,6 +78,11 @@
6878
"retry_codes_name": "retry_policy_1_codes",
6979
"retry_params_name": "retry_policy_1_params"
7080
},
81+
"UpdateDataAgentSync": {
82+
"timeout_millis": 600000,
83+
"retry_codes_name": "retry_policy_1_codes",
84+
"retry_params_name": "retry_policy_1_params"
85+
},
7186
"GetLocation": {
7287
"timeout_millis": 600000,
7388
"retry_codes_name": "retry_policy_1_codes",

0 commit comments

Comments
 (0)