Skip to content

Commit b9348f5

Browse files
feat: [Compute] Update Compute Engine API to revision 20250126 (#8095)
Source-Link: googleapis/googleapis@58be301 Source-Link: googleapis/googleapis-gen@05e5095 Copy-Tag: eyJwIjoiQ29tcHV0ZS8uT3dsQm90LnlhbWwiLCJoIjoiMDVlNTA5NWQwYTA2ZTZkMjY0OGU3OTM1NThhOWZmZTNiNTc5MDJjNiJ9
1 parent 70ea0bd commit b9348f5

39 files changed

Lines changed: 3061 additions & 115 deletions

Compute/metadata/V1/Compute.php

2.61 KB
Binary file not shown.
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 compute_v1_generated_NetworkFirewallPolicies_AddPacketMirroringRule_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\OperationResponse;
28+
use Google\Cloud\Compute\V1\AddPacketMirroringRuleNetworkFirewallPolicyRequest;
29+
use Google\Cloud\Compute\V1\Client\NetworkFirewallPoliciesClient;
30+
use Google\Cloud\Compute\V1\FirewallPolicyRule;
31+
use Google\Rpc\Status;
32+
33+
/**
34+
* Inserts a packet mirroring rule into a firewall policy.
35+
*
36+
* @param string $firewallPolicy Name of the firewall policy to update.
37+
* @param string $project Project ID for this request.
38+
*/
39+
function add_packet_mirroring_rule_sample(string $firewallPolicy, string $project): void
40+
{
41+
// Create a client.
42+
$networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient();
43+
44+
// Prepare the request message.
45+
$firewallPolicyRuleResource = new FirewallPolicyRule();
46+
$request = (new AddPacketMirroringRuleNetworkFirewallPolicyRequest())
47+
->setFirewallPolicy($firewallPolicy)
48+
->setFirewallPolicyRuleResource($firewallPolicyRuleResource)
49+
->setProject($project);
50+
51+
// Call the API and handle any network failures.
52+
try {
53+
/** @var OperationResponse $response */
54+
$response = $networkFirewallPoliciesClient->addPacketMirroringRule($request);
55+
$response->pollUntilComplete();
56+
57+
if ($response->operationSucceeded()) {
58+
printf('Operation completed successfully.' . PHP_EOL);
59+
} else {
60+
/** @var Status $error */
61+
$error = $response->getError();
62+
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
63+
}
64+
} catch (ApiException $ex) {
65+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
66+
}
67+
}
68+
69+
/**
70+
* Helper to execute the sample.
71+
*
72+
* This sample has been automatically generated and should be regarded as a code
73+
* template only. It will require modifications to work:
74+
* - It may require correct/in-range values for request initialization.
75+
* - It may require specifying regional endpoints when creating the service client,
76+
* please see the apiEndpoint client configuration option for more details.
77+
*/
78+
function callSample(): void
79+
{
80+
$firewallPolicy = '[FIREWALL_POLICY]';
81+
$project = '[PROJECT]';
82+
83+
add_packet_mirroring_rule_sample($firewallPolicy, $project);
84+
}
85+
// [END compute_v1_generated_NetworkFirewallPolicies_AddPacketMirroringRule_sync]
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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_NetworkFirewallPolicies_GetPacketMirroringRule_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Cloud\Compute\V1\Client\NetworkFirewallPoliciesClient;
28+
use Google\Cloud\Compute\V1\FirewallPolicyRule;
29+
use Google\Cloud\Compute\V1\GetPacketMirroringRuleNetworkFirewallPolicyRequest;
30+
31+
/**
32+
* Gets a packet mirroring rule of the specified priority.
33+
*
34+
* @param string $firewallPolicy Name of the firewall policy to which the queried rule belongs.
35+
* @param string $project Project ID for this request.
36+
*/
37+
function get_packet_mirroring_rule_sample(string $firewallPolicy, string $project): void
38+
{
39+
// Create a client.
40+
$networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient();
41+
42+
// Prepare the request message.
43+
$request = (new GetPacketMirroringRuleNetworkFirewallPolicyRequest())
44+
->setFirewallPolicy($firewallPolicy)
45+
->setProject($project);
46+
47+
// Call the API and handle any network failures.
48+
try {
49+
/** @var FirewallPolicyRule $response */
50+
$response = $networkFirewallPoliciesClient->getPacketMirroringRule($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+
$firewallPolicy = '[FIREWALL_POLICY]';
69+
$project = '[PROJECT]';
70+
71+
get_packet_mirroring_rule_sample($firewallPolicy, $project);
72+
}
73+
// [END compute_v1_generated_NetworkFirewallPolicies_GetPacketMirroringRule_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 compute_v1_generated_NetworkFirewallPolicies_PatchPacketMirroringRule_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\OperationResponse;
28+
use Google\Cloud\Compute\V1\Client\NetworkFirewallPoliciesClient;
29+
use Google\Cloud\Compute\V1\FirewallPolicyRule;
30+
use Google\Cloud\Compute\V1\PatchPacketMirroringRuleNetworkFirewallPolicyRequest;
31+
use Google\Rpc\Status;
32+
33+
/**
34+
* Patches a packet mirroring rule of the specified priority.
35+
*
36+
* @param string $firewallPolicy Name of the firewall policy to update.
37+
* @param string $project Project ID for this request.
38+
*/
39+
function patch_packet_mirroring_rule_sample(string $firewallPolicy, string $project): void
40+
{
41+
// Create a client.
42+
$networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient();
43+
44+
// Prepare the request message.
45+
$firewallPolicyRuleResource = new FirewallPolicyRule();
46+
$request = (new PatchPacketMirroringRuleNetworkFirewallPolicyRequest())
47+
->setFirewallPolicy($firewallPolicy)
48+
->setFirewallPolicyRuleResource($firewallPolicyRuleResource)
49+
->setProject($project);
50+
51+
// Call the API and handle any network failures.
52+
try {
53+
/** @var OperationResponse $response */
54+
$response = $networkFirewallPoliciesClient->patchPacketMirroringRule($request);
55+
$response->pollUntilComplete();
56+
57+
if ($response->operationSucceeded()) {
58+
printf('Operation completed successfully.' . PHP_EOL);
59+
} else {
60+
/** @var Status $error */
61+
$error = $response->getError();
62+
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
63+
}
64+
} catch (ApiException $ex) {
65+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
66+
}
67+
}
68+
69+
/**
70+
* Helper to execute the sample.
71+
*
72+
* This sample has been automatically generated and should be regarded as a code
73+
* template only. It will require modifications to work:
74+
* - It may require correct/in-range values for request initialization.
75+
* - It may require specifying regional endpoints when creating the service client,
76+
* please see the apiEndpoint client configuration option for more details.
77+
*/
78+
function callSample(): void
79+
{
80+
$firewallPolicy = '[FIREWALL_POLICY]';
81+
$project = '[PROJECT]';
82+
83+
patch_packet_mirroring_rule_sample($firewallPolicy, $project);
84+
}
85+
// [END compute_v1_generated_NetworkFirewallPolicies_PatchPacketMirroringRule_sync]
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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_NetworkFirewallPolicies_RemovePacketMirroringRule_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\OperationResponse;
28+
use Google\Cloud\Compute\V1\Client\NetworkFirewallPoliciesClient;
29+
use Google\Cloud\Compute\V1\RemovePacketMirroringRuleNetworkFirewallPolicyRequest;
30+
use Google\Rpc\Status;
31+
32+
/**
33+
* Deletes a packet mirroring rule of the specified priority.
34+
*
35+
* @param string $firewallPolicy Name of the firewall policy to update.
36+
* @param string $project Project ID for this request.
37+
*/
38+
function remove_packet_mirroring_rule_sample(string $firewallPolicy, string $project): void
39+
{
40+
// Create a client.
41+
$networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient();
42+
43+
// Prepare the request message.
44+
$request = (new RemovePacketMirroringRuleNetworkFirewallPolicyRequest())
45+
->setFirewallPolicy($firewallPolicy)
46+
->setProject($project);
47+
48+
// Call the API and handle any network failures.
49+
try {
50+
/** @var OperationResponse $response */
51+
$response = $networkFirewallPoliciesClient->removePacketMirroringRule($request);
52+
$response->pollUntilComplete();
53+
54+
if ($response->operationSucceeded()) {
55+
printf('Operation completed successfully.' . PHP_EOL);
56+
} else {
57+
/** @var Status $error */
58+
$error = $response->getError();
59+
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
60+
}
61+
} catch (ApiException $ex) {
62+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
63+
}
64+
}
65+
66+
/**
67+
* Helper to execute the sample.
68+
*
69+
* This sample has been automatically generated and should be regarded as a code
70+
* template only. It will require modifications to work:
71+
* - It may require correct/in-range values for request initialization.
72+
* - It may require specifying regional endpoints when creating the service client,
73+
* please see the apiEndpoint client configuration option for more details.
74+
*/
75+
function callSample(): void
76+
{
77+
$firewallPolicy = '[FIREWALL_POLICY]';
78+
$project = '[PROJECT]';
79+
80+
remove_packet_mirroring_rule_sample($firewallPolicy, $project);
81+
}
82+
// [END compute_v1_generated_NetworkFirewallPolicies_RemovePacketMirroringRule_sync]

Compute/samples/V1/RegionCommitmentsClient/update.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
use Google\Rpc\Status;
3232

3333
/**
34-
* Updates the specified commitment with the data included in the request. Update is performed only on selected fields included as part of update-mask. Only the following fields can be modified: auto_renew.
34+
* Updates the specified commitment with the data included in the request. Update is performed only on selected fields included as part of update-mask. Only the following fields can be updated: auto_renew and plan.
3535
*
36-
* @param string $commitment Name of the commitment for which auto renew is being updated.
36+
* @param string $commitment Name of the commitment that you want to update.
3737
* @param string $project Project ID for this request.
3838
* @param string $region Name of the region for this request.
3939
*/

0 commit comments

Comments
 (0)