Skip to content

Commit 0113242

Browse files
feat: [Chronicle] Add DataTableService to Chronicle v1 Client Libraries (#9102)
* feat: Add DataTableService to Chronicle v1 Client Libraries PiperOrigin-RevId: 898791366 Source-Link: googleapis/googleapis@e182cf5 Source-Link: googleapis/googleapis-gen@dab413d Copy-Tag: eyJwIjoiQ2hyb25pY2xlLy5Pd2xCb3QueWFtbCIsImgiOiJkYWI0MTNkNDNiZDQ3NTM4NmIzNzVkN2RjYTMxNjljYjA2M2RjZDhkIn0= * 🦉 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 fd69d38 commit 0113242

50 files changed

Lines changed: 8040 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Chronicle/metadata/V1/DataTable.php

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
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 chronicle_v1_generated_DataTableService_BulkCreateDataTableRows_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Cloud\Chronicle\V1\BulkCreateDataTableRowsRequest;
28+
use Google\Cloud\Chronicle\V1\BulkCreateDataTableRowsResponse;
29+
use Google\Cloud\Chronicle\V1\Client\DataTableServiceClient;
30+
use Google\Cloud\Chronicle\V1\CreateDataTableRowRequest;
31+
use Google\Cloud\Chronicle\V1\DataTableRow;
32+
33+
/**
34+
* Create data table rows in bulk.
35+
*
36+
* @param string $formattedParent The resource id of the data table.
37+
* Format:
38+
* /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}
39+
* Please see {@see DataTableServiceClient::dataTableName()} for help formatting this field.
40+
* @param string $formattedRequestsParent The resource id of the data table.
41+
* Format:
42+
* /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}
43+
* Please see {@see DataTableServiceClient::dataTableName()} for help formatting this field.
44+
* @param string $requestsDataTableRowValuesElement All column values for a single row. The values should be in the
45+
* same order as the columns of the data tables.
46+
*/
47+
function bulk_create_data_table_rows_sample(
48+
string $formattedParent,
49+
string $formattedRequestsParent,
50+
string $requestsDataTableRowValuesElement
51+
): void {
52+
// Create a client.
53+
$dataTableServiceClient = new DataTableServiceClient();
54+
55+
// Prepare the request message.
56+
$requestsDataTableRowValues = [$requestsDataTableRowValuesElement,];
57+
$requestsDataTableRow = (new DataTableRow())
58+
->setValues($requestsDataTableRowValues);
59+
$createDataTableRowRequest = (new CreateDataTableRowRequest())
60+
->setParent($formattedRequestsParent)
61+
->setDataTableRow($requestsDataTableRow);
62+
$requests = [$createDataTableRowRequest,];
63+
$request = (new BulkCreateDataTableRowsRequest())
64+
->setParent($formattedParent)
65+
->setRequests($requests);
66+
67+
// Call the API and handle any network failures.
68+
try {
69+
/** @var BulkCreateDataTableRowsResponse $response */
70+
$response = $dataTableServiceClient->bulkCreateDataTableRows($request);
71+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
72+
} catch (ApiException $ex) {
73+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
74+
}
75+
}
76+
77+
/**
78+
* Helper to execute the sample.
79+
*
80+
* This sample has been automatically generated and should be regarded as a code
81+
* template only. It will require modifications to work:
82+
* - It may require correct/in-range values for request initialization.
83+
* - It may require specifying regional endpoints when creating the service client,
84+
* please see the apiEndpoint client configuration option for more details.
85+
*/
86+
function callSample(): void
87+
{
88+
$formattedParent = DataTableServiceClient::dataTableName(
89+
'[PROJECT]',
90+
'[LOCATION]',
91+
'[INSTANCE]',
92+
'[DATA_TABLE]'
93+
);
94+
$formattedRequestsParent = DataTableServiceClient::dataTableName(
95+
'[PROJECT]',
96+
'[LOCATION]',
97+
'[INSTANCE]',
98+
'[DATA_TABLE]'
99+
);
100+
$requestsDataTableRowValuesElement = '[VALUES]';
101+
102+
bulk_create_data_table_rows_sample(
103+
$formattedParent,
104+
$formattedRequestsParent,
105+
$requestsDataTableRowValuesElement
106+
);
107+
}
108+
// [END chronicle_v1_generated_DataTableService_BulkCreateDataTableRows_sync]

0 commit comments

Comments
 (0)