Skip to content

Commit

Permalink
feat: [google-cloud-bigquery-analyticshub] support public directory s…
Browse files Browse the repository at this point in the history
…elf service for Listings/Exchanges (#12858)

BEGIN_COMMIT_OVERRIDE
feat: support public directory self service for Listings/Exchanges
feat: support Direct Table Access Toggle (Egress GA)
docs: A comment for message `Listing` is changed
docs: A comment for message `DataExchange` is changed
END_COMMIT_OVERRIDE

- [ ] Regenerate this pull request now.

feat: support Direct Table Access Toggle (Egress GA)
docs: A comment for message `Listing` is changed
docs: A comment for message `DataExchange` is changed

PiperOrigin-RevId: 648941893

Source-Link:
googleapis/googleapis@c23223d

Source-Link:
googleapis/googleapis-gen@40846ed
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJpZ3F1ZXJ5LWFuYWx5dGljc2h1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDA4NDZlZDExZTRlZTU3N2JhOTU2NDExMjg5ZDNiNWUzMDIyYTk2OCJ9

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: ohmayr <omairnaveed@ymail.com>
  • Loading branch information
3 people authored Jul 3, 2024
1 parent 09391b2 commit 94554f5
Show file tree
Hide file tree
Showing 9 changed files with 207 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/google-cloud-bigquery-analyticshub/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Python Client for BigQuery Analytics Hub
.. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-bigquery-analyticshub.svg
:target: https://pypi.org/project/google-cloud-bigquery-analyticshub/
.. _BigQuery Analytics Hub: https://cloud.google.com/analytics-hub
.. _Client Library Documentation: https://cloud.google.com/python/docs/reference/analyticshub/latest
.. _Client Library Documentation: https://cloud.google.com/python/docs/reference/analyticshub/latest/summary_overview
.. _Product Documentation: https://cloud.google.com/analytics-hub

Quick Start
Expand Down
5 changes: 5 additions & 0 deletions packages/google-cloud-bigquery-analyticshub/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ For a list of all ``google-cloud-bigquery-analyticshub`` releases:
:maxdepth: 2

CHANGELOG

.. toctree::
:hidden:

summary_overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[
This is a templated file. Adding content to this file may result in it being
reverted. Instead, if you want to place additional content, create an
"overview_content.md" file in `docs/` directory. The Sphinx tool will
pick up on the content and merge the content.
]: #

# BigQuery Analytics Hub API

Overview of the APIs available for BigQuery Analytics Hub API.

## All entries

Classes, methods and properties & attributes for
BigQuery Analytics Hub API.

[classes](https://cloud.google.com/python/docs/reference/analyticshub/latest/summary_class.html)

[methods](https://cloud.google.com/python/docs/reference/analyticshub/latest/summary_method.html)

[properties and
attributes](https://cloud.google.com/python/docs/reference/analyticshub/latest/summary_property.html)
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
DeleteSubscriptionRequest,
DestinationDataset,
DestinationDatasetReference,
DiscoveryType,
GetDataExchangeRequest,
GetListingRequest,
GetSubscriptionRequest,
Expand Down Expand Up @@ -104,4 +105,5 @@
"Subscription",
"UpdateDataExchangeRequest",
"UpdateListingRequest",
"DiscoveryType",
)
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
DeleteSubscriptionRequest,
DestinationDataset,
DestinationDatasetReference,
DiscoveryType,
GetDataExchangeRequest,
GetListingRequest,
GetSubscriptionRequest,
Expand Down Expand Up @@ -74,6 +75,7 @@
"DeleteSubscriptionRequest",
"DestinationDataset",
"DestinationDatasetReference",
"DiscoveryType",
"GetDataExchangeRequest",
"GetListingRequest",
"GetSubscriptionRequest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
DeleteSubscriptionRequest,
DestinationDataset,
DestinationDatasetReference,
DiscoveryType,
GetDataExchangeRequest,
GetListingRequest,
GetSubscriptionRequest,
Expand Down Expand Up @@ -91,4 +92,5 @@
"Subscription",
"UpdateDataExchangeRequest",
"UpdateListingRequest",
"DiscoveryType",
)
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
__protobuf__ = proto.module(
package="google.cloud.bigquery.analyticshub.v1",
manifest={
"DiscoveryType",
"DataExchange",
"SharingEnvironmentConfig",
"DataProvider",
Expand Down Expand Up @@ -66,11 +67,34 @@
)


class DiscoveryType(proto.Enum):
r"""Specifies the type of discovery on the discovery page. Note
that this does not control the visibility of the
exchange/listing which is defined by IAM permission.
Values:
DISCOVERY_TYPE_UNSPECIFIED (0):
Unspecified. Defaults to DISCOVERY_TYPE_PRIVATE.
DISCOVERY_TYPE_PRIVATE (1):
The Data exchange/listing can be discovered
in the 'Private' results list.
DISCOVERY_TYPE_PUBLIC (2):
The Data exchange/listing can be discovered
in the 'Public' results list.
"""
DISCOVERY_TYPE_UNSPECIFIED = 0
DISCOVERY_TYPE_PRIVATE = 1
DISCOVERY_TYPE_PUBLIC = 2


class DataExchange(proto.Message):
r"""A data exchange is a container that lets you share data.
Along with the descriptive information about the data exchange,
it contains listings that reference shared datasets.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
name (str):
Output only. The resource name of the data exchange. e.g.
Expand Down Expand Up @@ -111,6 +135,13 @@ class DataExchange(proto.Message):
sharing_environment_config (google.cloud.bigquery_analyticshub_v1.types.SharingEnvironmentConfig):
Optional. Configurable data sharing
environment option for a data exchange.
discovery_type (google.cloud.bigquery_analyticshub_v1.types.DiscoveryType):
Optional. Type of discovery on the discovery page for all
the listings under this exchange. Updating this field also
updates (overwrites) the discovery_type field for all the
listings under this exchange.
This field is a member of `oneof`_ ``_discovery_type``.
"""

name: str = proto.Field(
Expand Down Expand Up @@ -146,6 +177,12 @@ class DataExchange(proto.Message):
number=8,
message="SharingEnvironmentConfig",
)
discovery_type: "DiscoveryType" = proto.Field(
proto.ENUM,
number=9,
optional=True,
enum="DiscoveryType",
)


class SharingEnvironmentConfig(proto.Message):
Expand Down Expand Up @@ -425,6 +462,11 @@ class Listing(proto.Message):
Optional. If set, restricted export
configuration will be propagated and enforced on
the linked dataset.
discovery_type (google.cloud.bigquery_analyticshub_v1.types.DiscoveryType):
Optional. Type of discovery of the listing on
the discovery page.
This field is a member of `oneof`_ ``_discovery_type``.
"""

class State(proto.Enum):
Expand Down Expand Up @@ -525,6 +567,10 @@ class BigQueryDatasetSource(proto.Message):
the entire dataset (all resources) are shared.
This field is only valid for data clean room
exchanges.
restricted_export_policy (google.cloud.bigquery_analyticshub_v1.types.Listing.BigQueryDatasetSource.RestrictedExportPolicy):
Optional. If set, restricted export policy
will be propagated and enforced on the linked
dataset.
"""

class SelectedResource(proto.Message):
Expand All @@ -547,6 +593,39 @@ class SelectedResource(proto.Message):
oneof="resource",
)

class RestrictedExportPolicy(proto.Message):
r"""Restricted export policy used to configure restricted export
on linked dataset.
Attributes:
enabled (google.protobuf.wrappers_pb2.BoolValue):
Optional. If true, enable restricted export.
restrict_direct_table_access (google.protobuf.wrappers_pb2.BoolValue):
Optional. If true, restrict direct table
access (read api/tabledata.list) on linked
table.
restrict_query_result (google.protobuf.wrappers_pb2.BoolValue):
Optional. If true, restrict export of query
result derived from restricted linked dataset
table.
"""

enabled: wrappers_pb2.BoolValue = proto.Field(
proto.MESSAGE,
number=1,
message=wrappers_pb2.BoolValue,
)
restrict_direct_table_access: wrappers_pb2.BoolValue = proto.Field(
proto.MESSAGE,
number=2,
message=wrappers_pb2.BoolValue,
)
restrict_query_result: wrappers_pb2.BoolValue = proto.Field(
proto.MESSAGE,
number=3,
message=wrappers_pb2.BoolValue,
)

dataset: str = proto.Field(
proto.STRING,
number=1,
Expand All @@ -558,6 +637,11 @@ class SelectedResource(proto.Message):
number=2,
message="Listing.BigQueryDatasetSource.SelectedResource",
)
restricted_export_policy: "Listing.BigQueryDatasetSource.RestrictedExportPolicy" = proto.Field(
proto.MESSAGE,
number=3,
message="Listing.BigQueryDatasetSource.RestrictedExportPolicy",
)

class RestrictedExportConfig(proto.Message):
r"""Restricted export config, used to configure restricted export
Expand Down Expand Up @@ -647,6 +731,12 @@ class RestrictedExportConfig(proto.Message):
number=13,
message=RestrictedExportConfig,
)
discovery_type: "DiscoveryType" = proto.Field(
proto.ENUM,
number=14,
optional=True,
enum="DiscoveryType",
)


class Subscription(proto.Message):
Expand Down Expand Up @@ -1142,8 +1232,8 @@ class SubscribeListingRequest(proto.Message):
Attributes:
destination_dataset (google.cloud.bigquery_analyticshub_v1.types.DestinationDataset):
BigQuery destination dataset to create for
the subscriber.
Input only. BigQuery destination dataset to
create for the subscriber.
This field is a member of `oneof`_ ``destination``.
name (str):
Expand Down Expand Up @@ -1285,8 +1375,22 @@ class ListSubscriptionsRequest(proto.Message):
subscription. e.g.
projects/myproject/locations/US
filter (str):
The filter expression may be used to filter
by Data Exchange or Listing.
An expression for filtering the results of the request.
Eligible fields for filtering are:
- ``listing``
- ``data_exchange``
Alternatively, a literal wrapped in double quotes may be
provided. This will be checked for an exact match against
both fields above.
In all cases, the full Data Exchange or Listing resource
name must be provided. Some example of using filters:
- data_exchange="projects/myproject/locations/us/dataExchanges/123"
- listing="projects/123/locations/us/dataExchanges/456/listings/789"
- "projects/myproject/locations/us/dataExchanges/123".
page_size (int):
The maximum number of results to return in a
single response page.
Expand Down
46 changes: 35 additions & 11 deletions packages/google-cloud-bigquery-analyticshub/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,28 @@ def install_unittest_dependencies(session, *constraints):
session.install("-e", ".", *constraints)


def default(session):
@nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
@nox.parametrize(
"protobuf_implementation",
["python", "upb", "cpp"],
)
def unit(session, protobuf_implementation):
# Install all test dependencies, then install this package in-place.

if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12"):
session.skip("cpp implementation is not supported in python 3.11+")

constraints_path = str(
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
)
install_unittest_dependencies(session, "-c", constraints_path)

# TODO(https://github.com/googleapis/synthtool/issues/1976):
# Remove the 'cpp' implementation once support for Protobuf 3.x is dropped.
# The 'cpp' implementation requires Protobuf<4.
if protobuf_implementation == "cpp":
session.install("protobuf<4")

# Run py.test against the unit tests.
session.run(
"py.test",
Expand All @@ -181,15 +195,12 @@ def default(session):
"--cov-fail-under=0",
os.path.join("tests", "unit"),
*session.posargs,
env={
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
},
)


@nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
def unit(session):
"""Run the unit test suite."""
default(session)


def install_systemtest_dependencies(session, *constraints):
# Use pre-release gRPC for system tests.
# Exclude version 1.52.0rc1 which has a known issue.
Expand Down Expand Up @@ -358,9 +369,16 @@ def docfx(session):


@nox.session(python="3.12")
def prerelease_deps(session):
@nox.parametrize(
"protobuf_implementation",
["python", "upb", "cpp"],
)
def prerelease_deps(session, protobuf_implementation):
"""Run all tests with prerelease versions of dependencies installed."""

if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12"):
session.skip("cpp implementation is not supported in python 3.11+")

# Install all dependencies
session.install("-e", ".[all, tests, tracing]")
unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
Expand Down Expand Up @@ -397,9 +415,9 @@ def prerelease_deps(session):
"protobuf",
# dependency of grpc
"six",
"grpc-google-iam-v1",
"googleapis-common-protos",
# Exclude version 1.52.0rc1 which has a known issue. See https://github.com/grpc/grpc/issues/32163
"grpcio!=1.52.0rc1",
"grpcio",
"grpcio-status",
"google-api-core",
"google-auth",
Expand All @@ -425,4 +443,10 @@ def prerelease_deps(session):
session.run("python", "-c", "import grpc; print(grpc.__version__)")
session.run("python", "-c", "import google.auth; print(google.auth.__version__)")

session.run("py.test", "tests/unit")
session.run(
"py.test",
"tests/unit",
env={
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
},
)
Loading

0 comments on commit 94554f5

Please sign in to comment.