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
32 changes: 32 additions & 0 deletions Chronicle/metadata/V1/DataTable.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
@@ -0,0 +1,108 @@
<?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 chronicle_v1_generated_DataTableService_BulkCreateDataTableRows_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Chronicle\V1\BulkCreateDataTableRowsRequest;
use Google\Cloud\Chronicle\V1\BulkCreateDataTableRowsResponse;
use Google\Cloud\Chronicle\V1\Client\DataTableServiceClient;
use Google\Cloud\Chronicle\V1\CreateDataTableRowRequest;
use Google\Cloud\Chronicle\V1\DataTableRow;

/**
* Create data table rows in bulk.
*
* @param string $formattedParent The resource id of the data table.
* Format:
* /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}
* Please see {@see DataTableServiceClient::dataTableName()} for help formatting this field.
* @param string $formattedRequestsParent The resource id of the data table.
* Format:
* /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}
* Please see {@see DataTableServiceClient::dataTableName()} for help formatting this field.
* @param string $requestsDataTableRowValuesElement All column values for a single row. The values should be in the
* same order as the columns of the data tables.
*/
function bulk_create_data_table_rows_sample(
string $formattedParent,
string $formattedRequestsParent,
string $requestsDataTableRowValuesElement
): void {
// Create a client.
$dataTableServiceClient = new DataTableServiceClient();

// Prepare the request message.
$requestsDataTableRowValues = [$requestsDataTableRowValuesElement,];
$requestsDataTableRow = (new DataTableRow())
->setValues($requestsDataTableRowValues);
$createDataTableRowRequest = (new CreateDataTableRowRequest())
->setParent($formattedRequestsParent)
->setDataTableRow($requestsDataTableRow);
$requests = [$createDataTableRowRequest,];
$request = (new BulkCreateDataTableRowsRequest())
->setParent($formattedParent)
->setRequests($requests);

// Call the API and handle any network failures.
try {
/** @var BulkCreateDataTableRowsResponse $response */
$response = $dataTableServiceClient->bulkCreateDataTableRows($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
{
$formattedParent = DataTableServiceClient::dataTableName(
'[PROJECT]',
'[LOCATION]',
'[INSTANCE]',
'[DATA_TABLE]'
);
$formattedRequestsParent = DataTableServiceClient::dataTableName(
'[PROJECT]',
'[LOCATION]',
'[INSTANCE]',
'[DATA_TABLE]'
);
$requestsDataTableRowValuesElement = '[VALUES]';

bulk_create_data_table_rows_sample(
$formattedParent,
$formattedRequestsParent,
$requestsDataTableRowValuesElement
);
}
// [END chronicle_v1_generated_DataTableService_BulkCreateDataTableRows_sync]
Loading
Loading