Skip to content

Commit 8f24d4e

Browse files
feat: [Compute] Update Compute Engine v1 API to revision 20260331 (#9132)
* feat: Update Compute Engine v1 API to revision 20260331 Source-Link: googleapis/googleapis@8d5e50e Source-Link: googleapis/googleapis-gen@1ee38c3 Copy-Tag: eyJwIjoiQ29tcHV0ZS8uT3dsQm90LnlhbWwiLCJoIjoiMWVlMzhjMzM2NDMzYmU3NmU2YjgyZWFiNzg5Y2RkMDAxOTM1MDhiNSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 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 172abd7 commit 8f24d4e

245 files changed

Lines changed: 41391 additions & 301 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.

Compute/metadata/V1/Compute.php

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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 compute_v1_generated_BackendBuckets_AggregatedList_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\PagedListResponse;
28+
use Google\Cloud\Compute\V1\AggregatedListBackendBucketsRequest;
29+
use Google\Cloud\Compute\V1\Client\BackendBucketsClient;
30+
31+
/**
32+
* Retrieves the list of all BackendBucket resources, regional and global,
33+
* available to the specified project.
34+
*
35+
* To prevent failure, it is recommended that you set the
36+
* `returnPartialSuccess` parameter to `true`.
37+
*
38+
* @param string $project Name of the project scoping this request.
39+
*/
40+
function aggregated_list_sample(string $project): void
41+
{
42+
// Create a client.
43+
$backendBucketsClient = new BackendBucketsClient();
44+
45+
// Prepare the request message.
46+
$request = (new AggregatedListBackendBucketsRequest())
47+
->setProject($project);
48+
49+
// Call the API and handle any network failures.
50+
try {
51+
/** @var PagedListResponse $response */
52+
$response = $backendBucketsClient->aggregatedList($request);
53+
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+
$project = '[PROJECT]';
74+
75+
aggregated_list_sample($project);
76+
}
77+
// [END compute_v1_generated_BackendBuckets_AggregatedList_sync]
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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 compute_v1_generated_BackendBuckets_ListUsable_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\PagedListResponse;
28+
use Google\Cloud\Compute\V1\Client\BackendBucketsClient;
29+
use Google\Cloud\Compute\V1\ListUsableBackendBucketsRequest;
30+
31+
/**
32+
* Retrieves a list of all usable backend buckets in the specified project.
33+
*
34+
* @param string $project Project ID for this request.
35+
*/
36+
function list_usable_sample(string $project): void
37+
{
38+
// Create a client.
39+
$backendBucketsClient = new BackendBucketsClient();
40+
41+
// Prepare the request message.
42+
$request = (new ListUsableBackendBucketsRequest())
43+
->setProject($project);
44+
45+
// Call the API and handle any network failures.
46+
try {
47+
/** @var PagedListResponse $response */
48+
$response = $backendBucketsClient->listUsable($request);
49+
50+
foreach ($response as $element) {
51+
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
52+
}
53+
} catch (ApiException $ex) {
54+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
55+
}
56+
}
57+
58+
/**
59+
* Helper to execute the sample.
60+
*
61+
* This sample has been automatically generated and should be regarded as a code
62+
* template only. It will require modifications to work:
63+
* - It may require correct/in-range values for request initialization.
64+
* - It may require specifying regional endpoints when creating the service client,
65+
* please see the apiEndpoint client configuration option for more details.
66+
*/
67+
function callSample(): void
68+
{
69+
$project = '[PROJECT]';
70+
71+
list_usable_sample($project);
72+
}
73+
// [END compute_v1_generated_BackendBuckets_ListUsable_sync]
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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 compute_v1_generated_Disks_UpdateKmsKey_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\OperationResponse;
28+
use Google\Cloud\Compute\V1\Client\DisksClient;
29+
use Google\Cloud\Compute\V1\DiskUpdateKmsKeyRequest;
30+
use Google\Cloud\Compute\V1\UpdateKmsKeyDiskRequest;
31+
use Google\Rpc\Status;
32+
33+
/**
34+
* Rotates the customer-managed
35+
* encryption key to the latest version for the specified persistent disk.
36+
*
37+
* @param string $disk Name of the Disk resource, should conform to RFC1035.
38+
* @param string $project Project ID for this request.
39+
* @param string $zone The name of the zone for this request.
40+
*/
41+
function update_kms_key_sample(string $disk, string $project, string $zone): void
42+
{
43+
// Create a client.
44+
$disksClient = new DisksClient();
45+
46+
// Prepare the request message.
47+
$diskUpdateKmsKeyRequestResource = new DiskUpdateKmsKeyRequest();
48+
$request = (new UpdateKmsKeyDiskRequest())
49+
->setDisk($disk)
50+
->setDiskUpdateKmsKeyRequestResource($diskUpdateKmsKeyRequestResource)
51+
->setProject($project)
52+
->setZone($zone);
53+
54+
// Call the API and handle any network failures.
55+
try {
56+
/** @var OperationResponse $response */
57+
$response = $disksClient->updateKmsKey($request);
58+
$response->pollUntilComplete();
59+
60+
if ($response->operationSucceeded()) {
61+
printf('Operation completed successfully.' . PHP_EOL);
62+
} else {
63+
/** @var Status $error */
64+
$error = $response->getError();
65+
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
66+
}
67+
} catch (ApiException $ex) {
68+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
69+
}
70+
}
71+
72+
/**
73+
* Helper to execute the sample.
74+
*
75+
* This sample has been automatically generated and should be regarded as a code
76+
* template only. It will require modifications to work:
77+
* - It may require correct/in-range values for request initialization.
78+
* - It may require specifying regional endpoints when creating the service client,
79+
* please see the apiEndpoint client configuration option for more details.
80+
*/
81+
function callSample(): void
82+
{
83+
$disk = '[DISK]';
84+
$project = '[PROJECT]';
85+
$zone = '[ZONE]';
86+
87+
update_kms_key_sample($disk, $project, $zone);
88+
}
89+
// [END compute_v1_generated_Disks_UpdateKmsKey_sync]
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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 compute_v1_generated_InstantSnapshotGroups_Delete_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\OperationResponse;
28+
use Google\Cloud\Compute\V1\Client\InstantSnapshotGroupsClient;
29+
use Google\Cloud\Compute\V1\DeleteInstantSnapshotGroupRequest;
30+
use Google\Rpc\Status;
31+
32+
/**
33+
* deletes a Zonal InstantSnapshotGroup resource
34+
*
35+
* @param string $instantSnapshotGroup Name of the InstantSnapshot resource to delete.
36+
* @param string $project Project ID for this request.
37+
* @param string $zone The name of the zone for this request.
38+
*/
39+
function delete_sample(string $instantSnapshotGroup, string $project, string $zone): void
40+
{
41+
// Create a client.
42+
$instantSnapshotGroupsClient = new InstantSnapshotGroupsClient();
43+
44+
// Prepare the request message.
45+
$request = (new DeleteInstantSnapshotGroupRequest())
46+
->setInstantSnapshotGroup($instantSnapshotGroup)
47+
->setProject($project)
48+
->setZone($zone);
49+
50+
// Call the API and handle any network failures.
51+
try {
52+
/** @var OperationResponse $response */
53+
$response = $instantSnapshotGroupsClient->delete($request);
54+
$response->pollUntilComplete();
55+
56+
if ($response->operationSucceeded()) {
57+
printf('Operation completed successfully.' . PHP_EOL);
58+
} else {
59+
/** @var Status $error */
60+
$error = $response->getError();
61+
printf('Operation failed with error data: %s' . PHP_EOL, $error->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+
$instantSnapshotGroup = '[INSTANT_SNAPSHOT_GROUP]';
80+
$project = '[PROJECT]';
81+
$zone = '[ZONE]';
82+
83+
delete_sample($instantSnapshotGroup, $project, $zone);
84+
}
85+
// [END compute_v1_generated_InstantSnapshotGroups_Delete_sync]

0 commit comments

Comments
 (0)