Skip to content

Commit d56ad12

Browse files
gcf-owl-bot[bot]mukund-ananthuparthea
authored
fix(diregapic): s/bazel/bazelisk/ in DIREGAPIC build GitHub action (#1064)
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: mukund-ananthu <[email protected]> Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent aa40c4b commit d56ad12

File tree

31 files changed

+3112
-608
lines changed

31 files changed

+3112
-608
lines changed

google/cloud/pubsub_v1/publisher/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ def on_publish_done(future):
399399
transport = self._transport
400400
base_retry = transport._wrapped_methods[transport.publish]._retry
401401
retry = base_retry.with_deadline(2.0**32)
402-
else:
402+
elif retry is not None:
403403
retry = retry.with_deadline(2.0**32)
404404

405405
# Delegate the publishing to the sequencer.

google/pubsub/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
from google.pubsub_v1.types.pubsub import GetSnapshotRequest
4242
from google.pubsub_v1.types.pubsub import GetSubscriptionRequest
4343
from google.pubsub_v1.types.pubsub import GetTopicRequest
44+
from google.pubsub_v1.types.pubsub import IngestionDataSourceSettings
4445
from google.pubsub_v1.types.pubsub import ListSnapshotsRequest
4546
from google.pubsub_v1.types.pubsub import ListSnapshotsResponse
4647
from google.pubsub_v1.types.pubsub import ListSubscriptionsRequest
@@ -112,6 +113,7 @@
112113
"GetSnapshotRequest",
113114
"GetSubscriptionRequest",
114115
"GetTopicRequest",
116+
"IngestionDataSourceSettings",
115117
"ListSnapshotsRequest",
116118
"ListSnapshotsResponse",
117119
"ListSubscriptionsRequest",

google/pubsub_v1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
from .types.pubsub import GetSnapshotRequest
4040
from .types.pubsub import GetSubscriptionRequest
4141
from .types.pubsub import GetTopicRequest
42+
from .types.pubsub import IngestionDataSourceSettings
4243
from .types.pubsub import ListSnapshotsRequest
4344
from .types.pubsub import ListSnapshotsResponse
4445
from .types.pubsub import ListSubscriptionsRequest
@@ -113,6 +114,7 @@
113114
"GetSnapshotRequest",
114115
"GetSubscriptionRequest",
115116
"GetTopicRequest",
117+
"IngestionDataSourceSettings",
116118
"ListSchemaRevisionsRequest",
117119
"ListSchemaRevisionsResponse",
118120
"ListSchemasRequest",

google/pubsub_v1/services/publisher/async_client.py

Lines changed: 91 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
from google.oauth2 import service_account # type: ignore
3939

4040
try:
41-
OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault]
41+
OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
4242
except AttributeError: # pragma: NO COVER
43-
OptionalRetry = Union[retries.AsyncRetry, object] # type: ignore
43+
OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
4444

4545
from google.iam.v1 import iam_policy_pb2 # type: ignore
4646
from google.iam.v1 import policy_pb2 # type: ignore
@@ -61,8 +61,12 @@ class PublisherAsyncClient:
6161

6262
_client: PublisherClient
6363

64+
# Copy defaults from the synchronous client for use here.
65+
# Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
6466
DEFAULT_ENDPOINT = PublisherClient.DEFAULT_ENDPOINT
6567
DEFAULT_MTLS_ENDPOINT = PublisherClient.DEFAULT_MTLS_ENDPOINT
68+
_DEFAULT_ENDPOINT_TEMPLATE = PublisherClient._DEFAULT_ENDPOINT_TEMPLATE
69+
_DEFAULT_UNIVERSE = PublisherClient._DEFAULT_UNIVERSE
6670

6771
schema_path = staticmethod(PublisherClient.schema_path)
6872
parse_schema_path = staticmethod(PublisherClient.parse_schema_path)
@@ -167,6 +171,25 @@ def transport(self) -> PublisherTransport:
167171
"""
168172
return self._client.transport
169173

174+
@property
175+
def api_endpoint(self):
176+
"""Return the API endpoint used by the client instance.
177+
178+
Returns:
179+
str: The API endpoint used by the client instance.
180+
"""
181+
return self._client._api_endpoint
182+
183+
@property
184+
def universe_domain(self) -> str:
185+
"""Return the universe domain used by the client instance.
186+
187+
Returns:
188+
str: The universe domain used
189+
by the client instance.
190+
"""
191+
return self._client._universe_domain
192+
170193
get_transport_class = functools.partial(
171194
type(PublisherClient).get_transport_class, type(PublisherClient)
172195
)
@@ -179,7 +202,7 @@ def __init__(
179202
client_options: Optional[ClientOptions] = None,
180203
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
181204
) -> None:
182-
"""Instantiates the publisher client.
205+
"""Instantiates the publisher async client.
183206
184207
Args:
185208
credentials (Optional[google.auth.credentials.Credentials]): The
@@ -190,23 +213,38 @@ def __init__(
190213
transport (Union[str, ~.PublisherTransport]): The
191214
transport to use. If set to None, a transport is chosen
192215
automatically.
193-
client_options (ClientOptions): Custom options for the client. It
194-
won't take effect if a ``transport`` instance is provided.
195-
(1) The ``api_endpoint`` property can be used to override the
196-
default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT
197-
environment variable can also be used to override the endpoint:
216+
client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
217+
Custom options for the client.
218+
219+
1. The ``api_endpoint`` property can be used to override the
220+
default endpoint provided by the client when ``transport`` is
221+
not explicitly provided. Only if this property is not set and
222+
``transport`` was not explicitly provided, the endpoint is
223+
determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
224+
variable, which have one of the following values:
198225
"always" (always use the default mTLS endpoint), "never" (always
199-
use the default regular endpoint) and "auto" (auto switch to the
200-
default mTLS endpoint if client certificate is present, this is
201-
the default value). However, the ``api_endpoint`` property takes
202-
precedence if provided.
203-
(2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
226+
use the default regular endpoint) and "auto" (auto-switch to the
227+
default mTLS endpoint if client certificate is present; this is
228+
the default value).
229+
230+
2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
204231
is "true", then the ``client_cert_source`` property can be used
205-
to provide client certificate for mutual TLS transport. If
232+
to provide a client certificate for mTLS transport. If
206233
not provided, the default SSL client certificate will be used if
207234
present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
208235
set, no client certificate will be used.
209236
237+
3. The ``universe_domain`` property can be used to override the
238+
default "googleapis.com" universe. Note that ``api_endpoint``
239+
property still takes precedence; and ``universe_domain`` is
240+
currently not supported for mTLS.
241+
242+
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
243+
The client info used to send a user-agent string along with
244+
API requests. If ``None``, then default info will be used.
245+
Generally, you only need to set this if you're developing
246+
your own client library.
247+
210248
Raises:
211249
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
212250
creation failed for any reason.
@@ -324,6 +362,9 @@ async def sample_create_topic():
324362
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
325363
)
326364

365+
# Validate the universe domain.
366+
self._client._validate_universe_domain()
367+
327368
# Send the request.
328369
response = await rpc(
329370
request,
@@ -345,7 +386,8 @@ async def update_topic(
345386
timeout: TimeoutType = gapic_v1.method.DEFAULT,
346387
metadata: Sequence[Tuple[str, str]] = (),
347388
) -> pubsub.Topic:
348-
r"""Updates an existing topic. Note that certain
389+
r"""Updates an existing topic by updating the fields
390+
specified in the update mask. Note that certain
349391
properties of a topic are not modifiable.
350392
351393
.. code-block:: python
@@ -452,6 +494,9 @@ async def sample_update_topic():
452494
),
453495
)
454496

497+
# Validate the universe domain.
498+
self._client._validate_universe_domain()
499+
455500
# Send the request.
456501
response = await rpc(
457502
request,
@@ -555,7 +600,7 @@ async def sample_publish():
555600
default_retry=retries.AsyncRetry(
556601
initial=0.1,
557602
maximum=60.0,
558-
multiplier=4.0,
603+
multiplier=4,
559604
predicate=retries.if_exception_type(
560605
core_exceptions.Aborted,
561606
core_exceptions.Cancelled,
@@ -577,6 +622,9 @@ async def sample_publish():
577622
gapic_v1.routing_header.to_grpc_metadata((("topic", request.topic),)),
578623
)
579624

625+
# Validate the universe domain.
626+
self._client._validate_universe_domain()
627+
580628
# Send the request.
581629
response = await rpc(
582630
request,
@@ -688,6 +736,9 @@ async def sample_get_topic():
688736
gapic_v1.routing_header.to_grpc_metadata((("topic", request.topic),)),
689737
)
690738

739+
# Validate the universe domain.
740+
self._client._validate_universe_domain()
741+
691742
# Send the request.
692743
response = await rpc(
693744
request,
@@ -804,6 +855,9 @@ async def sample_list_topics():
804855
gapic_v1.routing_header.to_grpc_metadata((("project", request.project),)),
805856
)
806857

858+
# Validate the universe domain.
859+
self._client._validate_universe_domain()
860+
807861
# Send the request.
808862
response = await rpc(
809863
request,
@@ -931,6 +985,9 @@ async def sample_list_topic_subscriptions():
931985
gapic_v1.routing_header.to_grpc_metadata((("topic", request.topic),)),
932986
)
933987

988+
# Validate the universe domain.
989+
self._client._validate_universe_domain()
990+
934991
# Send the request.
935992
response = await rpc(
936993
request,
@@ -1062,6 +1119,9 @@ async def sample_list_topic_snapshots():
10621119
gapic_v1.routing_header.to_grpc_metadata((("topic", request.topic),)),
10631120
)
10641121

1122+
# Validate the universe domain.
1123+
self._client._validate_universe_domain()
1124+
10651125
# Send the request.
10661126
response = await rpc(
10671127
request,
@@ -1178,6 +1238,9 @@ async def sample_delete_topic():
11781238
gapic_v1.routing_header.to_grpc_metadata((("topic", request.topic),)),
11791239
)
11801240

1241+
# Validate the universe domain.
1242+
self._client._validate_universe_domain()
1243+
11811244
# Send the request.
11821245
await rpc(
11831246
request,
@@ -1271,6 +1334,9 @@ async def sample_detach_subscription():
12711334
),
12721335
)
12731336

1337+
# Validate the universe domain.
1338+
self._client._validate_universe_domain()
1339+
12741340
# Send the request.
12751341
response = await rpc(
12761342
request,
@@ -1391,6 +1457,9 @@ async def set_iam_policy(
13911457
gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
13921458
)
13931459

1460+
# Validate the universe domain.
1461+
self._client._validate_universe_domain()
1462+
13941463
# Send the request.
13951464
response = await rpc(
13961465
request,
@@ -1513,6 +1582,9 @@ async def get_iam_policy(
15131582
gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
15141583
)
15151584

1585+
# Validate the universe domain.
1586+
self._client._validate_universe_domain()
1587+
15161588
# Send the request.
15171589
response = await rpc(
15181590
request,
@@ -1573,6 +1645,9 @@ async def test_iam_permissions(
15731645
gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
15741646
)
15751647

1648+
# Validate the universe domain.
1649+
self._client._validate_universe_domain()
1650+
15761651
# Send the request.
15771652
response = await rpc(
15781653
request,

0 commit comments

Comments
 (0)