Skip to content

Commit 13adc9b

Browse files
feat: [NetworkSecurity] add networksecurity v1 client library (#9206)
* feat: add networksecurity v1 client library PiperOrigin-RevId: 919268561 Source-Link: googleapis/googleapis@29c6482 Source-Link: googleapis/googleapis-gen@d6f191b Copy-Tag: eyJwIjoiTmV0d29ya1NlY3VyaXR5Ly5Pd2xCb3QueWFtbCIsImgiOiJkNmYxOTFiNTIxYjEyYTMyMzQzM2IwZjkxZmYyOWJjNDc2ZDI3NjM0In0= * 🦉 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 3cb6a22 commit 13adc9b

105 files changed

Lines changed: 12822 additions & 261 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.

NetworkSecurity/metadata/V1/AuthzPolicy.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.

NetworkSecurity/metadata/V1/FirewallActivation.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.

NetworkSecurity/metadata/V1/SecurityProfileGroupService.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.

NetworkSecurity/metadata/V1/SseRealm.php

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

NetworkSecurity/samples/V1/AddressGroupServiceClient/list_locations.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@
3333
* Lists information about the supported locations for this service.
3434
3535
This method lists locations based on the resource scope provided in
36-
the [ListLocationsRequest.name] field:
37-
38-
* **Global locations**: If `name` is empty, the method lists the
36+
the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
37+
**Global locations**: If `name` is empty, the method lists the
3938
public locations available to all projects. * **Project-specific
4039
locations**: If `name` follows the format
4140
`projects/{project}`, the method lists locations visible to that

NetworkSecurity/samples/V1/DnsThreatDetectorServiceClient/list_locations.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@
3333
* Lists information about the supported locations for this service.
3434
3535
This method lists locations based on the resource scope provided in
36-
the [ListLocationsRequest.name] field:
37-
38-
* **Global locations**: If `name` is empty, the method lists the
36+
the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
37+
**Global locations**: If `name` is empty, the method lists the
3938
public locations available to all projects. * **Project-specific
4039
locations**: If `name` follows the format
4140
`projects/{project}`, the method lists locations visible to that
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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 networksecurity_v1_generated_FirewallActivation_CreateProjectFirewallEndpoint_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\OperationResponse;
28+
use Google\Cloud\NetworkSecurity\V1\Client\FirewallActivationClient;
29+
use Google\Cloud\NetworkSecurity\V1\CreateFirewallEndpointRequest;
30+
use Google\Cloud\NetworkSecurity\V1\FirewallEndpoint;
31+
use Google\Rpc\Status;
32+
33+
/**
34+
* Creates a new FirewallEndpoint in a given project and location.
35+
*
36+
* @param string $formattedParent Value for parent. Please see
37+
* {@see FirewallActivationClient::organizationLocationName()} for help formatting this field.
38+
* @param string $firewallEndpointId Id of the requesting object.
39+
* If auto-generating Id server-side, remove this field and
40+
* firewall_endpoint_id from the method_signature of Create RPC.
41+
*/
42+
function create_project_firewall_endpoint_sample(
43+
string $formattedParent,
44+
string $firewallEndpointId
45+
): void {
46+
// Create a client.
47+
$firewallActivationClient = new FirewallActivationClient();
48+
49+
// Prepare the request message.
50+
$firewallEndpoint = new FirewallEndpoint();
51+
$request = (new CreateFirewallEndpointRequest())
52+
->setParent($formattedParent)
53+
->setFirewallEndpointId($firewallEndpointId)
54+
->setFirewallEndpoint($firewallEndpoint);
55+
56+
// Call the API and handle any network failures.
57+
try {
58+
/** @var OperationResponse $response */
59+
$response = $firewallActivationClient->createProjectFirewallEndpoint($request);
60+
$response->pollUntilComplete();
61+
62+
if ($response->operationSucceeded()) {
63+
/** @var FirewallEndpoint $result */
64+
$result = $response->getResult();
65+
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
66+
} else {
67+
/** @var Status $error */
68+
$error = $response->getError();
69+
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
70+
}
71+
} catch (ApiException $ex) {
72+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
73+
}
74+
}
75+
76+
/**
77+
* Helper to execute the sample.
78+
*
79+
* This sample has been automatically generated and should be regarded as a code
80+
* template only. It will require modifications to work:
81+
* - It may require correct/in-range values for request initialization.
82+
* - It may require specifying regional endpoints when creating the service client,
83+
* please see the apiEndpoint client configuration option for more details.
84+
*/
85+
function callSample(): void
86+
{
87+
$formattedParent = FirewallActivationClient::organizationLocationName(
88+
'[ORGANIZATION]',
89+
'[LOCATION]'
90+
);
91+
$firewallEndpointId = '[FIREWALL_ENDPOINT_ID]';
92+
93+
create_project_firewall_endpoint_sample($formattedParent, $firewallEndpointId);
94+
}
95+
// [END networksecurity_v1_generated_FirewallActivation_CreateProjectFirewallEndpoint_sync]
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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 networksecurity_v1_generated_FirewallActivation_DeleteProjectFirewallEndpoint_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\OperationResponse;
28+
use Google\Cloud\NetworkSecurity\V1\Client\FirewallActivationClient;
29+
use Google\Cloud\NetworkSecurity\V1\DeleteFirewallEndpointRequest;
30+
use Google\Rpc\Status;
31+
32+
/**
33+
* Deletes a single project Endpoint.
34+
*
35+
* @param string $formattedName Name of the resource
36+
* Please see {@see FirewallActivationClient::firewallEndpointName()} for help formatting this field.
37+
*/
38+
function delete_project_firewall_endpoint_sample(string $formattedName): void
39+
{
40+
// Create a client.
41+
$firewallActivationClient = new FirewallActivationClient();
42+
43+
// Prepare the request message.
44+
$request = (new DeleteFirewallEndpointRequest())
45+
->setName($formattedName);
46+
47+
// Call the API and handle any network failures.
48+
try {
49+
/** @var OperationResponse $response */
50+
$response = $firewallActivationClient->deleteProjectFirewallEndpoint($request);
51+
$response->pollUntilComplete();
52+
53+
if ($response->operationSucceeded()) {
54+
printf('Operation completed successfully.' . PHP_EOL);
55+
} else {
56+
/** @var Status $error */
57+
$error = $response->getError();
58+
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
59+
}
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+
$formattedName = FirewallActivationClient::firewallEndpointName(
77+
'[ORGANIZATION]',
78+
'[LOCATION]',
79+
'[FIREWALL_ENDPOINT]'
80+
);
81+
82+
delete_project_firewall_endpoint_sample($formattedName);
83+
}
84+
// [END networksecurity_v1_generated_FirewallActivation_DeleteProjectFirewallEndpoint_sync]

0 commit comments

Comments
 (0)