Skip to content

Commit

Permalink
feat: Update Compute Engine API to revision 20221101 (#751) (#367)
Browse files Browse the repository at this point in the history
* feat: Update Compute Engine API to revision 20221101 (#751)

Source-Link: googleapis/googleapis@b0432a1

Source-Link: googleapis/googleapis-gen@18b7021
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMThiNzAyMTQ4N2M0YTFlOTQyN2I2MWIxZjIxODVhMzJjNzMzYzM0MCJ9

* 🦉 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>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Nov 21, 2022
1 parent 6fcf667 commit 068548b
Show file tree
Hide file tree
Showing 10 changed files with 1,038 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@
AggregatedListTargetHttpsProxiesRequest,
AggregatedListTargetInstancesRequest,
AggregatedListTargetPoolsRequest,
AggregatedListTargetTcpProxiesRequest,
AggregatedListTargetVpnGatewaysRequest,
AggregatedListUrlMapsRequest,
AggregatedListVpnGatewaysRequest,
Expand Down Expand Up @@ -1401,9 +1402,11 @@
TargetSslProxiesSetSslCertificatesRequest,
TargetSslProxy,
TargetSslProxyList,
TargetTcpProxiesScopedList,
TargetTcpProxiesSetBackendServiceRequest,
TargetTcpProxiesSetProxyHeaderRequest,
TargetTcpProxy,
TargetTcpProxyAggregatedList,
TargetTcpProxyList,
TargetVpnGateway,
TargetVpnGatewayAggregatedList,
Expand Down Expand Up @@ -1662,6 +1665,7 @@
"AggregatedListTargetHttpsProxiesRequest",
"AggregatedListTargetInstancesRequest",
"AggregatedListTargetPoolsRequest",
"AggregatedListTargetTcpProxiesRequest",
"AggregatedListTargetVpnGatewaysRequest",
"AggregatedListUrlMapsRequest",
"AggregatedListVpnGatewaysRequest",
Expand Down Expand Up @@ -2787,9 +2791,11 @@
"TargetSslProxiesSetSslCertificatesRequest",
"TargetSslProxy",
"TargetSslProxyList",
"TargetTcpProxiesScopedList",
"TargetTcpProxiesSetBackendServiceRequest",
"TargetTcpProxiesSetProxyHeaderRequest",
"TargetTcpProxy",
"TargetTcpProxyAggregatedList",
"TargetTcpProxyList",
"TargetVpnGateway",
"TargetVpnGatewayAggregatedList",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
AggregatedListTargetHttpsProxiesRequest,
AggregatedListTargetInstancesRequest,
AggregatedListTargetPoolsRequest,
AggregatedListTargetTcpProxiesRequest,
AggregatedListTargetVpnGatewaysRequest,
AggregatedListUrlMapsRequest,
AggregatedListVpnGatewaysRequest,
Expand Down Expand Up @@ -1301,9 +1302,11 @@
TargetSslProxiesSetSslCertificatesRequest,
TargetSslProxy,
TargetSslProxyList,
TargetTcpProxiesScopedList,
TargetTcpProxiesSetBackendServiceRequest,
TargetTcpProxiesSetProxyHeaderRequest,
TargetTcpProxy,
TargetTcpProxyAggregatedList,
TargetTcpProxyList,
TargetVpnGateway,
TargetVpnGatewayAggregatedList,
Expand Down Expand Up @@ -1477,6 +1480,7 @@
"AggregatedListTargetHttpsProxiesRequest",
"AggregatedListTargetInstancesRequest",
"AggregatedListTargetPoolsRequest",
"AggregatedListTargetTcpProxiesRequest",
"AggregatedListTargetVpnGatewaysRequest",
"AggregatedListUrlMapsRequest",
"AggregatedListVpnGatewaysRequest",
Expand Down Expand Up @@ -2682,9 +2686,11 @@
"TargetSslProxy",
"TargetSslProxyList",
"TargetTcpProxiesClient",
"TargetTcpProxiesScopedList",
"TargetTcpProxiesSetBackendServiceRequest",
"TargetTcpProxiesSetProxyHeaderRequest",
"TargetTcpProxy",
"TargetTcpProxyAggregatedList",
"TargetTcpProxyList",
"TargetVpnGateway",
"TargetVpnGatewayAggregatedList",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3865,6 +3865,11 @@
"rest": {
"libraryClient": "TargetTcpProxiesClient",
"rpcs": {
"AggregatedList": {
"methods": [
"aggregated_list"
]
},
"Delete": {
"methods": [
"delete"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,96 @@ def __init__(
api_audience=client_options.api_audience,
)

def aggregated_list(
self,
request: Optional[
Union[compute.AggregatedListTargetTcpProxiesRequest, dict]
] = None,
*,
project: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.AggregatedListPager:
r"""Retrieves the list of all TargetTcpProxy resources,
regional and global, available to the specified project.
Args:
request (Union[google.cloud.compute_v1.types.AggregatedListTargetTcpProxiesRequest, dict]):
The request object. A request message for
TargetTcpProxies.AggregatedList. See the method
description for details.
project (str):
Name of the project scoping 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, str]]): Strings which should be
sent along with the request as metadata.
Returns:
google.cloud.compute_v1.services.target_tcp_proxies.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."
)

# Minor optimization to avoid making a copy if the user passes
# in a compute.AggregatedListTargetTcpProxiesRequest.
# There's no risk of modifying the input as we've already verified
# there are no flattened fields.
if not isinstance(request, compute.AggregatedListTargetTcpProxiesRequest):
request = compute.AggregatedListTargetTcpProxiesRequest(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),)),
)

# 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,
metadata=metadata,
)

# Done; return the response.
return response

def delete_unary(
self,
request: Optional[Union[compute.DeleteTargetTcpProxyRequest, dict]] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,71 @@
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.TargetTcpProxyAggregatedList` 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.TargetTcpProxyAggregatedList`
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.TargetTcpProxyAggregatedList],
request: compute.AggregatedListTargetTcpProxiesRequest,
response: compute.TargetTcpProxyAggregatedList,
*,
metadata: Sequence[Tuple[str, str]] = ()
):
"""Instantiate the pager.
Args:
method (Callable): The method that was originally called, and
which instantiated this pager.
request (google.cloud.compute_v1.types.AggregatedListTargetTcpProxiesRequest):
The initial request object.
response (google.cloud.compute_v1.types.TargetTcpProxyAggregatedList):
The initial response object.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
"""
self._method = method
self._request = compute.AggregatedListTargetTcpProxiesRequest(request)
self._response = response
self._metadata = metadata

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

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

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

def get(self, key: str) -> Optional[compute.TargetTcpProxiesScopedList]:
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 @@ -132,6 +132,11 @@ def __init__(
def _prep_wrapped_messages(self, client_info):
# Precompute the wrapped methods.
self._wrapped_methods = {
self.aggregated_list: gapic_v1.method.wrap_method(
self.aggregated_list,
default_timeout=None,
client_info=client_info,
),
self.delete: gapic_v1.method.wrap_method(
self.delete,
default_timeout=None,
Expand Down Expand Up @@ -173,6 +178,18 @@ def close(self):
"""
raise NotImplementedError()

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

@property
def delete(
self,
Expand Down
Loading

0 comments on commit 068548b

Please sign in to comment.