Skip to content

Commit

Permalink
chore: remove body selector from http rule (#521)
Browse files Browse the repository at this point in the history
* chore: Update gapic-generator-python to v1.19.1

PiperOrigin-RevId: 684571179

Source-Link: googleapis/googleapis@fbdc238

Source-Link: googleapis/googleapis-gen@3a2cdcf
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiM2EyY2RjZmI4MGMyZDBmNWVjMGNjNjYzYzJiYWIwYTk0ODYyMjlkMCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* chore: Configure Ruby clients for google-ads-ad_manager

PiperOrigin-RevId: 689139590

Source-Link: googleapis/googleapis@296f2ac

Source-Link: googleapis/googleapis-gen@2692736
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjY5MjczNjJlMGFhMTI5MzI1OGZjMjNmZTNjZTgzYzVjMjFkNWZiYiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* chore: remove body selector from http rule

PiperOrigin-RevId: 693215877

Source-Link: googleapis/googleapis@bb6b53e

Source-Link: googleapis/googleapis-gen@db8b5a9
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZGI4YjVhOTM0ODRhZDQ0MDU1YjJiYWNjNGM3Y2Y4N2U5NzBmZTBlZCJ9

* 🦉 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 11, 2024
1 parent 83aac4f commit 6273a5c
Show file tree
Hide file tree
Showing 37 changed files with 2,399 additions and 2,571 deletions.
24 changes: 4 additions & 20 deletions google/cloud/pubsublite_v1/services/admin_service/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2456,11 +2456,7 @@ async def list_operations(

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.list_operations,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)
rpc = self.transport._wrapped_methods[self._client._transport.list_operations]

# Certain fields should be provided within the metadata header;
# add these here.
Expand Down Expand Up @@ -2513,11 +2509,7 @@ async def get_operation(

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.get_operation,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)
rpc = self.transport._wrapped_methods[self._client._transport.get_operation]

# Certain fields should be provided within the metadata header;
# add these here.
Expand Down Expand Up @@ -2574,11 +2566,7 @@ async def delete_operation(

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.delete_operation,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)
rpc = self.transport._wrapped_methods[self._client._transport.delete_operation]

# Certain fields should be provided within the metadata header;
# add these here.
Expand Down Expand Up @@ -2631,11 +2619,7 @@ async def cancel_operation(

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.cancel_operation,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)
rpc = self.transport._wrapped_methods[self._client._transport.cancel_operation]

# Certain fields should be provided within the metadata header;
# add these here.
Expand Down
64 changes: 7 additions & 57 deletions google/cloud/pubsublite_v1/services/admin_service/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,36 +510,6 @@ def _get_universe_domain(
raise ValueError("Universe Domain cannot be an empty string.")
return universe_domain

@staticmethod
def _compare_universes(
client_universe: str, credentials: ga_credentials.Credentials
) -> bool:
"""Returns True iff the universe domains used by the client and credentials match.
Args:
client_universe (str): The universe domain configured via the client options.
credentials (ga_credentials.Credentials): The credentials being used in the client.
Returns:
bool: True iff client_universe matches the universe in credentials.
Raises:
ValueError: when client_universe does not match the universe in credentials.
"""

default_universe = AdminServiceClient._DEFAULT_UNIVERSE
credentials_universe = getattr(credentials, "universe_domain", default_universe)

if client_universe != credentials_universe:
raise ValueError(
"The configured universe domain "
f"({client_universe}) does not match the universe domain "
f"found in the credentials ({credentials_universe}). "
"If you haven't configured the universe domain explicitly, "
f"`{default_universe}` is the default."
)
return True

def _validate_universe_domain(self):
"""Validates client's and credentials' universe domains are consistent.
Expand All @@ -549,13 +519,9 @@ def _validate_universe_domain(self):
Raises:
ValueError: If the configured universe domain is not valid.
"""
self._is_universe_domain_valid = (
self._is_universe_domain_valid
or AdminServiceClient._compare_universes(
self.universe_domain, self.transport._credentials
)
)
return self._is_universe_domain_valid

# NOTE (b/349488459): universe validation is disabled until further notice.
return True

@property
def api_endpoint(self):
Expand Down Expand Up @@ -2874,11 +2840,7 @@ def list_operations(

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method.wrap_method(
self._transport.list_operations,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)
rpc = self._transport._wrapped_methods[self._transport.list_operations]

# Certain fields should be provided within the metadata header;
# add these here.
Expand Down Expand Up @@ -2931,11 +2893,7 @@ def get_operation(

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method.wrap_method(
self._transport.get_operation,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)
rpc = self._transport._wrapped_methods[self._transport.get_operation]

# Certain fields should be provided within the metadata header;
# add these here.
Expand Down Expand Up @@ -2992,11 +2950,7 @@ def delete_operation(

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method.wrap_method(
self._transport.delete_operation,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)
rpc = self._transport._wrapped_methods[self._transport.delete_operation]

# Certain fields should be provided within the metadata header;
# add these here.
Expand Down Expand Up @@ -3049,11 +3003,7 @@ def cancel_operation(

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method.wrap_method(
self._transport.cancel_operation,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)
rpc = self._transport._wrapped_methods[self._transport.cancel_operation]

# Certain fields should be provided within the metadata header;
# add these here.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

transport inheritance structure
_______________________________

`AdminServiceTransport` is the ABC for all transports.
- public child `AdminServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`).
- public child `AdminServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`).
- private child `_BaseAdminServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`).
- public child `AdminServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`).
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,26 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=None,
client_info=client_info,
),
self.cancel_operation: gapic_v1.method.wrap_method(
self.cancel_operation,
default_timeout=None,
client_info=client_info,
),
self.delete_operation: gapic_v1.method.wrap_method(
self.delete_operation,
default_timeout=None,
client_info=client_info,
),
self.get_operation: gapic_v1.method.wrap_method(
self.get_operation,
default_timeout=None,
client_info=client_info,
),
self.list_operations: gapic_v1.method.wrap_method(
self.list_operations,
default_timeout=None,
client_info=client_info,
),
}

def close(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import inspect
import warnings
from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union

Expand Down Expand Up @@ -234,6 +235,9 @@ def __init__(
)

# Wrap messages. This must be done after self._grpc_channel exists
self._wrap_with_kind = (
"kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
)
self._prep_wrapped_messages(client_info)

@property
Expand Down Expand Up @@ -798,106 +802,135 @@ def list_reservation_topics(
def _prep_wrapped_messages(self, client_info):
"""Precompute the wrapped methods, overriding the base class method to use async wrappers."""
self._wrapped_methods = {
self.create_topic: gapic_v1.method_async.wrap_method(
self.create_topic: self._wrap_method(
self.create_topic,
default_timeout=None,
client_info=client_info,
),
self.get_topic: gapic_v1.method_async.wrap_method(
self.get_topic: self._wrap_method(
self.get_topic,
default_timeout=None,
client_info=client_info,
),
self.get_topic_partitions: gapic_v1.method_async.wrap_method(
self.get_topic_partitions: self._wrap_method(
self.get_topic_partitions,
default_timeout=None,
client_info=client_info,
),
self.list_topics: gapic_v1.method_async.wrap_method(
self.list_topics: self._wrap_method(
self.list_topics,
default_timeout=None,
client_info=client_info,
),
self.update_topic: gapic_v1.method_async.wrap_method(
self.update_topic: self._wrap_method(
self.update_topic,
default_timeout=None,
client_info=client_info,
),
self.delete_topic: gapic_v1.method_async.wrap_method(
self.delete_topic: self._wrap_method(
self.delete_topic,
default_timeout=None,
client_info=client_info,
),
self.list_topic_subscriptions: gapic_v1.method_async.wrap_method(
self.list_topic_subscriptions: self._wrap_method(
self.list_topic_subscriptions,
default_timeout=None,
client_info=client_info,
),
self.create_subscription: gapic_v1.method_async.wrap_method(
self.create_subscription: self._wrap_method(
self.create_subscription,
default_timeout=None,
client_info=client_info,
),
self.get_subscription: gapic_v1.method_async.wrap_method(
self.get_subscription: self._wrap_method(
self.get_subscription,
default_timeout=None,
client_info=client_info,
),
self.list_subscriptions: gapic_v1.method_async.wrap_method(
self.list_subscriptions: self._wrap_method(
self.list_subscriptions,
default_timeout=None,
client_info=client_info,
),
self.update_subscription: gapic_v1.method_async.wrap_method(
self.update_subscription: self._wrap_method(
self.update_subscription,
default_timeout=None,
client_info=client_info,
),
self.delete_subscription: gapic_v1.method_async.wrap_method(
self.delete_subscription: self._wrap_method(
self.delete_subscription,
default_timeout=None,
client_info=client_info,
),
self.seek_subscription: gapic_v1.method_async.wrap_method(
self.seek_subscription: self._wrap_method(
self.seek_subscription,
default_timeout=None,
client_info=client_info,
),
self.create_reservation: gapic_v1.method_async.wrap_method(
self.create_reservation: self._wrap_method(
self.create_reservation,
default_timeout=None,
client_info=client_info,
),
self.get_reservation: gapic_v1.method_async.wrap_method(
self.get_reservation: self._wrap_method(
self.get_reservation,
default_timeout=None,
client_info=client_info,
),
self.list_reservations: gapic_v1.method_async.wrap_method(
self.list_reservations: self._wrap_method(
self.list_reservations,
default_timeout=None,
client_info=client_info,
),
self.update_reservation: gapic_v1.method_async.wrap_method(
self.update_reservation: self._wrap_method(
self.update_reservation,
default_timeout=None,
client_info=client_info,
),
self.delete_reservation: gapic_v1.method_async.wrap_method(
self.delete_reservation: self._wrap_method(
self.delete_reservation,
default_timeout=None,
client_info=client_info,
),
self.list_reservation_topics: gapic_v1.method_async.wrap_method(
self.list_reservation_topics: self._wrap_method(
self.list_reservation_topics,
default_timeout=None,
client_info=client_info,
),
self.cancel_operation: self._wrap_method(
self.cancel_operation,
default_timeout=None,
client_info=client_info,
),
self.delete_operation: self._wrap_method(
self.delete_operation,
default_timeout=None,
client_info=client_info,
),
self.get_operation: self._wrap_method(
self.get_operation,
default_timeout=None,
client_info=client_info,
),
self.list_operations: self._wrap_method(
self.list_operations,
default_timeout=None,
client_info=client_info,
),
}

def _wrap_method(self, func, *args, **kwargs):
if self._wrap_with_kind: # pragma: NO COVER
kwargs["kind"] = self.kind
return gapic_v1.method_async.wrap_method(func, *args, **kwargs)

def close(self):
return self.grpc_channel.close()

@property
def kind(self) -> str:
return "grpc_asyncio"

@property
def delete_operation(
self,
Expand Down
Loading

0 comments on commit 6273a5c

Please sign in to comment.