Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [google-cloud-compute] Update Compute Engine API to revision 20250107 (#975) #13461

Merged
merged 2 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@
AggregatedListNetworkAttachmentsRequest,
AggregatedListNetworkEdgeSecurityServicesRequest,
AggregatedListNetworkEndpointGroupsRequest,
AggregatedListNetworkFirewallPoliciesRequest,
AggregatedListNodeGroupsRequest,
AggregatedListNodeTemplatesRequest,
AggregatedListNodeTypesRequest,
Expand Down Expand Up @@ -560,6 +561,7 @@
FirewallList,
FirewallLogConfig,
FirewallPoliciesListAssociationsResponse,
FirewallPoliciesScopedList,
FirewallPolicy,
FirewallPolicyAssociation,
FirewallPolicyList,
Expand Down Expand Up @@ -1137,6 +1139,7 @@
NetworkEndpointGroupsListNetworkEndpoints,
NetworkEndpointGroupsScopedList,
NetworkEndpointWithHealthStatus,
NetworkFirewallPolicyAggregatedList,
NetworkInterface,
NetworkList,
NetworkPeering,
Expand Down Expand Up @@ -1919,6 +1922,7 @@
"AggregatedListNetworkAttachmentsRequest",
"AggregatedListNetworkEdgeSecurityServicesRequest",
"AggregatedListNetworkEndpointGroupsRequest",
"AggregatedListNetworkFirewallPoliciesRequest",
"AggregatedListNodeGroupsRequest",
"AggregatedListNodeTemplatesRequest",
"AggregatedListNodeTypesRequest",
Expand Down Expand Up @@ -2185,6 +2189,7 @@
"FirewallList",
"FirewallLogConfig",
"FirewallPoliciesListAssociationsResponse",
"FirewallPoliciesScopedList",
"FirewallPolicy",
"FirewallPolicyAssociation",
"FirewallPolicyList",
Expand Down Expand Up @@ -2762,6 +2767,7 @@
"NetworkEndpointGroupsListNetworkEndpoints",
"NetworkEndpointGroupsScopedList",
"NetworkEndpointWithHealthStatus",
"NetworkFirewallPolicyAggregatedList",
"NetworkInterface",
"NetworkList",
"NetworkPeering",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "1.23.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
AggregatedListNetworkAttachmentsRequest,
AggregatedListNetworkEdgeSecurityServicesRequest,
AggregatedListNetworkEndpointGroupsRequest,
AggregatedListNetworkFirewallPoliciesRequest,
AggregatedListNodeGroupsRequest,
AggregatedListNodeTemplatesRequest,
AggregatedListNodeTypesRequest,
Expand Down Expand Up @@ -442,6 +443,7 @@
FirewallList,
FirewallLogConfig,
FirewallPoliciesListAssociationsResponse,
FirewallPoliciesScopedList,
FirewallPolicy,
FirewallPolicyAssociation,
FirewallPolicyList,
Expand Down Expand Up @@ -1019,6 +1021,7 @@
NetworkEndpointGroupsListNetworkEndpoints,
NetworkEndpointGroupsScopedList,
NetworkEndpointWithHealthStatus,
NetworkFirewallPolicyAggregatedList,
NetworkInterface,
NetworkList,
NetworkPeering,
Expand Down Expand Up @@ -1705,6 +1708,7 @@
"AggregatedListNetworkAttachmentsRequest",
"AggregatedListNetworkEdgeSecurityServicesRequest",
"AggregatedListNetworkEndpointGroupsRequest",
"AggregatedListNetworkFirewallPoliciesRequest",
"AggregatedListNodeGroupsRequest",
"AggregatedListNodeTemplatesRequest",
"AggregatedListNodeTypesRequest",
Expand Down Expand Up @@ -1977,6 +1981,7 @@
"FirewallLogConfig",
"FirewallPoliciesClient",
"FirewallPoliciesListAssociationsResponse",
"FirewallPoliciesScopedList",
"FirewallPolicy",
"FirewallPolicyAssociation",
"FirewallPolicyList",
Expand Down Expand Up @@ -2584,6 +2589,7 @@
"NetworkEndpointGroupsScopedList",
"NetworkEndpointWithHealthStatus",
"NetworkFirewallPoliciesClient",
"NetworkFirewallPolicyAggregatedList",
"NetworkInterface",
"NetworkList",
"NetworkPeering",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1972,6 +1972,11 @@
"add_rule"
]
},
"AggregatedList": {
"methods": [
"aggregated_list"
]
},
"CloneRules": {
"methods": [
"clone_rules"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "1.23.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,131 @@ def error_code(self):
# Done; return the response.
return response

def aggregated_list(
self,
request: Optional[
Union[compute.AggregatedListNetworkFirewallPoliciesRequest, dict]
] = None,
*,
project: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.AggregatedListPager:
r"""Retrieves an aggregated list of network firewall policies,
listing network firewall policies from all applicable scopes
(global and regional) and grouping the results per scope. To
prevent failure, Google recommends that you set the
``returnPartialSuccess`` parameter to ``true``.

.. code-block:: python

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import compute_v1

def sample_aggregated_list():
# Create a client
client = compute_v1.NetworkFirewallPoliciesClient()

# Initialize request argument(s)
request = compute_v1.AggregatedListNetworkFirewallPoliciesRequest(
project="project_value",
)

# Make the request
page_result = client.aggregated_list(request=request)

# Handle the response
for response in page_result:
print(response)

Args:
request (Union[google.cloud.compute_v1.types.AggregatedListNetworkFirewallPoliciesRequest, dict]):
The request object. A request message for
NetworkFirewallPolicies.AggregatedList.
See the method description for details.
project (str):
Project ID for this request.
This corresponds to the ``project`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.

Returns:
google.cloud.compute_v1.services.network_firewall_policies.pagers.AggregatedListPager:
Iterating over this object will yield
results and resolve additional pages
automatically.

"""
# Create or coerce a protobuf request object.
# - Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([project])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

# - Use the request object if provided (there's no risk of modifying the input as
# there are no flattened fields), or create one.
if not isinstance(
request, compute.AggregatedListNetworkFirewallPoliciesRequest
):
request = compute.AggregatedListNetworkFirewallPoliciesRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if project is not None:
request.project = project

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._transport._wrapped_methods[self._transport.aggregated_list]

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("project", request.project),)),
)

# Validate the universe domain.
self._validate_universe_domain()

# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# This method is paged; wrap the response in a pager, which provides
# an `__iter__` convenience method.
response = pagers.AggregatedListPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Done; return the response.
return response

def clone_rules_unary(
self,
request: Optional[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,85 @@
from google.cloud.compute_v1.types import compute


class AggregatedListPager:
"""A pager for iterating through ``aggregated_list`` requests.

This class thinly wraps an initial
:class:`google.cloud.compute_v1.types.NetworkFirewallPolicyAggregatedList` object, and
provides an ``__iter__`` method to iterate through its
``items`` field.

If there are more pages, the ``__iter__`` method will make additional
``AggregatedList`` requests and continue to iterate
through the ``items`` field on the
corresponding responses.

All the usual :class:`google.cloud.compute_v1.types.NetworkFirewallPolicyAggregatedList`
attributes are available on the pager. If multiple requests are made, only
the most recent response is retained, and thus used for attribute lookup.
"""

def __init__(
self,
method: Callable[..., compute.NetworkFirewallPolicyAggregatedList],
request: compute.AggregatedListNetworkFirewallPoliciesRequest,
response: compute.NetworkFirewallPolicyAggregatedList,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
):
"""Instantiate the pager.

Args:
method (Callable): The method that was originally called, and
which instantiated this pager.
request (google.cloud.compute_v1.types.AggregatedListNetworkFirewallPoliciesRequest):
The initial request object.
response (google.cloud.compute_v1.types.NetworkFirewallPolicyAggregatedList):
The initial response object.
retry (google.api_core.retry.Retry): Designation of what errors,
if any, should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
self._method = method
self._request = compute.AggregatedListNetworkFirewallPoliciesRequest(request)
self._response = response
self._retry = retry
self._timeout = timeout
self._metadata = metadata

def __getattr__(self, name: str) -> Any:
return getattr(self._response, name)

@property
def pages(self) -> Iterator[compute.NetworkFirewallPolicyAggregatedList]:
yield self._response
while self._response.next_page_token:
self._request.page_token = self._response.next_page_token
self._response = self._method(
self._request,
retry=self._retry,
timeout=self._timeout,
metadata=self._metadata,
)
yield self._response

def __iter__(self) -> Iterator[Tuple[str, compute.FirewallPoliciesScopedList]]:
for page in self.pages:
yield from page.items.items()

def get(self, key: str) -> Optional[compute.FirewallPoliciesScopedList]:
return self._response.items.get(key)

def __repr__(self) -> str:
return "{0}<{1!r}>".format(self.__class__.__name__, self._response)


class ListPager:
"""A pager for iterating through ``list`` requests.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=None,
client_info=client_info,
),
self.aggregated_list: gapic_v1.method.wrap_method(
self.aggregated_list,
default_timeout=None,
client_info=client_info,
),
self.clone_rules: gapic_v1.method.wrap_method(
self.clone_rules,
default_timeout=None,
Expand Down Expand Up @@ -242,6 +247,18 @@ def add_rule(
]:
raise NotImplementedError()

@property
def aggregated_list(
self,
) -> Callable[
[compute.AggregatedListNetworkFirewallPoliciesRequest],
Union[
compute.NetworkFirewallPolicyAggregatedList,
Awaitable[compute.NetworkFirewallPolicyAggregatedList],
],
]:
raise NotImplementedError()

@property
def clone_rules(
self,
Expand Down
Loading
Loading