Skip to content

Commit 72497b7

Browse files
feat: [NetworkServices] Add support for WasmPlugin resource in NetworkServices API (#8401)
* feat: Add support for WasmPlugin resource in NetworkServices API docs: A comment for enum `LoadBalancingScheme` is changed docs: A comment for field `authority` in message `.google.cloud.networkservices.v1.ExtensionChain` is changed docs: A comment for field `service` in message `.google.cloud.networkservices.v1.ExtensionChain` is changed docs: A comment for field `supported_events` in message `.google.cloud.networkservices.v1.ExtensionChain` is changed docs: A comment for field `timeout` in message `.google.cloud.networkservices.v1.ExtensionChain` is changed docs: A comment for field `extensions` in message `.google.cloud.networkservices.v1.ExtensionChain` is changed docs: A comment for field `forwarding_rules` in message `.google.cloud.networkservices.v1.LbTrafficExtension` is changed docs: A comment for field `load_balancing_scheme` in message `.google.cloud.networkservices.v1.LbTrafficExtension` is changed docs: A comment for field `metadata` in message `.google.cloud.networkservices.v1.LbTrafficExtension` is changed docs: A comment for field `parent` in message `.google.cloud.networkservices.v1.ListLbTrafficExtensionsRequest` is changed docs: A comment for field `order_by` in message `.google.cloud.networkservices.v1.ListLbTrafficExtensionsRequest` is changed docs: A comment for field `request_id` in message `.google.cloud.networkservices.v1.CreateLbTrafficExtensionRequest` is changed docs: A comment for field `update_mask` in message `.google.cloud.networkservices.v1.UpdateLbTrafficExtensionRequest` is changed docs: A comment for field `request_id` in message `.google.cloud.networkservices.v1.UpdateLbTrafficExtensionRequest` is changed docs: A comment for field `request_id` in message `.google.cloud.networkservices.v1.DeleteLbTrafficExtensionRequest` is changed docs: A comment for field `forwarding_rules` in message `.google.cloud.networkservices.v1.LbRouteExtension` is changed docs: A comment for field `load_balancing_scheme` in message `.google.cloud.networkservices.v1.LbRouteExtension` is changed docs: A comment for field `metadata` in message `.google.cloud.networkservices.v1.LbRouteExtension` is changed docs: A comment for field `parent` in message `.google.cloud.networkservices.v1.ListLbRouteExtensionsRequest` is changed docs: A comment for field `order_by` in message `.google.cloud.networkservices.v1.ListLbRouteExtensionsRequest` is changed docs: A comment for field `request_id` in message `.google.cloud.networkservices.v1.CreateLbRouteExtensionRequest` is changed docs: A comment for field `update_mask` in message `.google.cloud.networkservices.v1.UpdateLbRouteExtensionRequest` is changed docs: A comment for field `request_id` in message `.google.cloud.networkservices.v1.UpdateLbRouteExtensionRequest` is changed docs: A comment for field `request_id` in message `.google.cloud.networkservices.v1.DeleteLbRouteExtensionRequest` is changed PiperOrigin-RevId: 775137339 Source-Link: googleapis/googleapis@fc1e32c Source-Link: googleapis/googleapis-gen@6b6d7aa Copy-Tag: eyJwIjoiTmV0d29ya1NlcnZpY2VzLy5Pd2xCb3QueWFtbCIsImgiOiI2YjZkN2FhY2I2ZTY4MWE2MjYyMTY3ZTVhZTdiYzNkYmQ2Y2NmOTc3In0= * 🦉 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 7e24854 commit 72497b7

73 files changed

Lines changed: 9750 additions & 370 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.
3.09 KB
Binary file not shown.
5.01 KB
Binary file not shown.

NetworkServices/metadata/V1/NetworkServices.php

Lines changed: 21 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
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 networkservices_v1_generated_DepService_CreateAuthzExtension_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\OperationResponse;
28+
use Google\Cloud\NetworkServices\V1\AuthzExtension;
29+
use Google\Cloud\NetworkServices\V1\Client\DepServiceClient;
30+
use Google\Cloud\NetworkServices\V1\CreateAuthzExtensionRequest;
31+
use Google\Cloud\NetworkServices\V1\LoadBalancingScheme;
32+
use Google\Protobuf\Duration;
33+
use Google\Rpc\Status;
34+
35+
/**
36+
* Creates a new `AuthzExtension` resource in a given project
37+
* and location.
38+
*
39+
* @param string $formattedParent The parent resource of the `AuthzExtension` resource. Must
40+
* be in the format `projects/{project}/locations/{location}`. Please see
41+
* {@see DepServiceClient::locationName()} for help formatting this field.
42+
* @param string $authzExtensionId User-provided ID of the `AuthzExtension` resource to be
43+
* created.
44+
* @param string $authzExtensionName Identifier. Name of the `AuthzExtension` resource in the
45+
* following format:
46+
* `projects/{project}/locations/{location}/authzExtensions/{authz_extension}`.
47+
* @param int $authzExtensionLoadBalancingScheme All backend services and forwarding rules referenced by this
48+
* extension must share the same load balancing scheme. Supported values:
49+
* `INTERNAL_MANAGED`, `EXTERNAL_MANAGED`. For more information, refer to
50+
* [Backend services
51+
* overview](https://cloud.google.com/load-balancing/docs/backend-service).
52+
* @param string $authzExtensionAuthority The `:authority` header in the gRPC request sent from Envoy
53+
* to the extension service.
54+
* @param string $authzExtensionService The reference to the service that runs the extension.
55+
*
56+
* To configure a callout extension, `service` must be a fully-qualified
57+
* reference
58+
* to a [backend
59+
* service](https://cloud.google.com/compute/docs/reference/rest/v1/backendServices)
60+
* in the format:
61+
* `https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/backendServices/{backendService}`
62+
* or
63+
* `https://www.googleapis.com/compute/v1/projects/{project}/global/backendServices/{backendService}`.
64+
*/
65+
function create_authz_extension_sample(
66+
string $formattedParent,
67+
string $authzExtensionId,
68+
string $authzExtensionName,
69+
int $authzExtensionLoadBalancingScheme,
70+
string $authzExtensionAuthority,
71+
string $authzExtensionService
72+
): void {
73+
// Create a client.
74+
$depServiceClient = new DepServiceClient();
75+
76+
// Prepare the request message.
77+
$authzExtensionTimeout = new Duration();
78+
$authzExtension = (new AuthzExtension())
79+
->setName($authzExtensionName)
80+
->setLoadBalancingScheme($authzExtensionLoadBalancingScheme)
81+
->setAuthority($authzExtensionAuthority)
82+
->setService($authzExtensionService)
83+
->setTimeout($authzExtensionTimeout);
84+
$request = (new CreateAuthzExtensionRequest())
85+
->setParent($formattedParent)
86+
->setAuthzExtensionId($authzExtensionId)
87+
->setAuthzExtension($authzExtension);
88+
89+
// Call the API and handle any network failures.
90+
try {
91+
/** @var OperationResponse $response */
92+
$response = $depServiceClient->createAuthzExtension($request);
93+
$response->pollUntilComplete();
94+
95+
if ($response->operationSucceeded()) {
96+
/** @var AuthzExtension $result */
97+
$result = $response->getResult();
98+
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
99+
} else {
100+
/** @var Status $error */
101+
$error = $response->getError();
102+
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
103+
}
104+
} catch (ApiException $ex) {
105+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
106+
}
107+
}
108+
109+
/**
110+
* Helper to execute the sample.
111+
*
112+
* This sample has been automatically generated and should be regarded as a code
113+
* template only. It will require modifications to work:
114+
* - It may require correct/in-range values for request initialization.
115+
* - It may require specifying regional endpoints when creating the service client,
116+
* please see the apiEndpoint client configuration option for more details.
117+
*/
118+
function callSample(): void
119+
{
120+
$formattedParent = DepServiceClient::locationName('[PROJECT]', '[LOCATION]');
121+
$authzExtensionId = '[AUTHZ_EXTENSION_ID]';
122+
$authzExtensionName = '[NAME]';
123+
$authzExtensionLoadBalancingScheme = LoadBalancingScheme::LOAD_BALANCING_SCHEME_UNSPECIFIED;
124+
$authzExtensionAuthority = '[AUTHORITY]';
125+
$authzExtensionService = '[SERVICE]';
126+
127+
create_authz_extension_sample(
128+
$formattedParent,
129+
$authzExtensionId,
130+
$authzExtensionName,
131+
$authzExtensionLoadBalancingScheme,
132+
$authzExtensionAuthority,
133+
$authzExtensionService
134+
);
135+
}
136+
// [END networkservices_v1_generated_DepService_CreateAuthzExtension_sync]

NetworkServices/samples/V1/DepServiceClient/create_lb_route_extension.php

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@
4646
* following format:
4747
* `projects/{project}/locations/{location}/lbRouteExtensions/{lb_route_extension}`.
4848
* @param string $lbRouteExtensionForwardingRulesElement A list of references to the forwarding rules to which this
49-
* service extension is attached to. At least one forwarding rule is required.
50-
* There can be only one `LbRouteExtension` resource per forwarding rule.
49+
* service extension is attached. At least one forwarding rule is required.
50+
* Only one `LbRouteExtension` resource can be associated with a forwarding
51+
* rule.
5152
* @param string $lbRouteExtensionExtensionChainsName The name for this extension chain.
5253
* The name is logged as part of the HTTP request logs.
5354
* The name must conform with RFC-1034, is restricted to lower-cased letters,
@@ -67,8 +68,6 @@
6768
* last a letter or a number.
6869
* @param string $lbRouteExtensionExtensionChainsExtensionsService The reference to the service that runs the extension.
6970
*
70-
* Currently only callout extensions are supported here.
71-
*
7271
* To configure a callout extension, `service` must be a fully-qualified
7372
* reference
7473
* to a [backend
@@ -77,11 +76,23 @@
7776
* `https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/backendServices/{backendService}`
7877
* or
7978
* `https://www.googleapis.com/compute/v1/projects/{project}/global/backendServices/{backendService}`.
79+
*
80+
* To configure a plugin extension, `service` must be a reference
81+
* to a [`WasmPlugin`
82+
* resource](https://cloud.google.com/service-extensions/docs/reference/rest/v1beta1/projects.locations.wasmPlugins)
83+
* in the format:
84+
* `projects/{project}/locations/{location}/wasmPlugins/{plugin}`
85+
* or
86+
* `//networkservices.googleapis.com/projects/{project}/locations/{location}/wasmPlugins/{wasmPlugin}`.
87+
*
88+
* Plugin extensions are currently supported for the
89+
* `LbTrafficExtension`, the `LbRouteExtension`, and the `LbEdgeExtension`
90+
* resources.
8091
* @param int $lbRouteExtensionLoadBalancingScheme All backend services and forwarding rules referenced by this
8192
* extension must share the same load balancing scheme. Supported values:
8293
* `INTERNAL_MANAGED`, `EXTERNAL_MANAGED`. For more information, refer to
83-
* [Choosing a load
84-
* balancer](https://cloud.google.com/load-balancing/docs/backend-service).
94+
* [Backend services
95+
* overview](https://cloud.google.com/load-balancing/docs/backend-service).
8596
*/
8697
function create_lb_route_extension_sample(
8798
string $formattedParent,

0 commit comments

Comments
 (0)