Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
🦉 Updates from OwlBot post-processor
  • Loading branch information
gcf-owl-bot[bot] committed Aug 27, 2024
commit a73ff715373ebeeca7ad4a1342b640ad1642a9fc
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from .client import MetastorePartitionServiceClient
from .async_client import MetastorePartitionServiceAsyncClient
from .client import MetastorePartitionServiceClient

__all__ = (
'MetastorePartitionServiceClient',
'MetastorePartitionServiceAsyncClient',
"MetastorePartitionServiceClient",
"MetastorePartitionServiceAsyncClient",
)

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
from .grpc import MetastorePartitionServiceGrpcTransport
from .grpc_asyncio import MetastorePartitionServiceGrpcAsyncIOTransport


# Compile a registry of transports.
_transport_registry = OrderedDict() # type: Dict[str, Type[MetastorePartitionServiceTransport]]
_transport_registry['grpc'] = MetastorePartitionServiceGrpcTransport
_transport_registry['grpc_asyncio'] = MetastorePartitionServiceGrpcAsyncIOTransport
_transport_registry = (
OrderedDict()
) # type: Dict[str, Type[MetastorePartitionServiceTransport]]
_transport_registry["grpc"] = MetastorePartitionServiceGrpcTransport
_transport_registry["grpc_asyncio"] = MetastorePartitionServiceGrpcAsyncIOTransport

__all__ = (
'MetastorePartitionServiceTransport',
'MetastorePartitionServiceGrpcTransport',
'MetastorePartitionServiceGrpcAsyncIOTransport',
"MetastorePartitionServiceTransport",
"MetastorePartitionServiceGrpcTransport",
"MetastorePartitionServiceGrpcAsyncIOTransport",
)
Original file line number Diff line number Diff line change
Expand Up @@ -16,43 +16,46 @@
import abc
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union

from google.cloud.bigquery_storage_v1alpha import gapic_version as package_version

import google.auth # type: ignore
import google.api_core
from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1
from google.api_core import retry as retries
import google.auth # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore
from google.oauth2 import service_account # type: ignore
from google.protobuf import empty_pb2 # type: ignore

from google.cloud.bigquery_storage_v1alpha import gapic_version as package_version
from google.cloud.bigquery_storage_v1alpha.types import metastore_partition
from google.protobuf import empty_pb2 # type: ignore

DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__)
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=package_version.__version__
)


class MetastorePartitionServiceTransport(abc.ABC):
"""Abstract transport class for MetastorePartitionService."""

AUTH_SCOPES = (
'https://www.googleapis.com/auth/bigquery',
'https://www.googleapis.com/auth/cloud-platform',
"https://www.googleapis.com/auth/bigquery",
"https://www.googleapis.com/auth/cloud-platform",
)

DEFAULT_HOST: str = 'bigquerystorage.googleapis.com'
DEFAULT_HOST: str = "bigquerystorage.googleapis.com"

def __init__(
self, *,
host: str = DEFAULT_HOST,
credentials: Optional[ga_credentials.Credentials] = None,
credentials_file: Optional[str] = None,
scopes: Optional[Sequence[str]] = None,
quota_project_id: Optional[str] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
always_use_jwt_access: Optional[bool] = False,
api_audience: Optional[str] = None,
**kwargs,
) -> None:
self,
*,
host: str = DEFAULT_HOST,
credentials: Optional[ga_credentials.Credentials] = None,
credentials_file: Optional[str] = None,
scopes: Optional[Sequence[str]] = None,
quota_project_id: Optional[str] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
always_use_jwt_access: Optional[bool] = False,
api_audience: Optional[str] = None,
**kwargs,
) -> None:
"""Instantiate the transport.

Args:
Expand Down Expand Up @@ -88,30 +91,38 @@ def __init__(
# If no credentials are provided, then determine the appropriate
# defaults.
if credentials and credentials_file:
raise core_exceptions.DuplicateCredentialArgs("'credentials_file' and 'credentials' are mutually exclusive")
raise core_exceptions.DuplicateCredentialArgs(
"'credentials_file' and 'credentials' are mutually exclusive"
)

if credentials_file is not None:
credentials, _ = google.auth.load_credentials_from_file(
credentials_file,
**scopes_kwargs,
quota_project_id=quota_project_id
)
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
)
elif credentials is None and not self._ignore_credentials:
credentials, _ = google.auth.default(**scopes_kwargs, quota_project_id=quota_project_id)
credentials, _ = google.auth.default(
**scopes_kwargs, quota_project_id=quota_project_id
)
# Don't apply audience if the credentials file passed from user.
if hasattr(credentials, "with_gdch_audience"):
credentials = credentials.with_gdch_audience(api_audience if api_audience else host)
credentials = credentials.with_gdch_audience(
api_audience if api_audience else host
)

# If the credentials are service account credentials, then always try to use self signed JWT.
if always_use_jwt_access and isinstance(credentials, service_account.Credentials) and hasattr(service_account.Credentials, "with_always_use_jwt_access"):
if (
always_use_jwt_access
and isinstance(credentials, service_account.Credentials)
and hasattr(service_account.Credentials, "with_always_use_jwt_access")
):
credentials = credentials.with_always_use_jwt_access(True)

# Save the credentials.
self._credentials = credentials

# Save the hostname. Default to port 443 (HTTPS) if none is specified.
if ':' not in host:
host += ':443'
if ":" not in host:
host += ":443"
self._host = host

@property
Expand Down Expand Up @@ -182,67 +193,77 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=120.0,
client_info=client_info,
),
}
}

def close(self):
"""Closes resources associated with the transport.

.. warning::
Only call this method if the transport is NOT shared
with other clients - this may cause errors in other clients!
.. warning::
Only call this method if the transport is NOT shared
with other clients - this may cause errors in other clients!
"""
raise NotImplementedError()

@property
def batch_create_metastore_partitions(self) -> Callable[
[metastore_partition.BatchCreateMetastorePartitionsRequest],
Union[
metastore_partition.BatchCreateMetastorePartitionsResponse,
Awaitable[metastore_partition.BatchCreateMetastorePartitionsResponse]
]]:
def batch_create_metastore_partitions(
self,
) -> Callable[
[metastore_partition.BatchCreateMetastorePartitionsRequest],
Union[
metastore_partition.BatchCreateMetastorePartitionsResponse,
Awaitable[metastore_partition.BatchCreateMetastorePartitionsResponse],
],
]:
raise NotImplementedError()

@property
def batch_delete_metastore_partitions(self) -> Callable[
[metastore_partition.BatchDeleteMetastorePartitionsRequest],
Union[
empty_pb2.Empty,
Awaitable[empty_pb2.Empty]
]]:
def batch_delete_metastore_partitions(
self,
) -> Callable[
[metastore_partition.BatchDeleteMetastorePartitionsRequest],
Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]],
]:
raise NotImplementedError()

@property
def batch_update_metastore_partitions(self) -> Callable[
[metastore_partition.BatchUpdateMetastorePartitionsRequest],
Union[
metastore_partition.BatchUpdateMetastorePartitionsResponse,
Awaitable[metastore_partition.BatchUpdateMetastorePartitionsResponse]
]]:
def batch_update_metastore_partitions(
self,
) -> Callable[
[metastore_partition.BatchUpdateMetastorePartitionsRequest],
Union[
metastore_partition.BatchUpdateMetastorePartitionsResponse,
Awaitable[metastore_partition.BatchUpdateMetastorePartitionsResponse],
],
]:
raise NotImplementedError()

@property
def list_metastore_partitions(self) -> Callable[
[metastore_partition.ListMetastorePartitionsRequest],
Union[
metastore_partition.ListMetastorePartitionsResponse,
Awaitable[metastore_partition.ListMetastorePartitionsResponse]
]]:
def list_metastore_partitions(
self,
) -> Callable[
[metastore_partition.ListMetastorePartitionsRequest],
Union[
metastore_partition.ListMetastorePartitionsResponse,
Awaitable[metastore_partition.ListMetastorePartitionsResponse],
],
]:
raise NotImplementedError()

@property
def stream_metastore_partitions(self) -> Callable[
[metastore_partition.StreamMetastorePartitionsRequest],
Union[
metastore_partition.StreamMetastorePartitionsResponse,
Awaitable[metastore_partition.StreamMetastorePartitionsResponse]
]]:
def stream_metastore_partitions(
self,
) -> Callable[
[metastore_partition.StreamMetastorePartitionsRequest],
Union[
metastore_partition.StreamMetastorePartitionsResponse,
Awaitable[metastore_partition.StreamMetastorePartitionsResponse],
],
]:
raise NotImplementedError()

@property
def kind(self) -> str:
raise NotImplementedError()


__all__ = (
'MetastorePartitionServiceTransport',
)
__all__ = ("MetastorePartitionServiceTransport",)
Loading