Skip to content

Commit f40cd90

Browse files
feat: [DatabaseCenter] add a AggregateQueryStats API (#9200)
* feat: add a AggregateQueryStats API PiperOrigin-RevId: 917888205 Source-Link: googleapis/googleapis@d4c5fdd Source-Link: googleapis/googleapis-gen@698c860 Copy-Tag: eyJwIjoiRGF0YWJhc2VDZW50ZXIvLk93bEJvdC55YW1sIiwiaCI6IjY5OGM4NjBmMTI5MWZiYzhmMGFhMjUyYTFjMjMyNmEzM2NkOTAzMGQifQ== * 🦉 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 b1c7d34 commit f40cd90

15 files changed

Lines changed: 1568 additions & 1 deletion

DatabaseCenter/metadata/V1Beta/Service.php

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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 databasecenter_v1beta_generated_DatabaseCenter_AggregateQueryStats_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\PagedListResponse;
28+
use Google\Cloud\DatabaseCenter\V1beta\AggregateQueryStatsRequest;
29+
use Google\Cloud\DatabaseCenter\V1beta\Client\DatabaseCenterClient;
30+
use Google\Cloud\DatabaseCenter\V1beta\QueryStatsInfo;
31+
32+
/**
33+
* AggregateQueryStats provides database resource query execution statistics.
34+
*
35+
* @param string $parent Parent can be a project, a folder, or an organization. The search
36+
* is limited to the resources within the `parent`.
37+
*
38+
* The allowed values are:
39+
*
40+
* * projects/{PROJECT_ID} (e.g., "projects/foo-bar")
41+
* * projects/{PROJECT_NUMBER} (e.g., "projects/12345678")
42+
* * folders/{FOLDER_NUMBER} (e.g., "folders/1234567")
43+
* * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
44+
*/
45+
function aggregate_query_stats_sample(string $parent): void
46+
{
47+
// Create a client.
48+
$databaseCenterClient = new DatabaseCenterClient();
49+
50+
// Prepare the request message.
51+
$request = (new AggregateQueryStatsRequest())
52+
->setParent($parent);
53+
54+
// Call the API and handle any network failures.
55+
try {
56+
/** @var PagedListResponse $response */
57+
$response = $databaseCenterClient->aggregateQueryStats($request);
58+
59+
/** @var QueryStatsInfo $element */
60+
foreach ($response as $element) {
61+
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
62+
}
63+
} catch (ApiException $ex) {
64+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
65+
}
66+
}
67+
68+
/**
69+
* Helper to execute the sample.
70+
*
71+
* This sample has been automatically generated and should be regarded as a code
72+
* template only. It will require modifications to work:
73+
* - It may require correct/in-range values for request initialization.
74+
* - It may require specifying regional endpoints when creating the service client,
75+
* please see the apiEndpoint client configuration option for more details.
76+
*/
77+
function callSample(): void
78+
{
79+
$parent = '[PARENT]';
80+
81+
aggregate_query_stats_sample($parent);
82+
}
83+
// [END databasecenter_v1beta_generated_DatabaseCenter_AggregateQueryStats_sync]

0 commit comments

Comments
 (0)