Skip to content

Commit 8418ef6

Browse files
feat: update BigQuery Analytics Hub API v1beta1 client (#32)
- [ ] Regenerate this pull request now. refresh current dataexchange/v1beta1/* directory to include recent change in protos. fix: refactor references to Category message docs: improve proto documentation. PiperOrigin-RevId: 471349319 Source-Link: googleapis/googleapis@8495024 Source-Link: googleapis/googleapis-gen@2d8c38b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmQ4YzM4YjkwYTVhMTk4ZDcxZWIxYThlYjQzZTBjZTU2MTI3YWMwZCJ9
1 parent c91eb79 commit 8418ef6

File tree

8 files changed

+1039
-362
lines changed

8 files changed

+1039
-362
lines changed

packages/google-cloud-bigquery-data-exchange/.coveragerc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ branch = True
44
[report]
55
show_missing = True
66
omit =
7-
google/cloud/bigquery_data_exchange/common/__init__.py
7+
google/cloud/bigquery_data_exchange/__init__.py
88
exclude_lines =
99
# Re-enable the standard pragma
1010
pragma: NO COVER

packages/google-cloud-bigquery-data-exchange/google/cloud/bigquery_data_exchange_v1beta1/services/analytics_hub_service/async_client.py

Lines changed: 196 additions & 82 deletions
Large diffs are not rendered by default.

packages/google-cloud-bigquery-data-exchange/google/cloud/bigquery_data_exchange_v1beta1/services/analytics_hub_service/client.py

Lines changed: 196 additions & 82 deletions
Large diffs are not rendered by default.

packages/google-cloud-bigquery-data-exchange/google/cloud/bigquery_data_exchange_v1beta1/services/analytics_hub_service/transports/base.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from google.oauth2 import service_account # type: ignore
2727

2828
from google.cloud.bigquery_data_exchange_v1beta1.types import dataexchange
29+
from google.cloud.location import locations_pb2 # type: ignore
2930
from google.iam.v1 import iam_policy_pb2 # type: ignore
3031
from google.iam.v1 import policy_pb2 # type: ignore
3132
from google.protobuf import empty_pb2 # type: ignore
@@ -369,6 +370,27 @@ def test_iam_permissions(
369370
]:
370371
raise NotImplementedError()
371372

373+
@property
374+
def get_location(
375+
self,
376+
) -> Callable[
377+
[locations_pb2.GetLocationRequest],
378+
Union[locations_pb2.Location, Awaitable[locations_pb2.Location]],
379+
]:
380+
raise NotImplementedError()
381+
382+
@property
383+
def list_locations(
384+
self,
385+
) -> Callable[
386+
[locations_pb2.ListLocationsRequest],
387+
Union[
388+
locations_pb2.ListLocationsResponse,
389+
Awaitable[locations_pb2.ListLocationsResponse],
390+
],
391+
]:
392+
raise NotImplementedError()
393+
372394
@property
373395
def kind(self) -> str:
374396
raise NotImplementedError()

packages/google-cloud-bigquery-data-exchange/google/cloud/bigquery_data_exchange_v1beta1/services/analytics_hub_service/transports/grpc.py

Lines changed: 65 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import grpc # type: ignore
2626

2727
from google.cloud.bigquery_data_exchange_v1beta1.types import dataexchange
28+
from google.cloud.location import locations_pb2 # type: ignore
2829
from google.iam.v1 import iam_policy_pb2 # type: ignore
2930
from google.iam.v1 import policy_pb2 # type: ignore
3031
from google.protobuf import empty_pb2 # type: ignore
@@ -34,12 +35,13 @@
3435
class AnalyticsHubServiceGrpcTransport(AnalyticsHubServiceTransport):
3536
"""gRPC backend transport for AnalyticsHubService.
3637
37-
The AnalyticsHubService API facilitates data sharing within
38-
and across organizations. It allows data providers to publish
39-
Listings --- a discoverable and searchable SKU representing a
40-
dataset. Data consumers can subscribe to Listings. Upon
41-
subscription, AnalyticsHub provisions a "Linked Datasets"
42-
surfacing the data in the consumer's project.
38+
The ``AnalyticsHubService`` API facilitates data sharing within and
39+
across organizations. It allows data providers to publish listings
40+
that reference shared datasets. With Analytics Hub, users can
41+
discover and search for listings that they have access to.
42+
Subscribers can view and subscribe to listings. When you subscribe
43+
to a listing, Analytics Hub creates a linked dataset in your
44+
project.
4345
4446
This class defines the same methods as the primary client, so the
4547
primary client can load the underlying transport implementation
@@ -245,7 +247,8 @@ def list_data_exchanges(
245247
]:
246248
r"""Return a callable for the list data exchanges method over gRPC.
247249
248-
Lists DataExchanges in a given project and location.
250+
Lists all data exchanges in a given project and
251+
location.
249252
250253
Returns:
251254
Callable[[~.ListDataExchangesRequest],
@@ -274,7 +277,7 @@ def list_org_data_exchanges(
274277
]:
275278
r"""Return a callable for the list org data exchanges method over gRPC.
276279
277-
Lists DataExchanges from projects in a given
280+
Lists all data exchanges from projects in a given
278281
organization and location.
279282
280283
Returns:
@@ -301,7 +304,7 @@ def get_data_exchange(
301304
) -> Callable[[dataexchange.GetDataExchangeRequest], dataexchange.DataExchange]:
302305
r"""Return a callable for the get data exchange method over gRPC.
303306
304-
Gets details of a single DataExchange.
307+
Gets the details of a data exchange.
305308
306309
Returns:
307310
Callable[[~.GetDataExchangeRequest],
@@ -327,8 +330,7 @@ def create_data_exchange(
327330
) -> Callable[[dataexchange.CreateDataExchangeRequest], dataexchange.DataExchange]:
328331
r"""Return a callable for the create data exchange method over gRPC.
329332
330-
Creates a new DataExchange in a given project and
331-
location.
333+
Creates a new data exchange.
332334
333335
Returns:
334336
Callable[[~.CreateDataExchangeRequest],
@@ -354,7 +356,7 @@ def update_data_exchange(
354356
) -> Callable[[dataexchange.UpdateDataExchangeRequest], dataexchange.DataExchange]:
355357
r"""Return a callable for the update data exchange method over gRPC.
356358
357-
Updates the parameters of a single DataExchange.
359+
Updates an existing data exchange.
358360
359361
Returns:
360362
Callable[[~.UpdateDataExchangeRequest],
@@ -380,7 +382,7 @@ def delete_data_exchange(
380382
) -> Callable[[dataexchange.DeleteDataExchangeRequest], empty_pb2.Empty]:
381383
r"""Return a callable for the delete data exchange method over gRPC.
382384
383-
Deletes a single DataExchange.
385+
Deletes an existing data exchange.
384386
385387
Returns:
386388
Callable[[~.DeleteDataExchangeRequest],
@@ -408,7 +410,7 @@ def list_listings(
408410
]:
409411
r"""Return a callable for the list listings method over gRPC.
410412
411-
Lists Listings in a given project and location.
413+
Lists all listings in a given project and location.
412414
413415
Returns:
414416
Callable[[~.ListListingsRequest],
@@ -434,7 +436,7 @@ def get_listing(
434436
) -> Callable[[dataexchange.GetListingRequest], dataexchange.Listing]:
435437
r"""Return a callable for the get listing method over gRPC.
436438
437-
Gets details of a single Listing.
439+
Gets the details of a listing.
438440
439441
Returns:
440442
Callable[[~.GetListingRequest],
@@ -460,8 +462,7 @@ def create_listing(
460462
) -> Callable[[dataexchange.CreateListingRequest], dataexchange.Listing]:
461463
r"""Return a callable for the create listing method over gRPC.
462464
463-
Creates a new Listing in a given project and
464-
location.
465+
Creates a new listing.
465466
466467
Returns:
467468
Callable[[~.CreateListingRequest],
@@ -487,7 +488,7 @@ def update_listing(
487488
) -> Callable[[dataexchange.UpdateListingRequest], dataexchange.Listing]:
488489
r"""Return a callable for the update listing method over gRPC.
489490
490-
Updates the parameters of a single Listing.
491+
Updates an existing listing.
491492
492493
Returns:
493494
Callable[[~.UpdateListingRequest],
@@ -513,9 +514,7 @@ def delete_listing(
513514
) -> Callable[[dataexchange.DeleteListingRequest], empty_pb2.Empty]:
514515
r"""Return a callable for the delete listing method over gRPC.
515516
516-
Deletes a single Listing, as long as there are no
517-
subscriptions associated with the source of this
518-
Listing.
517+
Deletes a listing.
519518
520519
Returns:
521520
Callable[[~.DeleteListingRequest],
@@ -543,11 +542,12 @@ def subscribe_listing(
543542
]:
544543
r"""Return a callable for the subscribe listing method over gRPC.
545544
546-
Subscribes to a single Listing.
547-
Data Exchange currently supports one type of Listing: a
548-
BigQuery dataset. Upon subscription to a Listing for a
549-
BigQuery dataset, Data Exchange creates a linked dataset
550-
in the subscriber's project.
545+
Subscribes to a listing.
546+
Currently, with Analytics Hub, you can create listings
547+
that reference only BigQuery datasets.
548+
Upon subscription to a listing for a BigQuery dataset,
549+
Analytics Hub creates a linked dataset in the
550+
subscriber's project.
551551
552552
Returns:
553553
Callable[[~.SubscribeListingRequest],
@@ -573,7 +573,7 @@ def get_iam_policy(
573573
) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]:
574574
r"""Return a callable for the get iam policy method over gRPC.
575575
576-
Gets the IAM policy for a dataExchange or a listing.
576+
Gets the IAM policy.
577577
578578
Returns:
579579
Callable[[~.GetIamPolicyRequest],
@@ -599,7 +599,7 @@ def set_iam_policy(
599599
) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], policy_pb2.Policy]:
600600
r"""Return a callable for the set iam policy method over gRPC.
601601
602-
Sets the IAM policy for a dataExchange or a listing.
602+
Sets the IAM policy.
603603
604604
Returns:
605605
Callable[[~.SetIamPolicyRequest],
@@ -628,8 +628,7 @@ def test_iam_permissions(
628628
]:
629629
r"""Return a callable for the test iam permissions method over gRPC.
630630
631-
Returns the permissions that a caller has on a
632-
specified dataExchange or listing.
631+
Returns the permissions that a caller has.
633632
634633
Returns:
635634
Callable[[~.TestIamPermissionsRequest],
@@ -652,6 +651,42 @@ def test_iam_permissions(
652651
def close(self):
653652
self.grpc_channel.close()
654653

654+
@property
655+
def list_locations(
656+
self,
657+
) -> Callable[
658+
[locations_pb2.ListLocationsRequest], locations_pb2.ListLocationsResponse
659+
]:
660+
r"""Return a callable for the list locations method over gRPC."""
661+
# Generate a "stub function" on-the-fly which will actually make
662+
# the request.
663+
# gRPC handles serialization and deserialization, so we just need
664+
# to pass in the functions for each.
665+
if "list_locations" not in self._stubs:
666+
self._stubs["list_locations"] = self.grpc_channel.unary_unary(
667+
"/google.cloud.location.Locations/ListLocations",
668+
request_serializer=locations_pb2.ListLocationsRequest.SerializeToString,
669+
response_deserializer=locations_pb2.ListLocationsResponse.FromString,
670+
)
671+
return self._stubs["list_locations"]
672+
673+
@property
674+
def get_location(
675+
self,
676+
) -> Callable[[locations_pb2.GetLocationRequest], locations_pb2.Location]:
677+
r"""Return a callable for the list locations method over gRPC."""
678+
# Generate a "stub function" on-the-fly which will actually make
679+
# the request.
680+
# gRPC handles serialization and deserialization, so we just need
681+
# to pass in the functions for each.
682+
if "get_location" not in self._stubs:
683+
self._stubs["get_location"] = self.grpc_channel.unary_unary(
684+
"/google.cloud.location.Locations/GetLocation",
685+
request_serializer=locations_pb2.GetLocationRequest.SerializeToString,
686+
response_deserializer=locations_pb2.Location.FromString,
687+
)
688+
return self._stubs["get_location"]
689+
655690
@property
656691
def kind(self) -> str:
657692
return "grpc"

0 commit comments

Comments
 (0)