Skip to content

Commit cfeac0b

Browse files
feat: [NetworkManagement] Various documentation and comment improvements, Enable organization-level support for VPC Flow Logs (#8704)
* docs: Various documentation and comment improvements, Enable organization-level support for VPC Flow Logs feat: Enable organization-level support for VPC Flow Logs feat: add field `service_uri` to message `Endpoint.CloudRunRevisionEndpoint` feat: add message `Endpoint.SingleEdgeResponse` feat: add http additional_bindings feat: add enum `Status` to message `InstanceInfo` feat: add field `running` to message `InstanceInfo` feat: add field `policy_priority` to message `NetworkInfo` feat: add enum value `RouteInfo.NextHopType.SECURE_WEB_PROXY_GATEWAY` feat: add enum `DeliverInfo.GoogleServiceType` feat: add field `google_service_type` to message `DeliverInfo` feat: add enum value `AbortInfo.Cause.GOOGLE_MANAGED_SERVICE_AMBIGUOUS_ENDPOINT` feat: add enum values `NO_ROUTE_FROM_EXTERNAL_IPV6_SOURCE_TO_PRIVATE_IPV6_ADDRESS`, `TRAFFIC_FROM_HYBRID_ENDPOINT_TO_INTERNET_DISALLOWED`, `NO_MATCHING_NAT64_GATEWAY`, `LOAD_BALANCER_BACKEND_IP_VERSION_MISMATCH`, and `NO_KNOWN_ROUTE_FROM_NCC_NETWORK_TO_DESTINATION` to `DropInfo.Cause` feat: add rpc `VpcFlowLogsService.QueryOrgVpcFlowLogsConfigs` feat: add service `OrganizationVpcFlowLogsService` feat: add enum `VpcFlowLogsConfig.CrossProjectMetadata` feat: add enum `VpcFlowLogsConfig.TargetResourceState` feat: add fields `cross_project_metadata`, `target_resource_state`, `network`, and `subnet` to message `VpcFlowLogsConfig` PiperOrigin-RevId: 825895694 Source-Link: googleapis/googleapis@4d45a59 Source-Link: googleapis/googleapis-gen@2455a7e Copy-Tag: eyJwIjoiTmV0d29ya01hbmFnZW1lbnQvLk93bEJvdC55YW1sIiwiaCI6IjI0NTVhN2VhMmUyMjBiMTNiM2VkNmNiYjM1MDViOWM2NDZhMzIwN2IifQ== * 🦉 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 e5c6eed commit cfeac0b

71 files changed

Lines changed: 7312 additions & 176 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.
495 Bytes
Binary file not shown.
1.99 KB
Binary file not shown.

NetworkManagement/metadata/V1/VpcFlowLogs.php

Lines changed: 35 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
1.46 KB
Binary file not shown.
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
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 networkmanagement_v1_generated_OrganizationVpcFlowLogsService_CreateVpcFlowLogsConfig_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\OperationResponse;
28+
use Google\Cloud\NetworkManagement\V1\Client\OrganizationVpcFlowLogsServiceClient;
29+
use Google\Cloud\NetworkManagement\V1\CreateVpcFlowLogsConfigRequest;
30+
use Google\Cloud\NetworkManagement\V1\VpcFlowLogsConfig;
31+
use Google\Rpc\Status;
32+
33+
/**
34+
* Creates a new `VpcFlowLogsConfig`.
35+
* If a configuration with the exact same settings already exists (even if the
36+
* ID is different), the creation fails.
37+
* Notes:
38+
*
39+
* 1. Creating a configuration with `state=DISABLED` will fail
40+
* 2. The following fields are not considered as settings for the purpose
41+
* of the check mentioned above, therefore - creating another configuration
42+
* with the same fields but different values for the following fields will
43+
* fail as well:
44+
* * name
45+
* * create_time
46+
* * update_time
47+
* * labels
48+
* * description
49+
*
50+
* @param string $formattedParent The parent resource of the VpcFlowLogsConfig to create,
51+
* in one of the following formats:
52+
*
53+
* - For project-level resources: `projects/{project_id}/locations/global`
54+
*
55+
* - For organization-level resources:
56+
* `organizations/{organization_id}/locations/global`
57+
* Please see {@see OrganizationVpcFlowLogsServiceClient::organizationLocationName()} for help formatting this field.
58+
* @param string $formattedVpcFlowLogsConfigId ID of the `VpcFlowLogsConfig`. Please see
59+
* {@see OrganizationVpcFlowLogsServiceClient::vpcFlowLogsConfigName()} for help formatting this field.
60+
*/
61+
function create_vpc_flow_logs_config_sample(
62+
string $formattedParent,
63+
string $formattedVpcFlowLogsConfigId
64+
): void {
65+
// Create a client.
66+
$organizationVpcFlowLogsServiceClient = new OrganizationVpcFlowLogsServiceClient();
67+
68+
// Prepare the request message.
69+
$vpcFlowLogsConfig = new VpcFlowLogsConfig();
70+
$request = (new CreateVpcFlowLogsConfigRequest())
71+
->setParent($formattedParent)
72+
->setVpcFlowLogsConfigId($formattedVpcFlowLogsConfigId)
73+
->setVpcFlowLogsConfig($vpcFlowLogsConfig);
74+
75+
// Call the API and handle any network failures.
76+
try {
77+
/** @var OperationResponse $response */
78+
$response = $organizationVpcFlowLogsServiceClient->createVpcFlowLogsConfig($request);
79+
$response->pollUntilComplete();
80+
81+
if ($response->operationSucceeded()) {
82+
/** @var VpcFlowLogsConfig $result */
83+
$result = $response->getResult();
84+
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
85+
} else {
86+
/** @var Status $error */
87+
$error = $response->getError();
88+
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
89+
}
90+
} catch (ApiException $ex) {
91+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
92+
}
93+
}
94+
95+
/**
96+
* Helper to execute the sample.
97+
*
98+
* This sample has been automatically generated and should be regarded as a code
99+
* template only. It will require modifications to work:
100+
* - It may require correct/in-range values for request initialization.
101+
* - It may require specifying regional endpoints when creating the service client,
102+
* please see the apiEndpoint client configuration option for more details.
103+
*/
104+
function callSample(): void
105+
{
106+
$formattedParent = OrganizationVpcFlowLogsServiceClient::organizationLocationName(
107+
'[ORGANIZATION]',
108+
'[LOCATION]'
109+
);
110+
$formattedVpcFlowLogsConfigId = OrganizationVpcFlowLogsServiceClient::vpcFlowLogsConfigName(
111+
'[PROJECT]',
112+
'[LOCATION]',
113+
'[VPC_FLOW_LOGS_CONFIG]'
114+
);
115+
116+
create_vpc_flow_logs_config_sample($formattedParent, $formattedVpcFlowLogsConfigId);
117+
}
118+
// [END networkmanagement_v1_generated_OrganizationVpcFlowLogsService_CreateVpcFlowLogsConfig_sync]
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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 networkmanagement_v1_generated_OrganizationVpcFlowLogsService_DeleteVpcFlowLogsConfig_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\OperationResponse;
28+
use Google\Cloud\NetworkManagement\V1\Client\OrganizationVpcFlowLogsServiceClient;
29+
use Google\Cloud\NetworkManagement\V1\DeleteVpcFlowLogsConfigRequest;
30+
use Google\Rpc\Status;
31+
32+
/**
33+
* Deletes a specific `VpcFlowLogsConfig`.
34+
*
35+
* @param string $formattedName The resource name of the VpcFlowLogsConfig,
36+
* in one of the following formats:
37+
*
38+
* - For a project-level resource:
39+
* `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}`
40+
*
41+
* - For an organization-level resource:
42+
* `organizations/{organization_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}`
43+
* Please see {@see OrganizationVpcFlowLogsServiceClient::vpcFlowLogsConfigName()} for help formatting this field.
44+
*/
45+
function delete_vpc_flow_logs_config_sample(string $formattedName): void
46+
{
47+
// Create a client.
48+
$organizationVpcFlowLogsServiceClient = new OrganizationVpcFlowLogsServiceClient();
49+
50+
// Prepare the request message.
51+
$request = (new DeleteVpcFlowLogsConfigRequest())
52+
->setName($formattedName);
53+
54+
// Call the API and handle any network failures.
55+
try {
56+
/** @var OperationResponse $response */
57+
$response = $organizationVpcFlowLogsServiceClient->deleteVpcFlowLogsConfig($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+
$formattedName = OrganizationVpcFlowLogsServiceClient::vpcFlowLogsConfigName(
84+
'[PROJECT]',
85+
'[LOCATION]',
86+
'[VPC_FLOW_LOGS_CONFIG]'
87+
);
88+
89+
delete_vpc_flow_logs_config_sample($formattedName);
90+
}
91+
// [END networkmanagement_v1_generated_OrganizationVpcFlowLogsService_DeleteVpcFlowLogsConfig_sync]
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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 networkmanagement_v1_generated_OrganizationVpcFlowLogsService_GetIamPolicy_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Cloud\Iam\V1\GetIamPolicyRequest;
28+
use Google\Cloud\Iam\V1\Policy;
29+
use Google\Cloud\NetworkManagement\V1\Client\OrganizationVpcFlowLogsServiceClient;
30+
31+
/**
32+
* Gets the access control policy for a resource. Returns an empty policy
33+
if the resource exists and does not have a policy set.
34+
*
35+
* @param string $resource REQUIRED: The resource for which the policy is being requested.
36+
* See the operation documentation for the appropriate value for this field.
37+
*/
38+
function get_iam_policy_sample(string $resource): void
39+
{
40+
// Create a client.
41+
$organizationVpcFlowLogsServiceClient = new OrganizationVpcFlowLogsServiceClient();
42+
43+
// Prepare the request message.
44+
$request = (new GetIamPolicyRequest())
45+
->setResource($resource);
46+
47+
// Call the API and handle any network failures.
48+
try {
49+
/** @var Policy $response */
50+
$response = $organizationVpcFlowLogsServiceClient->getIamPolicy($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+
$resource = '[RESOURCE]';
69+
70+
get_iam_policy_sample($resource);
71+
}
72+
// [END networkmanagement_v1_generated_OrganizationVpcFlowLogsService_GetIamPolicy_sync]

0 commit comments

Comments
 (0)