Skip to content

Commit 4c7730f

Browse files
feat: [google-cloud-compute] Update Compute Engine API to revision 20250107 (#975) (#13461)
- [ ] Regenerate this pull request now. Source-Link: googleapis/googleapis@256da8c Source-Link: googleapis/googleapis-gen@523a493 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWNvbXB1dGUvLk93bEJvdC55YW1sIiwiaCI6IjUyM2E0OTMyODdhNjg1MmQ4NzE5ZDc1OTUyODlmNjFlZGRmY2MwMTAifQ== --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 7f44b09 commit 4c7730f

File tree

16 files changed

+1449
-76
lines changed

16 files changed

+1449
-76
lines changed

packages/google-cloud-compute/google/cloud/compute/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@
294294
AggregatedListNetworkAttachmentsRequest,
295295
AggregatedListNetworkEdgeSecurityServicesRequest,
296296
AggregatedListNetworkEndpointGroupsRequest,
297+
AggregatedListNetworkFirewallPoliciesRequest,
297298
AggregatedListNodeGroupsRequest,
298299
AggregatedListNodeTemplatesRequest,
299300
AggregatedListNodeTypesRequest,
@@ -560,6 +561,7 @@
560561
FirewallList,
561562
FirewallLogConfig,
562563
FirewallPoliciesListAssociationsResponse,
564+
FirewallPoliciesScopedList,
563565
FirewallPolicy,
564566
FirewallPolicyAssociation,
565567
FirewallPolicyList,
@@ -1137,6 +1139,7 @@
11371139
NetworkEndpointGroupsListNetworkEndpoints,
11381140
NetworkEndpointGroupsScopedList,
11391141
NetworkEndpointWithHealthStatus,
1142+
NetworkFirewallPolicyAggregatedList,
11401143
NetworkInterface,
11411144
NetworkList,
11421145
NetworkPeering,
@@ -1919,6 +1922,7 @@
19191922
"AggregatedListNetworkAttachmentsRequest",
19201923
"AggregatedListNetworkEdgeSecurityServicesRequest",
19211924
"AggregatedListNetworkEndpointGroupsRequest",
1925+
"AggregatedListNetworkFirewallPoliciesRequest",
19221926
"AggregatedListNodeGroupsRequest",
19231927
"AggregatedListNodeTemplatesRequest",
19241928
"AggregatedListNodeTypesRequest",
@@ -2185,6 +2189,7 @@
21852189
"FirewallList",
21862190
"FirewallLogConfig",
21872191
"FirewallPoliciesListAssociationsResponse",
2192+
"FirewallPoliciesScopedList",
21882193
"FirewallPolicy",
21892194
"FirewallPolicyAssociation",
21902195
"FirewallPolicyList",
@@ -2762,6 +2767,7 @@
27622767
"NetworkEndpointGroupsListNetworkEndpoints",
27632768
"NetworkEndpointGroupsScopedList",
27642769
"NetworkEndpointWithHealthStatus",
2770+
"NetworkFirewallPolicyAggregatedList",
27652771
"NetworkInterface",
27662772
"NetworkList",
27672773
"NetworkPeering",

packages/google-cloud-compute/google/cloud/compute/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.23.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-compute/google/cloud/compute_v1/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@
176176
AggregatedListNetworkAttachmentsRequest,
177177
AggregatedListNetworkEdgeSecurityServicesRequest,
178178
AggregatedListNetworkEndpointGroupsRequest,
179+
AggregatedListNetworkFirewallPoliciesRequest,
179180
AggregatedListNodeGroupsRequest,
180181
AggregatedListNodeTemplatesRequest,
181182
AggregatedListNodeTypesRequest,
@@ -442,6 +443,7 @@
442443
FirewallList,
443444
FirewallLogConfig,
444445
FirewallPoliciesListAssociationsResponse,
446+
FirewallPoliciesScopedList,
445447
FirewallPolicy,
446448
FirewallPolicyAssociation,
447449
FirewallPolicyList,
@@ -1019,6 +1021,7 @@
10191021
NetworkEndpointGroupsListNetworkEndpoints,
10201022
NetworkEndpointGroupsScopedList,
10211023
NetworkEndpointWithHealthStatus,
1024+
NetworkFirewallPolicyAggregatedList,
10221025
NetworkInterface,
10231026
NetworkList,
10241027
NetworkPeering,
@@ -1705,6 +1708,7 @@
17051708
"AggregatedListNetworkAttachmentsRequest",
17061709
"AggregatedListNetworkEdgeSecurityServicesRequest",
17071710
"AggregatedListNetworkEndpointGroupsRequest",
1711+
"AggregatedListNetworkFirewallPoliciesRequest",
17081712
"AggregatedListNodeGroupsRequest",
17091713
"AggregatedListNodeTemplatesRequest",
17101714
"AggregatedListNodeTypesRequest",
@@ -1977,6 +1981,7 @@
19771981
"FirewallLogConfig",
19781982
"FirewallPoliciesClient",
19791983
"FirewallPoliciesListAssociationsResponse",
1984+
"FirewallPoliciesScopedList",
19801985
"FirewallPolicy",
19811986
"FirewallPolicyAssociation",
19821987
"FirewallPolicyList",
@@ -2584,6 +2589,7 @@
25842589
"NetworkEndpointGroupsScopedList",
25852590
"NetworkEndpointWithHealthStatus",
25862591
"NetworkFirewallPoliciesClient",
2592+
"NetworkFirewallPolicyAggregatedList",
25872593
"NetworkInterface",
25882594
"NetworkList",
25892595
"NetworkPeering",

packages/google-cloud-compute/google/cloud/compute_v1/gapic_metadata.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1972,6 +1972,11 @@
19721972
"add_rule"
19731973
]
19741974
},
1975+
"AggregatedList": {
1976+
"methods": [
1977+
"aggregated_list"
1978+
]
1979+
},
19751980
"CloneRules": {
19761981
"methods": [
19771982
"clone_rules"

packages/google-cloud-compute/google/cloud/compute_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.23.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-compute/google/cloud/compute_v1/services/network_firewall_policies/client.py

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,6 +1255,131 @@ def error_code(self):
12551255
# Done; return the response.
12561256
return response
12571257

1258+
def aggregated_list(
1259+
self,
1260+
request: Optional[
1261+
Union[compute.AggregatedListNetworkFirewallPoliciesRequest, dict]
1262+
] = None,
1263+
*,
1264+
project: Optional[str] = None,
1265+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1266+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1267+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1268+
) -> pagers.AggregatedListPager:
1269+
r"""Retrieves an aggregated list of network firewall policies,
1270+
listing network firewall policies from all applicable scopes
1271+
(global and regional) and grouping the results per scope. To
1272+
prevent failure, Google recommends that you set the
1273+
``returnPartialSuccess`` parameter to ``true``.
1274+
1275+
.. code-block:: python
1276+
1277+
# This snippet has been automatically generated and should be regarded as a
1278+
# code template only.
1279+
# It will require modifications to work:
1280+
# - It may require correct/in-range values for request initialization.
1281+
# - It may require specifying regional endpoints when creating the service
1282+
# client as shown in:
1283+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
1284+
from google.cloud import compute_v1
1285+
1286+
def sample_aggregated_list():
1287+
# Create a client
1288+
client = compute_v1.NetworkFirewallPoliciesClient()
1289+
1290+
# Initialize request argument(s)
1291+
request = compute_v1.AggregatedListNetworkFirewallPoliciesRequest(
1292+
project="project_value",
1293+
)
1294+
1295+
# Make the request
1296+
page_result = client.aggregated_list(request=request)
1297+
1298+
# Handle the response
1299+
for response in page_result:
1300+
print(response)
1301+
1302+
Args:
1303+
request (Union[google.cloud.compute_v1.types.AggregatedListNetworkFirewallPoliciesRequest, dict]):
1304+
The request object. A request message for
1305+
NetworkFirewallPolicies.AggregatedList.
1306+
See the method description for details.
1307+
project (str):
1308+
Project ID for this request.
1309+
This corresponds to the ``project`` field
1310+
on the ``request`` instance; if ``request`` is provided, this
1311+
should not be set.
1312+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
1313+
should be retried.
1314+
timeout (float): The timeout for this request.
1315+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1316+
sent along with the request as metadata. Normally, each value must be of type `str`,
1317+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
1318+
be of type `bytes`.
1319+
1320+
Returns:
1321+
google.cloud.compute_v1.services.network_firewall_policies.pagers.AggregatedListPager:
1322+
Iterating over this object will yield
1323+
results and resolve additional pages
1324+
automatically.
1325+
1326+
"""
1327+
# Create or coerce a protobuf request object.
1328+
# - Quick check: If we got a request object, we should *not* have
1329+
# gotten any keyword arguments that map to the request.
1330+
has_flattened_params = any([project])
1331+
if request is not None and has_flattened_params:
1332+
raise ValueError(
1333+
"If the `request` argument is set, then none of "
1334+
"the individual field arguments should be set."
1335+
)
1336+
1337+
# - Use the request object if provided (there's no risk of modifying the input as
1338+
# there are no flattened fields), or create one.
1339+
if not isinstance(
1340+
request, compute.AggregatedListNetworkFirewallPoliciesRequest
1341+
):
1342+
request = compute.AggregatedListNetworkFirewallPoliciesRequest(request)
1343+
# If we have keyword arguments corresponding to fields on the
1344+
# request, apply these.
1345+
if project is not None:
1346+
request.project = project
1347+
1348+
# Wrap the RPC method; this adds retry and timeout information,
1349+
# and friendly error handling.
1350+
rpc = self._transport._wrapped_methods[self._transport.aggregated_list]
1351+
1352+
# Certain fields should be provided within the metadata header;
1353+
# add these here.
1354+
metadata = tuple(metadata) + (
1355+
gapic_v1.routing_header.to_grpc_metadata((("project", request.project),)),
1356+
)
1357+
1358+
# Validate the universe domain.
1359+
self._validate_universe_domain()
1360+
1361+
# Send the request.
1362+
response = rpc(
1363+
request,
1364+
retry=retry,
1365+
timeout=timeout,
1366+
metadata=metadata,
1367+
)
1368+
1369+
# This method is paged; wrap the response in a pager, which provides
1370+
# an `__iter__` convenience method.
1371+
response = pagers.AggregatedListPager(
1372+
method=rpc,
1373+
request=request,
1374+
response=response,
1375+
retry=retry,
1376+
timeout=timeout,
1377+
metadata=metadata,
1378+
)
1379+
1380+
# Done; return the response.
1381+
return response
1382+
12581383
def clone_rules_unary(
12591384
self,
12601385
request: Optional[

packages/google-cloud-compute/google/cloud/compute_v1/services/network_firewall_policies/pagers.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,85 @@
4141
from google.cloud.compute_v1.types import compute
4242

4343

44+
class AggregatedListPager:
45+
"""A pager for iterating through ``aggregated_list`` requests.
46+
47+
This class thinly wraps an initial
48+
:class:`google.cloud.compute_v1.types.NetworkFirewallPolicyAggregatedList` object, and
49+
provides an ``__iter__`` method to iterate through its
50+
``items`` field.
51+
52+
If there are more pages, the ``__iter__`` method will make additional
53+
``AggregatedList`` requests and continue to iterate
54+
through the ``items`` field on the
55+
corresponding responses.
56+
57+
All the usual :class:`google.cloud.compute_v1.types.NetworkFirewallPolicyAggregatedList`
58+
attributes are available on the pager. If multiple requests are made, only
59+
the most recent response is retained, and thus used for attribute lookup.
60+
"""
61+
62+
def __init__(
63+
self,
64+
method: Callable[..., compute.NetworkFirewallPolicyAggregatedList],
65+
request: compute.AggregatedListNetworkFirewallPoliciesRequest,
66+
response: compute.NetworkFirewallPolicyAggregatedList,
67+
*,
68+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
69+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
70+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
71+
):
72+
"""Instantiate the pager.
73+
74+
Args:
75+
method (Callable): The method that was originally called, and
76+
which instantiated this pager.
77+
request (google.cloud.compute_v1.types.AggregatedListNetworkFirewallPoliciesRequest):
78+
The initial request object.
79+
response (google.cloud.compute_v1.types.NetworkFirewallPolicyAggregatedList):
80+
The initial response object.
81+
retry (google.api_core.retry.Retry): Designation of what errors,
82+
if any, should be retried.
83+
timeout (float): The timeout for this request.
84+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
85+
sent along with the request as metadata. Normally, each value must be of type `str`,
86+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
87+
be of type `bytes`.
88+
"""
89+
self._method = method
90+
self._request = compute.AggregatedListNetworkFirewallPoliciesRequest(request)
91+
self._response = response
92+
self._retry = retry
93+
self._timeout = timeout
94+
self._metadata = metadata
95+
96+
def __getattr__(self, name: str) -> Any:
97+
return getattr(self._response, name)
98+
99+
@property
100+
def pages(self) -> Iterator[compute.NetworkFirewallPolicyAggregatedList]:
101+
yield self._response
102+
while self._response.next_page_token:
103+
self._request.page_token = self._response.next_page_token
104+
self._response = self._method(
105+
self._request,
106+
retry=self._retry,
107+
timeout=self._timeout,
108+
metadata=self._metadata,
109+
)
110+
yield self._response
111+
112+
def __iter__(self) -> Iterator[Tuple[str, compute.FirewallPoliciesScopedList]]:
113+
for page in self.pages:
114+
yield from page.items.items()
115+
116+
def get(self, key: str) -> Optional[compute.FirewallPoliciesScopedList]:
117+
return self._response.items.get(key)
118+
119+
def __repr__(self) -> str:
120+
return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
121+
122+
44123
class ListPager:
45124
"""A pager for iterating through ``list`` requests.
46125

packages/google-cloud-compute/google/cloud/compute_v1/services/network_firewall_policies/transports/base.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ def _prep_wrapped_messages(self, client_info):
143143
default_timeout=None,
144144
client_info=client_info,
145145
),
146+
self.aggregated_list: gapic_v1.method.wrap_method(
147+
self.aggregated_list,
148+
default_timeout=None,
149+
client_info=client_info,
150+
),
146151
self.clone_rules: gapic_v1.method.wrap_method(
147152
self.clone_rules,
148153
default_timeout=None,
@@ -242,6 +247,18 @@ def add_rule(
242247
]:
243248
raise NotImplementedError()
244249

250+
@property
251+
def aggregated_list(
252+
self,
253+
) -> Callable[
254+
[compute.AggregatedListNetworkFirewallPoliciesRequest],
255+
Union[
256+
compute.NetworkFirewallPolicyAggregatedList,
257+
Awaitable[compute.NetworkFirewallPolicyAggregatedList],
258+
],
259+
]:
260+
raise NotImplementedError()
261+
245262
@property
246263
def clone_rules(
247264
self,

0 commit comments

Comments
 (0)