diff --git a/google/pubsub_v1/services/publisher/async_client.py b/google/pubsub_v1/services/publisher/async_client.py
index 930149071..308e0f629 100644
--- a/google/pubsub_v1/services/publisher/async_client.py
+++ b/google/pubsub_v1/services/publisher/async_client.py
@@ -248,7 +248,7 @@ async def create_topic(
A topic resource.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([name])
if request is not None and has_flattened_params:
@@ -393,7 +393,7 @@ async def publish(
Response for the Publish method.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([topic, messages])
if request is not None and has_flattened_params:
@@ -479,7 +479,7 @@ async def get_topic(
A topic resource.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([topic])
if request is not None and has_flattened_params:
@@ -563,7 +563,7 @@ async def list_topics(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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:
@@ -656,7 +656,7 @@ async def list_topic_subscriptions(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([topic])
if request is not None and has_flattened_params:
@@ -753,7 +753,7 @@ async def list_topic_snapshots(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([topic])
if request is not None and has_flattened_params:
@@ -841,7 +841,7 @@ async def delete_topic(
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([topic])
if request is not None and has_flattened_params:
diff --git a/google/pubsub_v1/services/publisher/client.py b/google/pubsub_v1/services/publisher/client.py
index 869200cf6..d445ddd14 100644
--- a/google/pubsub_v1/services/publisher/client.py
+++ b/google/pubsub_v1/services/publisher/client.py
@@ -497,7 +497,7 @@ def create_topic(
A topic resource.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([name])
if request is not None and has_flattened_params:
@@ -627,7 +627,7 @@ def publish(
Response for the Publish method.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([topic, messages])
if request is not None and has_flattened_params:
@@ -699,7 +699,7 @@ def get_topic(
A topic resource.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([topic])
if request is not None and has_flattened_params:
@@ -773,7 +773,7 @@ def list_topics(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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:
@@ -856,7 +856,7 @@ def list_topic_subscriptions(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([topic])
if request is not None and has_flattened_params:
@@ -943,7 +943,7 @@ def list_topic_snapshots(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([topic])
if request is not None and has_flattened_params:
@@ -1021,7 +1021,7 @@ def delete_topic(
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([topic])
if request is not None and has_flattened_params:
diff --git a/google/pubsub_v1/services/publisher/transports/grpc.py b/google/pubsub_v1/services/publisher/transports/grpc.py
index 2507d9742..ca63b4445 100644
--- a/google/pubsub_v1/services/publisher/transports/grpc.py
+++ b/google/pubsub_v1/services/publisher/transports/grpc.py
@@ -162,8 +162,11 @@ def __init__(
if not self._grpc_channel:
self._grpc_channel = type(self).create_channel(
self._host,
+ # use the credentials which are saved
credentials=self._credentials,
- credentials_file=credentials_file,
+ # Set ``credentials_file`` to ``None`` here as
+ # the credentials that we saved earlier should be used.
+ credentials_file=None,
scopes=self._scopes,
ssl_credentials=self._ssl_channel_credentials,
quota_project_id=quota_project_id,
diff --git a/google/pubsub_v1/services/publisher/transports/grpc_asyncio.py b/google/pubsub_v1/services/publisher/transports/grpc_asyncio.py
index 26677ad12..14bc0a15b 100644
--- a/google/pubsub_v1/services/publisher/transports/grpc_asyncio.py
+++ b/google/pubsub_v1/services/publisher/transports/grpc_asyncio.py
@@ -207,8 +207,11 @@ def __init__(
if not self._grpc_channel:
self._grpc_channel = type(self).create_channel(
self._host,
+ # use the credentials which are saved
credentials=self._credentials,
- credentials_file=credentials_file,
+ # Set ``credentials_file`` to ``None`` here as
+ # the credentials that we saved earlier should be used.
+ credentials_file=None,
scopes=self._scopes,
ssl_credentials=self._ssl_channel_credentials,
quota_project_id=quota_project_id,
diff --git a/google/pubsub_v1/services/schema_service/async_client.py b/google/pubsub_v1/services/schema_service/async_client.py
index a3cb75371..3ab7daf7c 100644
--- a/google/pubsub_v1/services/schema_service/async_client.py
+++ b/google/pubsub_v1/services/schema_service/async_client.py
@@ -260,7 +260,7 @@ async def create_schema(
A schema resource.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([parent, schema, schema_id])
if request is not None and has_flattened_params:
@@ -332,7 +332,7 @@ async def get_schema(
A schema resource.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([name])
if request is not None and has_flattened_params:
@@ -405,7 +405,7 @@ async def list_schemas(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([parent])
if request is not None and has_flattened_params:
@@ -476,7 +476,7 @@ async def delete_schema(
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([name])
if request is not None and has_flattened_params:
@@ -554,7 +554,7 @@ async def validate_schema(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([parent, schema])
if request is not None and has_flattened_params:
diff --git a/google/pubsub_v1/services/schema_service/client.py b/google/pubsub_v1/services/schema_service/client.py
index 832d7d8d1..0a3575f6a 100644
--- a/google/pubsub_v1/services/schema_service/client.py
+++ b/google/pubsub_v1/services/schema_service/client.py
@@ -452,7 +452,7 @@ def create_schema(
A schema resource.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([parent, schema, schema_id])
if request is not None and has_flattened_params:
@@ -524,7 +524,7 @@ def get_schema(
A schema resource.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([name])
if request is not None and has_flattened_params:
@@ -597,7 +597,7 @@ def list_schemas(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([parent])
if request is not None and has_flattened_params:
@@ -668,7 +668,7 @@ def delete_schema(
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([name])
if request is not None and has_flattened_params:
@@ -746,7 +746,7 @@ def validate_schema(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([parent, schema])
if request is not None and has_flattened_params:
diff --git a/google/pubsub_v1/services/schema_service/transports/grpc.py b/google/pubsub_v1/services/schema_service/transports/grpc.py
index 7313ec2dd..4f8863da9 100644
--- a/google/pubsub_v1/services/schema_service/transports/grpc.py
+++ b/google/pubsub_v1/services/schema_service/transports/grpc.py
@@ -162,8 +162,11 @@ def __init__(
if not self._grpc_channel:
self._grpc_channel = type(self).create_channel(
self._host,
+ # use the credentials which are saved
credentials=self._credentials,
- credentials_file=credentials_file,
+ # Set ``credentials_file`` to ``None`` here as
+ # the credentials that we saved earlier should be used.
+ credentials_file=None,
scopes=self._scopes,
ssl_credentials=self._ssl_channel_credentials,
quota_project_id=quota_project_id,
diff --git a/google/pubsub_v1/services/schema_service/transports/grpc_asyncio.py b/google/pubsub_v1/services/schema_service/transports/grpc_asyncio.py
index a542e066d..56450ac85 100644
--- a/google/pubsub_v1/services/schema_service/transports/grpc_asyncio.py
+++ b/google/pubsub_v1/services/schema_service/transports/grpc_asyncio.py
@@ -207,8 +207,11 @@ def __init__(
if not self._grpc_channel:
self._grpc_channel = type(self).create_channel(
self._host,
+ # use the credentials which are saved
credentials=self._credentials,
- credentials_file=credentials_file,
+ # Set ``credentials_file`` to ``None`` here as
+ # the credentials that we saved earlier should be used.
+ credentials_file=None,
scopes=self._scopes,
ssl_credentials=self._ssl_channel_credentials,
quota_project_id=quota_project_id,
diff --git a/google/pubsub_v1/services/subscriber/async_client.py b/google/pubsub_v1/services/subscriber/async_client.py
index 9e7d48f06..319915887 100644
--- a/google/pubsub_v1/services/subscriber/async_client.py
+++ b/google/pubsub_v1/services/subscriber/async_client.py
@@ -321,7 +321,7 @@ async def create_subscription(
A subscription resource.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([name, topic, push_config, ack_deadline_seconds])
if request is not None and has_flattened_params:
@@ -407,7 +407,7 @@ async def get_subscription(
A subscription resource.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([subscription])
if request is not None and has_flattened_params:
@@ -553,7 +553,7 @@ async def list_subscriptions(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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:
@@ -640,7 +640,7 @@ async def delete_subscription(
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([subscription])
if request is not None and has_flattened_params:
@@ -743,7 +743,7 @@ async def modify_ack_deadline(
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([subscription, ack_ids, ack_deadline_seconds])
if request is not None and has_flattened_params:
@@ -838,7 +838,7 @@ async def acknowledge(
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([subscription, ack_ids])
if request is not None and has_flattened_params:
@@ -947,7 +947,7 @@ async def pull(
Response for the Pull method.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([subscription, return_immediately, max_messages])
if request is not None and has_flattened_params:
@@ -1118,7 +1118,7 @@ async def modify_push_config(
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([subscription, push_config])
if request is not None and has_flattened_params:
@@ -1177,10 +1177,10 @@ async def get_snapshot(
) -> pubsub.Snapshot:
r"""Gets the configuration details of a snapshot.
Snapshots are used in Seek operations, which allow you to manage
- message acknowledgments in bulk. That is, you can set
- the acknowledgment state of messages in an existing
+ href="https://cloud.google.com/pubsub/docs/replay-overview">Seek
+ operations, which allow you to manage message
+ acknowledgments in bulk. That is, you can set the
+ acknowledgment state of messages in an existing
subscription to the state captured by a snapshot.
Args:
@@ -1210,7 +1210,7 @@ async def get_snapshot(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([snapshot])
if request is not None and has_flattened_params:
@@ -1298,7 +1298,7 @@ async def list_snapshots(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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:
@@ -1429,7 +1429,7 @@ async def create_snapshot(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([name, subscription])
if request is not None and has_flattened_params:
@@ -1485,8 +1485,9 @@ async def update_snapshot(
metadata: Sequence[Tuple[str, str]] = (),
) -> pubsub.Snapshot:
r"""Updates an existing snapshot. Snapshots are used in
- Seek operations, which allow
+ Seek
+ operations, which allow
you to manage message acknowledgments in bulk. That is,
you can set the acknowledgment state of messages in an
existing subscription to the state captured by a
@@ -1584,7 +1585,7 @@ async def delete_snapshot(
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([snapshot])
if request is not None and has_flattened_params:
diff --git a/google/pubsub_v1/services/subscriber/client.py b/google/pubsub_v1/services/subscriber/client.py
index d0320c7c4..2d2839b2a 100644
--- a/google/pubsub_v1/services/subscriber/client.py
+++ b/google/pubsub_v1/services/subscriber/client.py
@@ -560,7 +560,7 @@ def create_subscription(
A subscription resource.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([name, topic, push_config, ack_deadline_seconds])
if request is not None and has_flattened_params:
@@ -636,7 +636,7 @@ def get_subscription(
A subscription resource.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([subscription])
if request is not None and has_flattened_params:
@@ -765,7 +765,7 @@ def list_subscriptions(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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:
@@ -842,7 +842,7 @@ def delete_subscription(
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([subscription])
if request is not None and has_flattened_params:
@@ -937,7 +937,7 @@ def modify_ack_deadline(
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([subscription, ack_ids, ack_deadline_seconds])
if request is not None and has_flattened_params:
@@ -1024,7 +1024,7 @@ def acknowledge(
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([subscription, ack_ids])
if request is not None and has_flattened_params:
@@ -1125,7 +1125,7 @@ def pull(
Response for the Pull method.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([subscription, return_immediately, max_messages])
if request is not None and has_flattened_params:
@@ -1275,7 +1275,7 @@ def modify_push_config(
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([subscription, push_config])
if request is not None and has_flattened_params:
@@ -1325,10 +1325,10 @@ def get_snapshot(
) -> pubsub.Snapshot:
r"""Gets the configuration details of a snapshot.
Snapshots are used in Seek operations, which allow you to manage
- message acknowledgments in bulk. That is, you can set
- the acknowledgment state of messages in an existing
+ href="https://cloud.google.com/pubsub/docs/replay-overview">Seek
+ operations, which allow you to manage message
+ acknowledgments in bulk. That is, you can set the
+ acknowledgment state of messages in an existing
subscription to the state captured by a snapshot.
@@ -1359,7 +1359,7 @@ def get_snapshot(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([snapshot])
if request is not None and has_flattened_params:
@@ -1437,7 +1437,7 @@ def list_snapshots(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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:
@@ -1558,7 +1558,7 @@ def create_snapshot(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([name, subscription])
if request is not None and has_flattened_params:
@@ -1605,8 +1605,9 @@ def update_snapshot(
metadata: Sequence[Tuple[str, str]] = (),
) -> pubsub.Snapshot:
r"""Updates an existing snapshot. Snapshots are used in
- Seek operations, which allow
+ Seek
+ operations, which allow
you to manage message acknowledgments in bulk. That is,
you can set the acknowledgment state of messages in an
existing subscription to the state captured by a
@@ -1698,7 +1699,7 @@ def delete_snapshot(
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # 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([snapshot])
if request is not None and has_flattened_params:
diff --git a/google/pubsub_v1/services/subscriber/transports/grpc.py b/google/pubsub_v1/services/subscriber/transports/grpc.py
index f0472bdd0..b6ef6c6c4 100644
--- a/google/pubsub_v1/services/subscriber/transports/grpc.py
+++ b/google/pubsub_v1/services/subscriber/transports/grpc.py
@@ -164,8 +164,11 @@ def __init__(
if not self._grpc_channel:
self._grpc_channel = type(self).create_channel(
self._host,
+ # use the credentials which are saved
credentials=self._credentials,
- credentials_file=credentials_file,
+ # Set ``credentials_file`` to ``None`` here as
+ # the credentials that we saved earlier should be used.
+ credentials_file=None,
scopes=self._scopes,
ssl_credentials=self._ssl_channel_credentials,
quota_project_id=quota_project_id,
@@ -540,10 +543,10 @@ def get_snapshot(self) -> Callable[[pubsub.GetSnapshotRequest], pubsub.Snapshot]
Gets the configuration details of a snapshot.
Snapshots are used in Seek operations, which allow you to manage
- message acknowledgments in bulk. That is, you can set
- the acknowledgment state of messages in an existing
+ href="https://cloud.google.com/pubsub/docs/replay-overview">Seek
+ operations, which allow you to manage message
+ acknowledgments in bulk. That is, you can set the
+ acknowledgment state of messages in an existing
subscription to the state captured by a snapshot.
Returns:
@@ -645,8 +648,9 @@ def update_snapshot(
r"""Return a callable for the update snapshot method over gRPC.
Updates an existing snapshot. Snapshots are used in
- Seek operations, which allow
+ Seek
+ operations, which allow
you to manage message acknowledgments in bulk. That is,
you can set the acknowledgment state of messages in an
existing subscription to the state captured by a
diff --git a/google/pubsub_v1/services/subscriber/transports/grpc_asyncio.py b/google/pubsub_v1/services/subscriber/transports/grpc_asyncio.py
index 9a4b45224..9e3e71212 100644
--- a/google/pubsub_v1/services/subscriber/transports/grpc_asyncio.py
+++ b/google/pubsub_v1/services/subscriber/transports/grpc_asyncio.py
@@ -209,8 +209,11 @@ def __init__(
if not self._grpc_channel:
self._grpc_channel = type(self).create_channel(
self._host,
+ # use the credentials which are saved
credentials=self._credentials,
- credentials_file=credentials_file,
+ # Set ``credentials_file`` to ``None`` here as
+ # the credentials that we saved earlier should be used.
+ credentials_file=None,
scopes=self._scopes,
ssl_credentials=self._ssl_channel_credentials,
quota_project_id=quota_project_id,
@@ -550,10 +553,10 @@ def get_snapshot(
Gets the configuration details of a snapshot.
Snapshots are used in Seek operations, which allow you to manage
- message acknowledgments in bulk. That is, you can set
- the acknowledgment state of messages in an existing
+ href="https://cloud.google.com/pubsub/docs/replay-overview">Seek
+ operations, which allow you to manage message
+ acknowledgments in bulk. That is, you can set the
+ acknowledgment state of messages in an existing
subscription to the state captured by a snapshot.
Returns:
@@ -657,8 +660,9 @@ def update_snapshot(
r"""Return a callable for the update snapshot method over gRPC.
Updates an existing snapshot. Snapshots are used in
- Seek operations, which allow
+ Seek
+ operations, which allow
you to manage message acknowledgments in bulk. That is,
you can set the acknowledgment state of messages in an
existing subscription to the state captured by a
diff --git a/tests/unit/gapic/pubsub_v1/test_publisher.py b/tests/unit/gapic/pubsub_v1/test_publisher.py
index c0253371a..ab9947d7a 100644
--- a/tests/unit/gapic/pubsub_v1/test_publisher.py
+++ b/tests/unit/gapic/pubsub_v1/test_publisher.py
@@ -496,21 +496,23 @@ def test_publisher_client_client_options_scopes(
@pytest.mark.parametrize(
- "client_class,transport_class,transport_name",
+ "client_class,transport_class,transport_name,grpc_helpers",
[
- (PublisherClient, transports.PublisherGrpcTransport, "grpc"),
+ (PublisherClient, transports.PublisherGrpcTransport, "grpc", grpc_helpers),
(
PublisherAsyncClient,
transports.PublisherGrpcAsyncIOTransport,
"grpc_asyncio",
+ grpc_helpers_async,
),
],
)
def test_publisher_client_client_options_credentials_file(
- client_class, transport_class, transport_name
+ client_class, transport_class, transport_name, grpc_helpers
):
# Check the case credentials file is provided.
options = client_options.ClientOptions(credentials_file="credentials.json")
+
with mock.patch.object(transport_class, "__init__") as patched:
patched.return_value = None
client = client_class(client_options=options, transport=transport_name)
@@ -544,6 +546,71 @@ def test_publisher_client_client_options_from_dict():
)
+@pytest.mark.parametrize(
+ "client_class,transport_class,transport_name,grpc_helpers",
+ [
+ (PublisherClient, transports.PublisherGrpcTransport, "grpc", grpc_helpers),
+ (
+ PublisherAsyncClient,
+ transports.PublisherGrpcAsyncIOTransport,
+ "grpc_asyncio",
+ grpc_helpers_async,
+ ),
+ ],
+)
+def test_publisher_client_create_channel_credentials_file(
+ client_class, transport_class, transport_name, grpc_helpers
+):
+ # Check the case credentials file is provided.
+ options = client_options.ClientOptions(credentials_file="credentials.json")
+
+ with mock.patch.object(transport_class, "__init__") as patched:
+ patched.return_value = None
+ client = client_class(client_options=options, transport=transport_name)
+ patched.assert_called_once_with(
+ credentials=None,
+ credentials_file="credentials.json",
+ host=client.DEFAULT_ENDPOINT,
+ scopes=None,
+ client_cert_source_for_mtls=None,
+ quota_project_id=None,
+ client_info=transports.base.DEFAULT_CLIENT_INFO,
+ always_use_jwt_access=True,
+ )
+
+ # test that the credentials from file are saved and used as the credentials.
+ with mock.patch.object(
+ google.auth, "load_credentials_from_file", autospec=True
+ ) as load_creds, mock.patch.object(
+ google.auth, "default", autospec=True
+ ) as adc, mock.patch.object(
+ grpc_helpers, "create_channel"
+ ) as create_channel:
+ creds = ga_credentials.AnonymousCredentials()
+ file_creds = ga_credentials.AnonymousCredentials()
+ load_creds.return_value = (file_creds, None)
+ adc.return_value = (creds, None)
+ client = client_class(client_options=options, transport=transport_name)
+ create_channel.assert_called_with(
+ "pubsub.googleapis.com:443",
+ credentials=file_creds,
+ credentials_file=None,
+ quota_project_id=None,
+ default_scopes=(
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/pubsub",
+ ),
+ scopes=None,
+ default_host="pubsub.googleapis.com",
+ ssl_credentials=None,
+ options=[
+ ("grpc.max_send_message_length", -1),
+ ("grpc.max_receive_message_length", -1),
+ ("grpc.keepalive_time_ms", 30000),
+ ],
+ )
+
+
@pytest.mark.parametrize("request_type", [pubsub.Topic, dict,])
def test_create_topic(request_type, transport: str = "grpc"):
client = PublisherClient(
diff --git a/tests/unit/gapic/pubsub_v1/test_schema_service.py b/tests/unit/gapic/pubsub_v1/test_schema_service.py
index 6088af71e..fc2090743 100644
--- a/tests/unit/gapic/pubsub_v1/test_schema_service.py
+++ b/tests/unit/gapic/pubsub_v1/test_schema_service.py
@@ -512,21 +512,28 @@ def test_schema_service_client_client_options_scopes(
@pytest.mark.parametrize(
- "client_class,transport_class,transport_name",
+ "client_class,transport_class,transport_name,grpc_helpers",
[
- (SchemaServiceClient, transports.SchemaServiceGrpcTransport, "grpc"),
+ (
+ SchemaServiceClient,
+ transports.SchemaServiceGrpcTransport,
+ "grpc",
+ grpc_helpers,
+ ),
(
SchemaServiceAsyncClient,
transports.SchemaServiceGrpcAsyncIOTransport,
"grpc_asyncio",
+ grpc_helpers_async,
),
],
)
def test_schema_service_client_client_options_credentials_file(
- client_class, transport_class, transport_name
+ client_class, transport_class, transport_name, grpc_helpers
):
# Check the case credentials file is provided.
options = client_options.ClientOptions(credentials_file="credentials.json")
+
with mock.patch.object(transport_class, "__init__") as patched:
patched.return_value = None
client = client_class(client_options=options, transport=transport_name)
@@ -562,6 +569,76 @@ def test_schema_service_client_client_options_from_dict():
)
+@pytest.mark.parametrize(
+ "client_class,transport_class,transport_name,grpc_helpers",
+ [
+ (
+ SchemaServiceClient,
+ transports.SchemaServiceGrpcTransport,
+ "grpc",
+ grpc_helpers,
+ ),
+ (
+ SchemaServiceAsyncClient,
+ transports.SchemaServiceGrpcAsyncIOTransport,
+ "grpc_asyncio",
+ grpc_helpers_async,
+ ),
+ ],
+)
+def test_schema_service_client_create_channel_credentials_file(
+ client_class, transport_class, transport_name, grpc_helpers
+):
+ # Check the case credentials file is provided.
+ options = client_options.ClientOptions(credentials_file="credentials.json")
+
+ with mock.patch.object(transport_class, "__init__") as patched:
+ patched.return_value = None
+ client = client_class(client_options=options, transport=transport_name)
+ patched.assert_called_once_with(
+ credentials=None,
+ credentials_file="credentials.json",
+ host=client.DEFAULT_ENDPOINT,
+ scopes=None,
+ client_cert_source_for_mtls=None,
+ quota_project_id=None,
+ client_info=transports.base.DEFAULT_CLIENT_INFO,
+ always_use_jwt_access=True,
+ )
+
+ # test that the credentials from file are saved and used as the credentials.
+ with mock.patch.object(
+ google.auth, "load_credentials_from_file", autospec=True
+ ) as load_creds, mock.patch.object(
+ google.auth, "default", autospec=True
+ ) as adc, mock.patch.object(
+ grpc_helpers, "create_channel"
+ ) as create_channel:
+ creds = ga_credentials.AnonymousCredentials()
+ file_creds = ga_credentials.AnonymousCredentials()
+ load_creds.return_value = (file_creds, None)
+ adc.return_value = (creds, None)
+ client = client_class(client_options=options, transport=transport_name)
+ create_channel.assert_called_with(
+ "pubsub.googleapis.com:443",
+ credentials=file_creds,
+ credentials_file=None,
+ quota_project_id=None,
+ default_scopes=(
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/pubsub",
+ ),
+ scopes=None,
+ default_host="pubsub.googleapis.com",
+ ssl_credentials=None,
+ options=[
+ ("grpc.max_send_message_length", -1),
+ ("grpc.max_receive_message_length", -1),
+ ("grpc.keepalive_time_ms", 30000),
+ ],
+ )
+
+
@pytest.mark.parametrize("request_type", [gp_schema.CreateSchemaRequest, dict,])
def test_create_schema(request_type, transport: str = "grpc"):
client = SchemaServiceClient(
diff --git a/tests/unit/gapic/pubsub_v1/test_subscriber.py b/tests/unit/gapic/pubsub_v1/test_subscriber.py
index 9f6ebd6c3..37a208c34 100644
--- a/tests/unit/gapic/pubsub_v1/test_subscriber.py
+++ b/tests/unit/gapic/pubsub_v1/test_subscriber.py
@@ -500,21 +500,23 @@ def test_subscriber_client_client_options_scopes(
@pytest.mark.parametrize(
- "client_class,transport_class,transport_name",
+ "client_class,transport_class,transport_name,grpc_helpers",
[
- (SubscriberClient, transports.SubscriberGrpcTransport, "grpc"),
+ (SubscriberClient, transports.SubscriberGrpcTransport, "grpc", grpc_helpers),
(
SubscriberAsyncClient,
transports.SubscriberGrpcAsyncIOTransport,
"grpc_asyncio",
+ grpc_helpers_async,
),
],
)
def test_subscriber_client_client_options_credentials_file(
- client_class, transport_class, transport_name
+ client_class, transport_class, transport_name, grpc_helpers
):
# Check the case credentials file is provided.
options = client_options.ClientOptions(credentials_file="credentials.json")
+
with mock.patch.object(transport_class, "__init__") as patched:
patched.return_value = None
client = client_class(client_options=options, transport=transport_name)
@@ -548,6 +550,71 @@ def test_subscriber_client_client_options_from_dict():
)
+@pytest.mark.parametrize(
+ "client_class,transport_class,transport_name,grpc_helpers",
+ [
+ (SubscriberClient, transports.SubscriberGrpcTransport, "grpc", grpc_helpers),
+ (
+ SubscriberAsyncClient,
+ transports.SubscriberGrpcAsyncIOTransport,
+ "grpc_asyncio",
+ grpc_helpers_async,
+ ),
+ ],
+)
+def test_subscriber_client_create_channel_credentials_file(
+ client_class, transport_class, transport_name, grpc_helpers
+):
+ # Check the case credentials file is provided.
+ options = client_options.ClientOptions(credentials_file="credentials.json")
+
+ with mock.patch.object(transport_class, "__init__") as patched:
+ patched.return_value = None
+ client = client_class(client_options=options, transport=transport_name)
+ patched.assert_called_once_with(
+ credentials=None,
+ credentials_file="credentials.json",
+ host=client.DEFAULT_ENDPOINT,
+ scopes=None,
+ client_cert_source_for_mtls=None,
+ quota_project_id=None,
+ client_info=transports.base.DEFAULT_CLIENT_INFO,
+ always_use_jwt_access=True,
+ )
+
+ # test that the credentials from file are saved and used as the credentials.
+ with mock.patch.object(
+ google.auth, "load_credentials_from_file", autospec=True
+ ) as load_creds, mock.patch.object(
+ google.auth, "default", autospec=True
+ ) as adc, mock.patch.object(
+ grpc_helpers, "create_channel"
+ ) as create_channel:
+ creds = ga_credentials.AnonymousCredentials()
+ file_creds = ga_credentials.AnonymousCredentials()
+ load_creds.return_value = (file_creds, None)
+ adc.return_value = (creds, None)
+ client = client_class(client_options=options, transport=transport_name)
+ create_channel.assert_called_with(
+ "pubsub.googleapis.com:443",
+ credentials=file_creds,
+ credentials_file=None,
+ quota_project_id=None,
+ default_scopes=(
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/pubsub",
+ ),
+ scopes=None,
+ default_host="pubsub.googleapis.com",
+ ssl_credentials=None,
+ options=[
+ ("grpc.max_send_message_length", -1),
+ ("grpc.max_receive_message_length", -1),
+ ("grpc.keepalive_time_ms", 30000),
+ ],
+ )
+
+
@pytest.mark.parametrize("request_type", [pubsub.Subscription, dict,])
def test_create_subscription(request_type, transport: str = "grpc"):
client = SubscriberClient(