Skip to content

Commit f824eda

Browse files
feat: [Compute] Update Compute Engine v1 API to revision 20250902 (#8591)
* feat: Update Compute Engine v1 API to revision 20250902 Source-Link: googleapis/googleapis@57ddfb3 Source-Link: googleapis/googleapis-gen@1b87952 Copy-Tag: eyJwIjoiQ29tcHV0ZS8uT3dsQm90LnlhbWwiLCJoIjoiMWI4Nzk1MjUyZmI2MmI0NWViOGU5NDZjZDYxN2QyMzQwMDMzYTUyYSJ9 * 🦉 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 f9167bf commit f824eda

104 files changed

Lines changed: 6398 additions & 17 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

6.04 KB
Binary file not shown.
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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 compute_v1_generated_Addresses_TestIamPermissions_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Cloud\Compute\V1\Client\AddressesClient;
28+
use Google\Cloud\Compute\V1\TestIamPermissionsAddressRequest;
29+
use Google\Cloud\Compute\V1\TestPermissionsRequest;
30+
use Google\Cloud\Compute\V1\TestPermissionsResponse;
31+
32+
/**
33+
* Returns permissions that a caller has on the specified resource.
34+
*
35+
* @param string $project Project ID for this request.
36+
* @param string $region The name of the region for this request.
37+
* @param string $resource Name or id of the resource for this request.
38+
*/
39+
function test_iam_permissions_sample(string $project, string $region, string $resource): void
40+
{
41+
// Create a client.
42+
$addressesClient = new AddressesClient();
43+
44+
// Prepare the request message.
45+
$testPermissionsRequestResource = new TestPermissionsRequest();
46+
$request = (new TestIamPermissionsAddressRequest())
47+
->setProject($project)
48+
->setRegion($region)
49+
->setResource($resource)
50+
->setTestPermissionsRequestResource($testPermissionsRequestResource);
51+
52+
// Call the API and handle any network failures.
53+
try {
54+
/** @var TestPermissionsResponse $response */
55+
$response = $addressesClient->testIamPermissions($request);
56+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
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+
$region = '[REGION]';
75+
$resource = '[RESOURCE]';
76+
77+
test_iam_permissions_sample($project, $region, $resource);
78+
}
79+
// [END compute_v1_generated_Addresses_TestIamPermissions_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 compute_v1_generated_GlobalAddresses_TestIamPermissions_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Cloud\Compute\V1\Client\GlobalAddressesClient;
28+
use Google\Cloud\Compute\V1\TestIamPermissionsGlobalAddressRequest;
29+
use Google\Cloud\Compute\V1\TestPermissionsRequest;
30+
use Google\Cloud\Compute\V1\TestPermissionsResponse;
31+
32+
/**
33+
* Returns permissions that a caller has on the specified resource.
34+
*
35+
* @param string $project Project ID for this request.
36+
* @param string $resource Name or id of the resource for this request.
37+
*/
38+
function test_iam_permissions_sample(string $project, string $resource): void
39+
{
40+
// Create a client.
41+
$globalAddressesClient = new GlobalAddressesClient();
42+
43+
// Prepare the request message.
44+
$testPermissionsRequestResource = new TestPermissionsRequest();
45+
$request = (new TestIamPermissionsGlobalAddressRequest())
46+
->setProject($project)
47+
->setResource($resource)
48+
->setTestPermissionsRequestResource($testPermissionsRequestResource);
49+
50+
// Call the API and handle any network failures.
51+
try {
52+
/** @var TestPermissionsResponse $response */
53+
$response = $globalAddressesClient->testIamPermissions($request);
54+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
55+
} catch (ApiException $ex) {
56+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
57+
}
58+
}
59+
60+
/**
61+
* Helper to execute the sample.
62+
*
63+
* This sample has been automatically generated and should be regarded as a code
64+
* template only. It will require modifications to work:
65+
* - It may require correct/in-range values for request initialization.
66+
* - It may require specifying regional endpoints when creating the service client,
67+
* please see the apiEndpoint client configuration option for more details.
68+
*/
69+
function callSample(): void
70+
{
71+
$project = '[PROJECT]';
72+
$resource = '[RESOURCE]';
73+
74+
test_iam_permissions_sample($project, $resource);
75+
}
76+
// [END compute_v1_generated_GlobalAddresses_TestIamPermissions_sync]
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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 compute_v1_generated_InstanceGroups_TestIamPermissions_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Cloud\Compute\V1\Client\InstanceGroupsClient;
28+
use Google\Cloud\Compute\V1\TestIamPermissionsInstanceGroupRequest;
29+
use Google\Cloud\Compute\V1\TestPermissionsRequest;
30+
use Google\Cloud\Compute\V1\TestPermissionsResponse;
31+
32+
/**
33+
* Returns permissions that a caller has on the specified resource.
34+
*
35+
* @param string $project Project ID for this request.
36+
* @param string $resource Name or id of the resource for this request.
37+
* @param string $zone The name of the zone for this request.
38+
*/
39+
function test_iam_permissions_sample(string $project, string $resource, string $zone): void
40+
{
41+
// Create a client.
42+
$instanceGroupsClient = new InstanceGroupsClient();
43+
44+
// Prepare the request message.
45+
$testPermissionsRequestResource = new TestPermissionsRequest();
46+
$request = (new TestIamPermissionsInstanceGroupRequest())
47+
->setProject($project)
48+
->setResource($resource)
49+
->setTestPermissionsRequestResource($testPermissionsRequestResource)
50+
->setZone($zone);
51+
52+
// Call the API and handle any network failures.
53+
try {
54+
/** @var TestPermissionsResponse $response */
55+
$response = $instanceGroupsClient->testIamPermissions($request);
56+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
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+
$resource = '[RESOURCE]';
75+
$zone = '[ZONE]';
76+
77+
test_iam_permissions_sample($project, $resource, $zone);
78+
}
79+
// [END compute_v1_generated_InstanceGroups_TestIamPermissions_sync]
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
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 compute_v1_generated_Instances_AddNetworkInterface_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\OperationResponse;
28+
use Google\Cloud\Compute\V1\AddNetworkInterfaceInstanceRequest;
29+
use Google\Cloud\Compute\V1\Client\InstancesClient;
30+
use Google\Cloud\Compute\V1\NetworkInterface;
31+
use Google\Rpc\Status;
32+
33+
/**
34+
* Adds one dynamic network interface to an active instance.
35+
*
36+
* @param string $instance The instance name for this request stored as resource_id. Name should conform to RFC1035 or be an unsigned long integer.
37+
* @param string $project Project ID for this request.
38+
* @param string $zone The name of the zone for this request.
39+
*/
40+
function add_network_interface_sample(string $instance, string $project, string $zone): void
41+
{
42+
// Create a client.
43+
$instancesClient = new InstancesClient();
44+
45+
// Prepare the request message.
46+
$networkInterfaceResource = new NetworkInterface();
47+
$request = (new AddNetworkInterfaceInstanceRequest())
48+
->setInstance($instance)
49+
->setNetworkInterfaceResource($networkInterfaceResource)
50+
->setProject($project)
51+
->setZone($zone);
52+
53+
// Call the API and handle any network failures.
54+
try {
55+
/** @var OperationResponse $response */
56+
$response = $instancesClient->addNetworkInterface($request);
57+
$response->pollUntilComplete();
58+
59+
if ($response->operationSucceeded()) {
60+
printf('Operation completed successfully.' . PHP_EOL);
61+
} else {
62+
/** @var Status $error */
63+
$error = $response->getError();
64+
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
65+
}
66+
} catch (ApiException $ex) {
67+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
68+
}
69+
}
70+
71+
/**
72+
* Helper to execute the sample.
73+
*
74+
* This sample has been automatically generated and should be regarded as a code
75+
* template only. It will require modifications to work:
76+
* - It may require correct/in-range values for request initialization.
77+
* - It may require specifying regional endpoints when creating the service client,
78+
* please see the apiEndpoint client configuration option for more details.
79+
*/
80+
function callSample(): void
81+
{
82+
$instance = '[INSTANCE]';
83+
$project = '[PROJECT]';
84+
$zone = '[ZONE]';
85+
86+
add_network_interface_sample($instance, $project, $zone);
87+
}
88+
// [END compute_v1_generated_Instances_AddNetworkInterface_sync]

0 commit comments

Comments
 (0)