Skip to content

Commit 08d5bd2

Browse files
feat: [BigQueryReservation] Add new BACKGROUND_CHANGE_DATA_CAPTURE, BACKGROUND_COLUMN_METADATA_INDEX, and BACKGROUND_SEARCH_INDEX_REFRESH reservation assignment types (#8640)
* feat: Add new `BACKGROUND_CHANGE_DATA_CAPTURE`, `BACKGROUND_COLUMN_METADATA_INDEX`, and `BACKGROUND_SEARCH_INDEX_REFRESH` reservation assignment types feat: Add support for creation and modification of new reservation groups feat: Add new reservation IAM policy get/set/test methods PiperOrigin-RevId: 814816863 Source-Link: googleapis/googleapis@2193a2b Source-Link: googleapis/googleapis-gen@b0cf5f4 Copy-Tag: eyJwIjoiQmlnUXVlcnlSZXNlcnZhdGlvbi8uT3dsQm90LnlhbWwiLCJoIjoiYjBjZjVmNGM0MDUxYzlkZGQ3OTkwYmU5M2FlOGQwMDg3ODlkNzI4NiJ9 * 🦉 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 406a42a commit 08d5bd2

31 files changed

+3000
-231
lines changed
3.42 KB
Binary file not shown.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?php
2+
/*
3+
* Copyright 2025 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 bigqueryreservation_v1_generated_ReservationService_CreateReservationGroup_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Cloud\BigQuery\Reservation\V1\Client\ReservationServiceClient;
28+
use Google\Cloud\BigQuery\Reservation\V1\CreateReservationGroupRequest;
29+
use Google\Cloud\BigQuery\Reservation\V1\ReservationGroup;
30+
31+
/**
32+
* Creates a new reservation group.
33+
*
34+
* @param string $formattedParent Project, location. E.g.,
35+
* `projects/myproject/locations/US`
36+
* Please see {@see ReservationServiceClient::locationName()} for help formatting this field.
37+
* @param string $reservationGroupId The reservation group ID. It must only contain lower case
38+
* alphanumeric characters or dashes. It must start with a letter and must not
39+
* end with a dash. Its maximum length is 64 characters.
40+
*/
41+
function create_reservation_group_sample(
42+
string $formattedParent,
43+
string $reservationGroupId
44+
): void {
45+
// Create a client.
46+
$reservationServiceClient = new ReservationServiceClient();
47+
48+
// Prepare the request message.
49+
$reservationGroup = new ReservationGroup();
50+
$request = (new CreateReservationGroupRequest())
51+
->setParent($formattedParent)
52+
->setReservationGroupId($reservationGroupId)
53+
->setReservationGroup($reservationGroup);
54+
55+
// Call the API and handle any network failures.
56+
try {
57+
/** @var ReservationGroup $response */
58+
$response = $reservationServiceClient->createReservationGroup($request);
59+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
60+
} catch (ApiException $ex) {
61+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
62+
}
63+
}
64+
65+
/**
66+
* Helper to execute the sample.
67+
*
68+
* This sample has been automatically generated and should be regarded as a code
69+
* template only. It will require modifications to work:
70+
* - It may require correct/in-range values for request initialization.
71+
* - It may require specifying regional endpoints when creating the service client,
72+
* please see the apiEndpoint client configuration option for more details.
73+
*/
74+
function callSample(): void
75+
{
76+
$formattedParent = ReservationServiceClient::locationName('[PROJECT]', '[LOCATION]');
77+
$reservationGroupId = '[RESERVATION_GROUP_ID]';
78+
79+
create_reservation_group_sample($formattedParent, $reservationGroupId);
80+
}
81+
// [END bigqueryreservation_v1_generated_ReservationService_CreateReservationGroup_sync]
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?php
2+
/*
3+
* Copyright 2025 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 bigqueryreservation_v1_generated_ReservationService_DeleteReservationGroup_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Cloud\BigQuery\Reservation\V1\Client\ReservationServiceClient;
28+
use Google\Cloud\BigQuery\Reservation\V1\DeleteReservationGroupRequest;
29+
30+
/**
31+
* Deletes a reservation.
32+
* Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has
33+
* assignments.
34+
*
35+
* @param string $formattedName Resource name of the reservation group to retrieve. E.g.,
36+
* `projects/myproject/locations/US/reservationGroups/team1-prod`
37+
* Please see {@see ReservationServiceClient::reservationGroupName()} for help formatting this field.
38+
*/
39+
function delete_reservation_group_sample(string $formattedName): void
40+
{
41+
// Create a client.
42+
$reservationServiceClient = new ReservationServiceClient();
43+
44+
// Prepare the request message.
45+
$request = (new DeleteReservationGroupRequest())
46+
->setName($formattedName);
47+
48+
// Call the API and handle any network failures.
49+
try {
50+
$reservationServiceClient->deleteReservationGroup($request);
51+
printf('Call completed successfully.' . PHP_EOL);
52+
} catch (ApiException $ex) {
53+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
54+
}
55+
}
56+
57+
/**
58+
* Helper to execute the sample.
59+
*
60+
* This sample has been automatically generated and should be regarded as a code
61+
* template only. It will require modifications to work:
62+
* - It may require correct/in-range values for request initialization.
63+
* - It may require specifying regional endpoints when creating the service client,
64+
* please see the apiEndpoint client configuration option for more details.
65+
*/
66+
function callSample(): void
67+
{
68+
$formattedName = ReservationServiceClient::reservationGroupName(
69+
'[PROJECT]',
70+
'[LOCATION]',
71+
'[RESERVATION_GROUP]'
72+
);
73+
74+
delete_reservation_group_sample($formattedName);
75+
}
76+
// [END bigqueryreservation_v1_generated_ReservationService_DeleteReservationGroup_sync]
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?php
2+
/*
3+
* Copyright 2025 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 bigqueryreservation_v1_generated_ReservationService_GetIamPolicy_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Cloud\BigQuery\Reservation\V1\Client\ReservationServiceClient;
28+
use Google\Cloud\Iam\V1\GetIamPolicyRequest;
29+
use Google\Cloud\Iam\V1\Policy;
30+
31+
/**
32+
* Gets the access control policy for a resource.
33+
* May return:
34+
*
35+
* * A`NOT_FOUND` error if the resource doesn't exist or you don't have the
36+
* permission to view it.
37+
* * An empty policy if the resource exists but doesn't have a set policy.
38+
*
39+
* Supported resources are:
40+
* - Reservations
41+
* - ReservationAssignments
42+
*
43+
* To call this method, you must have the following Google IAM permissions:
44+
*
45+
* - `bigqueryreservation.reservations.getIamPolicy` to get policies on
46+
* reservations.
47+
*
48+
* @param string $resource REQUIRED: The resource for which the policy is being requested.
49+
* See the operation documentation for the appropriate value for this field.
50+
*/
51+
function get_iam_policy_sample(string $resource): void
52+
{
53+
// Create a client.
54+
$reservationServiceClient = new ReservationServiceClient();
55+
56+
// Prepare the request message.
57+
$request = (new GetIamPolicyRequest())
58+
->setResource($resource);
59+
60+
// Call the API and handle any network failures.
61+
try {
62+
/** @var Policy $response */
63+
$response = $reservationServiceClient->getIamPolicy($request);
64+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
65+
} catch (ApiException $ex) {
66+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
67+
}
68+
}
69+
70+
/**
71+
* Helper to execute the sample.
72+
*
73+
* This sample has been automatically generated and should be regarded as a code
74+
* template only. It will require modifications to work:
75+
* - It may require correct/in-range values for request initialization.
76+
* - It may require specifying regional endpoints when creating the service client,
77+
* please see the apiEndpoint client configuration option for more details.
78+
*/
79+
function callSample(): void
80+
{
81+
$resource = '[RESOURCE]';
82+
83+
get_iam_policy_sample($resource);
84+
}
85+
// [END bigqueryreservation_v1_generated_ReservationService_GetIamPolicy_sync]
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?php
2+
/*
3+
* Copyright 2025 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 bigqueryreservation_v1_generated_ReservationService_GetReservationGroup_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Cloud\BigQuery\Reservation\V1\Client\ReservationServiceClient;
28+
use Google\Cloud\BigQuery\Reservation\V1\GetReservationGroupRequest;
29+
use Google\Cloud\BigQuery\Reservation\V1\ReservationGroup;
30+
31+
/**
32+
* Returns information about the reservation group.
33+
*
34+
* @param string $formattedName Resource name of the reservation group to retrieve. E.g.,
35+
* `projects/myproject/locations/US/reservationGroups/team1-prod`
36+
* Please see {@see ReservationServiceClient::reservationGroupName()} for help formatting this field.
37+
*/
38+
function get_reservation_group_sample(string $formattedName): void
39+
{
40+
// Create a client.
41+
$reservationServiceClient = new ReservationServiceClient();
42+
43+
// Prepare the request message.
44+
$request = (new GetReservationGroupRequest())
45+
->setName($formattedName);
46+
47+
// Call the API and handle any network failures.
48+
try {
49+
/** @var ReservationGroup $response */
50+
$response = $reservationServiceClient->getReservationGroup($request);
51+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
52+
} catch (ApiException $ex) {
53+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
54+
}
55+
}
56+
57+
/**
58+
* Helper to execute the sample.
59+
*
60+
* This sample has been automatically generated and should be regarded as a code
61+
* template only. It will require modifications to work:
62+
* - It may require correct/in-range values for request initialization.
63+
* - It may require specifying regional endpoints when creating the service client,
64+
* please see the apiEndpoint client configuration option for more details.
65+
*/
66+
function callSample(): void
67+
{
68+
$formattedName = ReservationServiceClient::reservationGroupName(
69+
'[PROJECT]',
70+
'[LOCATION]',
71+
'[RESERVATION_GROUP]'
72+
);
73+
74+
get_reservation_group_sample($formattedName);
75+
}
76+
// [END bigqueryreservation_v1_generated_ReservationService_GetReservationGroup_sync]
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?php
2+
/*
3+
* Copyright 2025 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 bigqueryreservation_v1_generated_ReservationService_ListReservationGroups_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\PagedListResponse;
28+
use Google\Cloud\BigQuery\Reservation\V1\Client\ReservationServiceClient;
29+
use Google\Cloud\BigQuery\Reservation\V1\ListReservationGroupsRequest;
30+
use Google\Cloud\BigQuery\Reservation\V1\ReservationGroup;
31+
32+
/**
33+
* Lists all the reservation groups for the project in the specified location.
34+
*
35+
* @param string $formattedParent The parent resource name containing project and location, e.g.:
36+
* `projects/myproject/locations/US`
37+
* Please see {@see ReservationServiceClient::locationName()} for help formatting this field.
38+
*/
39+
function list_reservation_groups_sample(string $formattedParent): void
40+
{
41+
// Create a client.
42+
$reservationServiceClient = new ReservationServiceClient();
43+
44+
// Prepare the request message.
45+
$request = (new ListReservationGroupsRequest())
46+
->setParent($formattedParent);
47+
48+
// Call the API and handle any network failures.
49+
try {
50+
/** @var PagedListResponse $response */
51+
$response = $reservationServiceClient->listReservationGroups($request);
52+
53+
/** @var ReservationGroup $element */
54+
foreach ($response as $element) {
55+
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
56+
}
57+
} catch (ApiException $ex) {
58+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
59+
}
60+
}
61+
62+
/**
63+
* Helper to execute the sample.
64+
*
65+
* This sample has been automatically generated and should be regarded as a code
66+
* template only. It will require modifications to work:
67+
* - It may require correct/in-range values for request initialization.
68+
* - It may require specifying regional endpoints when creating the service client,
69+
* please see the apiEndpoint client configuration option for more details.
70+
*/
71+
function callSample(): void
72+
{
73+
$formattedParent = ReservationServiceClient::locationName('[PROJECT]', '[LOCATION]');
74+
75+
list_reservation_groups_sample($formattedParent);
76+
}
77+
// [END bigqueryreservation_v1_generated_ReservationService_ListReservationGroups_sync]

0 commit comments

Comments
 (0)