Skip to content
Merged
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
Binary file modified BigQueryAnalyticsHub/metadata/V1/Analyticshub.php
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php
/*
* Copyright 2025 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 analyticshub_v1_generated_AnalyticsHubService_ApproveQueryTemplate_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\AnalyticsHub\V1\ApproveQueryTemplateRequest;
use Google\Cloud\BigQuery\AnalyticsHub\V1\Client\AnalyticsHubServiceClient;
use Google\Cloud\BigQuery\AnalyticsHub\V1\QueryTemplate;

/**
* Approves a query template.
*
* @param string $formattedName The resource path of the QueryTemplate.
* e.g.
* `projects/myproject/locations/us/dataExchanges/123/queryTemplates/myqueryTemplate`. Please see
* {@see AnalyticsHubServiceClient::queryTemplateName()} for help formatting this field.
*/
function approve_query_template_sample(string $formattedName): void
{
// Create a client.
$analyticsHubServiceClient = new AnalyticsHubServiceClient();

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

// Call the API and handle any network failures.
try {
/** @var QueryTemplate $response */
$response = $analyticsHubServiceClient->approveQueryTemplate($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 = AnalyticsHubServiceClient::queryTemplateName(
'[PROJECT]',
'[LOCATION]',
'[DATA_EXCHANGE]',
'[QUERY_TEMPLATE]'
);

approve_query_template_sample($formattedName);
}
// [END analyticshub_v1_generated_AnalyticsHubService_ApproveQueryTemplate_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?php
/*
* Copyright 2025 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 analyticshub_v1_generated_AnalyticsHubService_CreateQueryTemplate_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\AnalyticsHub\V1\Client\AnalyticsHubServiceClient;
use Google\Cloud\BigQuery\AnalyticsHub\V1\CreateQueryTemplateRequest;
use Google\Cloud\BigQuery\AnalyticsHub\V1\QueryTemplate;

/**
* Creates a new QueryTemplate
*
* @param string $formattedParent The parent resource path of the QueryTemplate.
* e.g.
* `projects/myproject/locations/us/dataExchanges/123/queryTemplates/myQueryTemplate`. Please see
* {@see AnalyticsHubServiceClient::dataExchangeName()} for help formatting this field.
* @param string $queryTemplateId The ID of the QueryTemplate to create.
* Must contain only Unicode letters, numbers (0-9), underscores (_).
* Max length: 100 bytes.
* @param string $queryTemplateDisplayName Human-readable display name of the QueryTemplate. The display
* name must contain only Unicode letters, numbers (0-9), underscores (_),
* dashes (-), spaces ( ), ampersands (&) and can't start or end with spaces.
* Default value is an empty string. Max length: 63 bytes.
*/
function create_query_template_sample(
string $formattedParent,
string $queryTemplateId,
string $queryTemplateDisplayName
): void {
// Create a client.
$analyticsHubServiceClient = new AnalyticsHubServiceClient();

// Prepare the request message.
$queryTemplate = (new QueryTemplate())
->setDisplayName($queryTemplateDisplayName);
$request = (new CreateQueryTemplateRequest())
->setParent($formattedParent)
->setQueryTemplateId($queryTemplateId)
->setQueryTemplate($queryTemplate);

// Call the API and handle any network failures.
try {
/** @var QueryTemplate $response */
$response = $analyticsHubServiceClient->createQueryTemplate($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 = AnalyticsHubServiceClient::dataExchangeName(
'[PROJECT]',
'[LOCATION]',
'[DATA_EXCHANGE]'
);
$queryTemplateId = '[QUERY_TEMPLATE_ID]';
$queryTemplateDisplayName = '[DISPLAY_NAME]';

create_query_template_sample($formattedParent, $queryTemplateId, $queryTemplateDisplayName);
}
// [END analyticshub_v1_generated_AnalyticsHubService_CreateQueryTemplate_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php
/*
* Copyright 2025 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 analyticshub_v1_generated_AnalyticsHubService_DeleteQueryTemplate_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\AnalyticsHub\V1\Client\AnalyticsHubServiceClient;
use Google\Cloud\BigQuery\AnalyticsHub\V1\DeleteQueryTemplateRequest;

/**
* Deletes a query template.
*
* @param string $formattedName The resource path of the QueryTemplate.
* e.g.
* `projects/myproject/locations/us/dataExchanges/123/queryTemplates/myqueryTemplate`. Please see
* {@see AnalyticsHubServiceClient::queryTemplateName()} for help formatting this field.
*/
function delete_query_template_sample(string $formattedName): void
{
// Create a client.
$analyticsHubServiceClient = new AnalyticsHubServiceClient();

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

// Call the API and handle any network failures.
try {
$analyticsHubServiceClient->deleteQueryTemplate($request);
printf('Call completed successfully.' . PHP_EOL);
} 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 = AnalyticsHubServiceClient::queryTemplateName(
'[PROJECT]',
'[LOCATION]',
'[DATA_EXCHANGE]',
'[QUERY_TEMPLATE]'
);

delete_query_template_sample($formattedName);
}
// [END analyticshub_v1_generated_AnalyticsHubService_DeleteQueryTemplate_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php
/*
* Copyright 2025 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 analyticshub_v1_generated_AnalyticsHubService_GetQueryTemplate_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\BigQuery\AnalyticsHub\V1\Client\AnalyticsHubServiceClient;
use Google\Cloud\BigQuery\AnalyticsHub\V1\GetQueryTemplateRequest;
use Google\Cloud\BigQuery\AnalyticsHub\V1\QueryTemplate;

/**
* Gets a QueryTemplate
*
* @param string $formattedName The parent resource path of the QueryTemplate.
* e.g.
* `projects/myproject/locations/us/dataExchanges/123/queryTemplates/myqueryTemplate`. Please see
* {@see AnalyticsHubServiceClient::queryTemplateName()} for help formatting this field.
*/
function get_query_template_sample(string $formattedName): void
{
// Create a client.
$analyticsHubServiceClient = new AnalyticsHubServiceClient();

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

// Call the API and handle any network failures.
try {
/** @var QueryTemplate $response */
$response = $analyticsHubServiceClient->getQueryTemplate($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 = AnalyticsHubServiceClient::queryTemplateName(
'[PROJECT]',
'[LOCATION]',
'[DATA_EXCHANGE]',
'[QUERY_TEMPLATE]'
);

get_query_template_sample($formattedName);
}
// [END analyticshub_v1_generated_AnalyticsHubService_GetQueryTemplate_sync]
Loading
Loading