diff --git a/packages/google-area120-tables/docs/tables_v1alpha1/tables_service.rst b/packages/google-area120-tables/docs/tables_v1alpha1/tables_service.rst
index bdb4d9186376..766388ee81c9 100644
--- a/packages/google-area120-tables/docs/tables_v1alpha1/tables_service.rst
+++ b/packages/google-area120-tables/docs/tables_v1alpha1/tables_service.rst
@@ -5,7 +5,6 @@ TablesService
:members:
:inherited-members:
-
.. automodule:: google.area120.tables_v1alpha1.services.tables_service.pagers
:members:
:inherited-members:
diff --git a/packages/google-area120-tables/google/area120/tables/__init__.py b/packages/google-area120-tables/google/area120/tables/__init__.py
index 071566b35fcf..41e21ae37cdc 100644
--- a/packages/google-area120-tables/google/area120/tables/__init__.py
+++ b/packages/google-area120-tables/google/area120/tables/__init__.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,12 +14,13 @@
# limitations under the License.
#
-from google.area120.tables_v1alpha1.services.tables_service.async_client import (
- TablesServiceAsyncClient,
-)
from google.area120.tables_v1alpha1.services.tables_service.client import (
TablesServiceClient,
)
+from google.area120.tables_v1alpha1.services.tables_service.async_client import (
+ TablesServiceAsyncClient,
+)
+
from google.area120.tables_v1alpha1.types.tables import BatchCreateRowsRequest
from google.area120.tables_v1alpha1.types.tables import BatchCreateRowsResponse
from google.area120.tables_v1alpha1.types.tables import BatchDeleteRowsRequest
@@ -44,10 +44,12 @@
from google.area120.tables_v1alpha1.types.tables import Row
from google.area120.tables_v1alpha1.types.tables import Table
from google.area120.tables_v1alpha1.types.tables import UpdateRowRequest
-from google.area120.tables_v1alpha1.types.tables import View
from google.area120.tables_v1alpha1.types.tables import Workspace
+from google.area120.tables_v1alpha1.types.tables import View
__all__ = (
+ "TablesServiceClient",
+ "TablesServiceAsyncClient",
"BatchCreateRowsRequest",
"BatchCreateRowsResponse",
"BatchDeleteRowsRequest",
@@ -70,9 +72,7 @@
"RelationshipDetails",
"Row",
"Table",
- "TablesServiceAsyncClient",
- "TablesServiceClient",
"UpdateRowRequest",
- "View",
"Workspace",
+ "View",
)
diff --git a/packages/google-area120-tables/google/area120/tables_v1alpha1/__init__.py b/packages/google-area120-tables/google/area120/tables_v1alpha1/__init__.py
index 8ad2200082e7..87a48c64c94b 100644
--- a/packages/google-area120-tables/google/area120/tables_v1alpha1/__init__.py
+++ b/packages/google-area120-tables/google/area120/tables_v1alpha1/__init__.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,6 +15,8 @@
#
from .services.tables_service import TablesServiceClient
+from .services.tables_service import TablesServiceAsyncClient
+
from .types.tables import BatchCreateRowsRequest
from .types.tables import BatchCreateRowsResponse
from .types.tables import BatchDeleteRowsRequest
@@ -39,11 +40,11 @@
from .types.tables import Row
from .types.tables import Table
from .types.tables import UpdateRowRequest
-from .types.tables import View
from .types.tables import Workspace
-
+from .types.tables import View
__all__ = (
+ "TablesServiceAsyncClient",
"BatchCreateRowsRequest",
"BatchCreateRowsResponse",
"BatchDeleteRowsRequest",
@@ -66,8 +67,8 @@
"RelationshipDetails",
"Row",
"Table",
+ "TablesServiceClient",
"UpdateRowRequest",
"View",
"Workspace",
- "TablesServiceClient",
)
diff --git a/packages/google-area120-tables/google/area120/tables_v1alpha1/gapic_metadata.json b/packages/google-area120-tables/google/area120/tables_v1alpha1/gapic_metadata.json
new file mode 100644
index 000000000000..287c7aaa7e24
--- /dev/null
+++ b/packages/google-area120-tables/google/area120/tables_v1alpha1/gapic_metadata.json
@@ -0,0 +1,143 @@
+ {
+ "comment": "This file maps proto services/RPCs to the corresponding library clients/methods",
+ "language": "python",
+ "libraryPackage": "google.area120.tables_v1alpha1",
+ "protoPackage": "google.area120.tables.v1alpha1",
+ "schema": "1.0",
+ "services": {
+ "TablesService": {
+ "clients": {
+ "grpc": {
+ "libraryClient": "TablesServiceClient",
+ "rpcs": {
+ "BatchCreateRows": {
+ "methods": [
+ "batch_create_rows"
+ ]
+ },
+ "BatchDeleteRows": {
+ "methods": [
+ "batch_delete_rows"
+ ]
+ },
+ "BatchUpdateRows": {
+ "methods": [
+ "batch_update_rows"
+ ]
+ },
+ "CreateRow": {
+ "methods": [
+ "create_row"
+ ]
+ },
+ "DeleteRow": {
+ "methods": [
+ "delete_row"
+ ]
+ },
+ "GetRow": {
+ "methods": [
+ "get_row"
+ ]
+ },
+ "GetTable": {
+ "methods": [
+ "get_table"
+ ]
+ },
+ "GetWorkspace": {
+ "methods": [
+ "get_workspace"
+ ]
+ },
+ "ListRows": {
+ "methods": [
+ "list_rows"
+ ]
+ },
+ "ListTables": {
+ "methods": [
+ "list_tables"
+ ]
+ },
+ "ListWorkspaces": {
+ "methods": [
+ "list_workspaces"
+ ]
+ },
+ "UpdateRow": {
+ "methods": [
+ "update_row"
+ ]
+ }
+ }
+ },
+ "grpc-async": {
+ "libraryClient": "TablesServiceAsyncClient",
+ "rpcs": {
+ "BatchCreateRows": {
+ "methods": [
+ "batch_create_rows"
+ ]
+ },
+ "BatchDeleteRows": {
+ "methods": [
+ "batch_delete_rows"
+ ]
+ },
+ "BatchUpdateRows": {
+ "methods": [
+ "batch_update_rows"
+ ]
+ },
+ "CreateRow": {
+ "methods": [
+ "create_row"
+ ]
+ },
+ "DeleteRow": {
+ "methods": [
+ "delete_row"
+ ]
+ },
+ "GetRow": {
+ "methods": [
+ "get_row"
+ ]
+ },
+ "GetTable": {
+ "methods": [
+ "get_table"
+ ]
+ },
+ "GetWorkspace": {
+ "methods": [
+ "get_workspace"
+ ]
+ },
+ "ListRows": {
+ "methods": [
+ "list_rows"
+ ]
+ },
+ "ListTables": {
+ "methods": [
+ "list_tables"
+ ]
+ },
+ "ListWorkspaces": {
+ "methods": [
+ "list_workspaces"
+ ]
+ },
+ "UpdateRow": {
+ "methods": [
+ "update_row"
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/__init__.py b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/__init__.py
index 42ffdf2bc43d..4de65971c238 100644
--- a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/__init__.py
+++ b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/__init__.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/__init__.py b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/__init__.py
index e96ba626be14..be8560585592 100644
--- a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/__init__.py
+++ b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/__init__.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
from .client import TablesServiceClient
from .async_client import TablesServiceAsyncClient
diff --git a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/async_client.py b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/async_client.py
index 653893ef139a..84d5c2e43c19 100644
--- a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/async_client.py
+++ b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/async_client.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
from collections import OrderedDict
import functools
import re
@@ -22,16 +20,15 @@
import pkg_resources
import google.api_core.client_options as ClientOptions # type: ignore
-from google.api_core import exceptions # type: ignore
+from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core import retry as retries # type: ignore
-from google.auth import credentials # type: ignore
+from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore
from google.area120.tables_v1alpha1.services.tables_service import pagers
from google.area120.tables_v1alpha1.types import tables
-from google.protobuf import field_mask_pb2 as field_mask # type: ignore
-
+from google.protobuf import field_mask_pb2 # type: ignore
from .transports.base import TablesServiceTransport, DEFAULT_CLIENT_INFO
from .transports.grpc_asyncio import TablesServiceGrpcAsyncIOTransport
from .client import TablesServiceClient
@@ -65,31 +62,26 @@ class TablesServiceAsyncClient:
parse_table_path = staticmethod(TablesServiceClient.parse_table_path)
workspace_path = staticmethod(TablesServiceClient.workspace_path)
parse_workspace_path = staticmethod(TablesServiceClient.parse_workspace_path)
-
common_billing_account_path = staticmethod(
TablesServiceClient.common_billing_account_path
)
parse_common_billing_account_path = staticmethod(
TablesServiceClient.parse_common_billing_account_path
)
-
common_folder_path = staticmethod(TablesServiceClient.common_folder_path)
parse_common_folder_path = staticmethod(
TablesServiceClient.parse_common_folder_path
)
-
common_organization_path = staticmethod(
TablesServiceClient.common_organization_path
)
parse_common_organization_path = staticmethod(
TablesServiceClient.parse_common_organization_path
)
-
common_project_path = staticmethod(TablesServiceClient.common_project_path)
parse_common_project_path = staticmethod(
TablesServiceClient.parse_common_project_path
)
-
common_location_path = staticmethod(TablesServiceClient.common_location_path)
parse_common_location_path = staticmethod(
TablesServiceClient.parse_common_location_path
@@ -97,7 +89,8 @@ class TablesServiceAsyncClient:
@classmethod
def from_service_account_info(cls, info: dict, *args, **kwargs):
- """Creates an instance of this client using the provided credentials info.
+ """Creates an instance of this client using the provided credentials
+ info.
Args:
info (dict): The service account private key info.
@@ -112,7 +105,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs):
@classmethod
def from_service_account_file(cls, filename: str, *args, **kwargs):
"""Creates an instance of this client using the provided credentials
- file.
+ file.
Args:
filename (str): The path to the service account private key json
@@ -129,7 +122,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs):
@property
def transport(self) -> TablesServiceTransport:
- """Return the transport used by the client instance.
+ """Returns the transport used by the client instance.
Returns:
TablesServiceTransport: The transport used by the client instance.
@@ -143,12 +136,12 @@ def transport(self) -> TablesServiceTransport:
def __init__(
self,
*,
- credentials: credentials.Credentials = None,
+ credentials: ga_credentials.Credentials = None,
transport: Union[str, TablesServiceTransport] = "grpc_asyncio",
client_options: ClientOptions = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
) -> None:
- """Instantiate the tables service client.
+ """Instantiates the tables service client.
Args:
credentials (Optional[google.auth.credentials.Credentials]): The
@@ -180,7 +173,6 @@ def __init__(
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
creation failed for any reason.
"""
-
self._client = TablesServiceClient(
credentials=credentials,
transport=transport,
@@ -210,7 +202,6 @@ async def get_table(
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -235,7 +226,6 @@ async def get_table(
# If we have keyword arguments corresponding to fields on the
# request, apply these.
-
if name is not None:
request.name = name
@@ -273,7 +263,6 @@ async def list_tables(
request (:class:`google.area120.tables_v1alpha1.types.ListTablesRequest`):
The request object. Request message for
TablesService.ListTables.
-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -290,7 +279,6 @@ async def list_tables(
"""
# Create or coerce a protobuf request object.
-
request = tables.ListTablesRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
@@ -337,7 +325,6 @@ async def get_workspace(
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -362,7 +349,6 @@ async def get_workspace(
# If we have keyword arguments corresponding to fields on the
# request, apply these.
-
if name is not None:
request.name = name
@@ -400,7 +386,6 @@ async def list_workspaces(
request (:class:`google.area120.tables_v1alpha1.types.ListWorkspacesRequest`):
The request object. Request message for
TablesService.ListWorkspaces.
-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -417,7 +402,6 @@ async def list_workspaces(
"""
# Create or coerce a protobuf request object.
-
request = tables.ListWorkspacesRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
@@ -464,7 +448,6 @@ async def get_row(
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -489,7 +472,6 @@ async def get_row(
# If we have keyword arguments corresponding to fields on the
# request, apply these.
-
if name is not None:
request.name = name
@@ -536,7 +518,6 @@ async def list_rows(
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -566,7 +547,6 @@ async def list_rows(
# If we have keyword arguments corresponding to fields on the
# request, apply these.
-
if parent is not None:
request.parent = parent
@@ -625,7 +605,6 @@ async def create_row(
This corresponds to the ``row`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -650,7 +629,6 @@ async def create_row(
# If we have keyword arguments corresponding to fields on the
# request, apply these.
-
if parent is not None:
request.parent = parent
if row is not None:
@@ -690,7 +668,6 @@ async def batch_create_rows(
request (:class:`google.area120.tables_v1alpha1.types.BatchCreateRowsRequest`):
The request object. Request message for
TablesService.BatchCreateRows.
-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -704,7 +681,6 @@ async def batch_create_rows(
"""
# Create or coerce a protobuf request object.
-
request = tables.BatchCreateRowsRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
@@ -732,7 +708,7 @@ async def update_row(
request: tables.UpdateRowRequest = None,
*,
row: tables.Row = None,
- update_mask: field_mask.FieldMask = None,
+ update_mask: field_mask_pb2.FieldMask = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
@@ -753,7 +729,6 @@ async def update_row(
This corresponds to the ``update_mask`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -778,7 +753,6 @@ async def update_row(
# If we have keyword arguments corresponding to fields on the
# request, apply these.
-
if row is not None:
request.row = row
if update_mask is not None:
@@ -818,7 +792,6 @@ async def batch_update_rows(
request (:class:`google.area120.tables_v1alpha1.types.BatchUpdateRowsRequest`):
The request object. Request message for
TablesService.BatchUpdateRows.
-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -832,7 +805,6 @@ async def batch_update_rows(
"""
# Create or coerce a protobuf request object.
-
request = tables.BatchUpdateRowsRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
@@ -878,7 +850,6 @@ async def delete_row(
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -899,7 +870,6 @@ async def delete_row(
# If we have keyword arguments corresponding to fields on the
# request, apply these.
-
if name is not None:
request.name = name
@@ -936,7 +906,6 @@ async def batch_delete_rows(
request (:class:`google.area120.tables_v1alpha1.types.BatchDeleteRowsRequest`):
The request object. Request message for
TablesService.BatchDeleteRows
-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -944,7 +913,6 @@ async def batch_delete_rows(
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
-
request = tables.BatchDeleteRowsRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
diff --git a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/client.py b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/client.py
index 863aee58c673..5534d5cbef97 100644
--- a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/client.py
+++ b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/client.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
from collections import OrderedDict
from distutils import util
import os
@@ -23,10 +21,10 @@
import pkg_resources
from google.api_core import client_options as client_options_lib # type: ignore
-from google.api_core import exceptions # type: ignore
+from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core import retry as retries # type: ignore
-from google.auth import credentials # type: ignore
+from google.auth import credentials as ga_credentials # type: ignore
from google.auth.transport import mtls # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
from google.auth.exceptions import MutualTLSChannelError # type: ignore
@@ -34,8 +32,7 @@
from google.area120.tables_v1alpha1.services.tables_service import pagers
from google.area120.tables_v1alpha1.types import tables
-from google.protobuf import field_mask_pb2 as field_mask # type: ignore
-
+from google.protobuf import field_mask_pb2 # type: ignore
from .transports.base import TablesServiceTransport, DEFAULT_CLIENT_INFO
from .transports.grpc import TablesServiceGrpcTransport
from .transports.grpc_asyncio import TablesServiceGrpcAsyncIOTransport
@@ -54,7 +51,7 @@ class TablesServiceClientMeta(type):
_transport_registry["grpc_asyncio"] = TablesServiceGrpcAsyncIOTransport
def get_transport_class(cls, label: str = None,) -> Type[TablesServiceTransport]:
- """Return an appropriate transport class.
+ """Returns an appropriate transport class.
Args:
label: The name of the desired transport. If none is
@@ -91,7 +88,8 @@ class TablesServiceClient(metaclass=TablesServiceClientMeta):
@staticmethod
def _get_default_mtls_endpoint(api_endpoint):
- """Convert api endpoint to mTLS endpoint.
+ """Converts api endpoint to mTLS endpoint.
+
Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to
"*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively.
Args:
@@ -125,7 +123,8 @@ def _get_default_mtls_endpoint(api_endpoint):
@classmethod
def from_service_account_info(cls, info: dict, *args, **kwargs):
- """Creates an instance of this client using the provided credentials info.
+ """Creates an instance of this client using the provided credentials
+ info.
Args:
info (dict): The service account private key info.
@@ -142,7 +141,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs):
@classmethod
def from_service_account_file(cls, filename: str, *args, **kwargs):
"""Creates an instance of this client using the provided credentials
- file.
+ file.
Args:
filename (str): The path to the service account private key json
@@ -161,49 +160,50 @@ def from_service_account_file(cls, filename: str, *args, **kwargs):
@property
def transport(self) -> TablesServiceTransport:
- """Return the transport used by the client instance.
+ """Returns the transport used by the client instance.
Returns:
- TablesServiceTransport: The transport used by the client instance.
+ TablesServiceTransport: The transport used by the client
+ instance.
"""
return self._transport
@staticmethod
def row_path(table: str, row: str,) -> str:
- """Return a fully-qualified row string."""
+ """Returns a fully-qualified row string."""
return "tables/{table}/rows/{row}".format(table=table, row=row,)
@staticmethod
def parse_row_path(path: str) -> Dict[str, str]:
- """Parse a row path into its component segments."""
+ """Parses a row path into its component segments."""
m = re.match(r"^tables/(?P
.+?)/rows/(?P.+?)$", path)
return m.groupdict() if m else {}
@staticmethod
def table_path(table: str,) -> str:
- """Return a fully-qualified table string."""
+ """Returns a fully-qualified table string."""
return "tables/{table}".format(table=table,)
@staticmethod
def parse_table_path(path: str) -> Dict[str, str]:
- """Parse a table path into its component segments."""
+ """Parses a table path into its component segments."""
m = re.match(r"^tables/(?P.+?)$", path)
return m.groupdict() if m else {}
@staticmethod
def workspace_path(workspace: str,) -> str:
- """Return a fully-qualified workspace string."""
+ """Returns a fully-qualified workspace string."""
return "workspaces/{workspace}".format(workspace=workspace,)
@staticmethod
def parse_workspace_path(path: str) -> Dict[str, str]:
- """Parse a workspace path into its component segments."""
+ """Parses a workspace path into its component segments."""
m = re.match(r"^workspaces/(?P.+?)$", path)
return m.groupdict() if m else {}
@staticmethod
def common_billing_account_path(billing_account: str,) -> str:
- """Return a fully-qualified billing_account string."""
+ """Returns a fully-qualified billing_account string."""
return "billingAccounts/{billing_account}".format(
billing_account=billing_account,
)
@@ -216,7 +216,7 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]:
@staticmethod
def common_folder_path(folder: str,) -> str:
- """Return a fully-qualified folder string."""
+ """Returns a fully-qualified folder string."""
return "folders/{folder}".format(folder=folder,)
@staticmethod
@@ -227,7 +227,7 @@ def parse_common_folder_path(path: str) -> Dict[str, str]:
@staticmethod
def common_organization_path(organization: str,) -> str:
- """Return a fully-qualified organization string."""
+ """Returns a fully-qualified organization string."""
return "organizations/{organization}".format(organization=organization,)
@staticmethod
@@ -238,7 +238,7 @@ def parse_common_organization_path(path: str) -> Dict[str, str]:
@staticmethod
def common_project_path(project: str,) -> str:
- """Return a fully-qualified project string."""
+ """Returns a fully-qualified project string."""
return "projects/{project}".format(project=project,)
@staticmethod
@@ -249,7 +249,7 @@ def parse_common_project_path(path: str) -> Dict[str, str]:
@staticmethod
def common_location_path(project: str, location: str,) -> str:
- """Return a fully-qualified location string."""
+ """Returns a fully-qualified location string."""
return "projects/{project}/locations/{location}".format(
project=project, location=location,
)
@@ -263,12 +263,12 @@ def parse_common_location_path(path: str) -> Dict[str, str]:
def __init__(
self,
*,
- credentials: Optional[credentials.Credentials] = None,
+ credentials: Optional[ga_credentials.Credentials] = None,
transport: Union[str, TablesServiceTransport, None] = None,
client_options: Optional[client_options_lib.ClientOptions] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
) -> None:
- """Instantiate the tables service client.
+ """Instantiates the tables service client.
Args:
credentials (Optional[google.auth.credentials.Credentials]): The
@@ -323,9 +323,10 @@ def __init__(
client_cert_source_func = client_options.client_cert_source
else:
is_mtls = mtls.has_default_client_cert_source()
- client_cert_source_func = (
- mtls.default_client_cert_source() if is_mtls else None
- )
+ if is_mtls:
+ client_cert_source_func = mtls.default_client_cert_source()
+ else:
+ client_cert_source_func = None
# Figure out which api endpoint to use.
if client_options.api_endpoint is not None:
@@ -337,12 +338,14 @@ def __init__(
elif use_mtls_env == "always":
api_endpoint = self.DEFAULT_MTLS_ENDPOINT
elif use_mtls_env == "auto":
- api_endpoint = (
- self.DEFAULT_MTLS_ENDPOINT if is_mtls else self.DEFAULT_ENDPOINT
- )
+ if is_mtls:
+ api_endpoint = self.DEFAULT_MTLS_ENDPOINT
+ else:
+ api_endpoint = self.DEFAULT_ENDPOINT
else:
raise MutualTLSChannelError(
- "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always"
+ "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted "
+ "values: never, auto, always"
)
# Save or instantiate the transport.
@@ -357,8 +360,8 @@ def __init__(
)
if client_options.scopes:
raise ValueError(
- "When providing a transport instance, "
- "provide its scopes directly."
+ "When providing a transport instance, provide its scopes "
+ "directly."
)
self._transport = transport
else:
@@ -395,7 +398,6 @@ def get_table(
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -422,10 +424,8 @@ def get_table(
# there are no flattened fields.
if not isinstance(request, tables.GetTableRequest):
request = tables.GetTableRequest(request)
-
# If we have keyword arguments corresponding to fields on the
# request, apply these.
-
if name is not None:
request.name = name
@@ -459,7 +459,6 @@ def list_tables(
request (google.area120.tables_v1alpha1.types.ListTablesRequest):
The request object. Request message for
TablesService.ListTables.
-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -476,7 +475,6 @@ def list_tables(
"""
# Create or coerce a protobuf request object.
-
# Minor optimization to avoid making a copy if the user passes
# in a tables.ListTablesRequest.
# There's no risk of modifying the input as we've already verified
@@ -524,7 +522,6 @@ def get_workspace(
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -551,10 +548,8 @@ def get_workspace(
# there are no flattened fields.
if not isinstance(request, tables.GetWorkspaceRequest):
request = tables.GetWorkspaceRequest(request)
-
# If we have keyword arguments corresponding to fields on the
# request, apply these.
-
if name is not None:
request.name = name
@@ -588,7 +583,6 @@ def list_workspaces(
request (google.area120.tables_v1alpha1.types.ListWorkspacesRequest):
The request object. Request message for
TablesService.ListWorkspaces.
-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -605,7 +599,6 @@ def list_workspaces(
"""
# Create or coerce a protobuf request object.
-
# Minor optimization to avoid making a copy if the user passes
# in a tables.ListWorkspacesRequest.
# There's no risk of modifying the input as we've already verified
@@ -653,7 +646,6 @@ def get_row(
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -680,10 +672,8 @@ def get_row(
# there are no flattened fields.
if not isinstance(request, tables.GetRowRequest):
request = tables.GetRowRequest(request)
-
# If we have keyword arguments corresponding to fields on the
# request, apply these.
-
if name is not None:
request.name = name
@@ -726,7 +716,6 @@ def list_rows(
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -758,10 +747,8 @@ def list_rows(
# there are no flattened fields.
if not isinstance(request, tables.ListRowsRequest):
request = tables.ListRowsRequest(request)
-
# If we have keyword arguments corresponding to fields on the
# request, apply these.
-
if parent is not None:
request.parent = parent
@@ -816,7 +803,6 @@ def create_row(
This corresponds to the ``row`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -843,10 +829,8 @@ def create_row(
# there are no flattened fields.
if not isinstance(request, tables.CreateRowRequest):
request = tables.CreateRowRequest(request)
-
# If we have keyword arguments corresponding to fields on the
# request, apply these.
-
if parent is not None:
request.parent = parent
if row is not None:
@@ -882,7 +866,6 @@ def batch_create_rows(
request (google.area120.tables_v1alpha1.types.BatchCreateRowsRequest):
The request object. Request message for
TablesService.BatchCreateRows.
-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -896,7 +879,6 @@ def batch_create_rows(
"""
# Create or coerce a protobuf request object.
-
# Minor optimization to avoid making a copy if the user passes
# in a tables.BatchCreateRowsRequest.
# There's no risk of modifying the input as we've already verified
@@ -925,7 +907,7 @@ def update_row(
request: tables.UpdateRowRequest = None,
*,
row: tables.Row = None,
- update_mask: field_mask.FieldMask = None,
+ update_mask: field_mask_pb2.FieldMask = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
@@ -946,7 +928,6 @@ def update_row(
This corresponds to the ``update_mask`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -973,10 +954,8 @@ def update_row(
# there are no flattened fields.
if not isinstance(request, tables.UpdateRowRequest):
request = tables.UpdateRowRequest(request)
-
# If we have keyword arguments corresponding to fields on the
# request, apply these.
-
if row is not None:
request.row = row
if update_mask is not None:
@@ -1012,7 +991,6 @@ def batch_update_rows(
request (google.area120.tables_v1alpha1.types.BatchUpdateRowsRequest):
The request object. Request message for
TablesService.BatchUpdateRows.
-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -1026,7 +1004,6 @@ def batch_update_rows(
"""
# Create or coerce a protobuf request object.
-
# Minor optimization to avoid making a copy if the user passes
# in a tables.BatchUpdateRowsRequest.
# There's no risk of modifying the input as we've already verified
@@ -1073,7 +1050,6 @@ def delete_row(
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -1096,10 +1072,8 @@ def delete_row(
# there are no flattened fields.
if not isinstance(request, tables.DeleteRowRequest):
request = tables.DeleteRowRequest(request)
-
# If we have keyword arguments corresponding to fields on the
# request, apply these.
-
if name is not None:
request.name = name
@@ -1132,7 +1106,6 @@ def batch_delete_rows(
request (google.area120.tables_v1alpha1.types.BatchDeleteRowsRequest):
The request object. Request message for
TablesService.BatchDeleteRows
-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -1140,7 +1113,6 @@ def batch_delete_rows(
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
-
# Minor optimization to avoid making a copy if the user passes
# in a tables.BatchDeleteRowsRequest.
# There's no risk of modifying the input as we've already verified
diff --git a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/pagers.py b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/pagers.py
index 101b88e0238c..bd57a3f6f4d0 100644
--- a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/pagers.py
+++ b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/pagers.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
from typing import (
Any,
AsyncIterable,
@@ -117,7 +115,7 @@ def __init__(
*,
metadata: Sequence[Tuple[str, str]] = ()
):
- """Instantiate the pager.
+ """Instantiates the pager.
Args:
method (Callable): The method that was originally called, and
@@ -245,7 +243,7 @@ def __init__(
*,
metadata: Sequence[Tuple[str, str]] = ()
):
- """Instantiate the pager.
+ """Instantiates the pager.
Args:
method (Callable): The method that was originally called, and
@@ -373,7 +371,7 @@ def __init__(
*,
metadata: Sequence[Tuple[str, str]] = ()
):
- """Instantiate the pager.
+ """Instantiates the pager.
Args:
method (Callable): The method that was originally called, and
diff --git a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/transports/__init__.py b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/transports/__init__.py
index ce4e8acce4ca..67efcafbf4ed 100644
--- a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/transports/__init__.py
+++ b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/transports/__init__.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
from collections import OrderedDict
from typing import Dict, Type
diff --git a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/transports/base.py b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/transports/base.py
index 0f2f7efd48d7..9caa876fa317 100644
--- a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/transports/base.py
+++ b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/transports/base.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,20 +13,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
import abc
-import typing
+from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
+import packaging.version
import pkg_resources
-from google import auth # type: ignore
-from google.api_core import exceptions # type: ignore
+import google.auth # type: ignore
+import google.api_core # type: ignore
+from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core import retry as retries # type: ignore
-from google.auth import credentials # type: ignore
+from google.auth import credentials as ga_credentials # type: ignore
from google.area120.tables_v1alpha1.types import tables
-from google.protobuf import empty_pb2 as empty # type: ignore
-
+from google.protobuf import empty_pb2 # type: ignore
try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
@@ -36,6 +35,17 @@
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
+try:
+ # google.auth.__version__ was added in 1.26.0
+ _GOOGLE_AUTH_VERSION = google.auth.__version__
+except AttributeError:
+ try: # try pkg_resources if it is available
+ _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version
+ except pkg_resources.DistributionNotFound: # pragma: NO COVER
+ _GOOGLE_AUTH_VERSION = None
+
+_API_CORE_VERSION = google.api_core.__version__
+
class TablesServiceTransport(abc.ABC):
"""Abstract transport class for TablesService."""
@@ -49,21 +59,24 @@ class TablesServiceTransport(abc.ABC):
"https://www.googleapis.com/auth/tables",
)
+ DEFAULT_HOST: str = "area120tables.googleapis.com"
+
def __init__(
self,
*,
- host: str = "area120tables.googleapis.com",
- credentials: credentials.Credentials = None,
- credentials_file: typing.Optional[str] = None,
- scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES,
- quota_project_id: typing.Optional[str] = None,
+ host: str = DEFAULT_HOST,
+ credentials: 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,
**kwargs,
) -> None:
"""Instantiate the transport.
Args:
- host (Optional[str]): The hostname to connect to.
+ host (Optional[str]):
+ The hostname to connect to.
credentials (Optional[google.auth.credentials.Credentials]): The
authorization credentials to attach to requests. These
credentials identify the application to the service; if none
@@ -72,7 +85,7 @@ def __init__(
credentials_file (Optional[str]): A file with credentials that can
be loaded with :func:`google.auth.load_credentials_from_file`.
This argument is mutually exclusive with credentials.
- scope (Optional[Sequence[str]]): A list of scopes.
+ scopes (Optional[Sequence[str]]): A list of scopes.
quota_project_id (Optional[str]): An optional project to use for billing
and quota.
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
@@ -86,29 +99,76 @@ def __init__(
host += ":443"
self._host = host
+ scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)
+
# Save the scopes.
self._scopes = scopes or self.AUTH_SCOPES
# If no credentials are provided, then determine the appropriate
# defaults.
if credentials and credentials_file:
- raise exceptions.DuplicateCredentialArgs(
+ raise core_exceptions.DuplicateCredentialArgs(
"'credentials_file' and 'credentials' are mutually exclusive"
)
if credentials_file is not None:
- credentials, _ = auth.load_credentials_from_file(
- credentials_file, scopes=self._scopes, quota_project_id=quota_project_id
+ credentials, _ = google.auth.load_credentials_from_file(
+ credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
)
elif credentials is None:
- credentials, _ = auth.default(
- scopes=self._scopes, quota_project_id=quota_project_id
+ credentials, _ = google.auth.default(
+ **scopes_kwargs, quota_project_id=quota_project_id
)
# Save the credentials.
self._credentials = credentials
+ # TODO(busunkim): These two class methods are in the base transport
+ # to avoid duplicating code across the transport classes. These functions
+ # should be deleted once the minimum required versions of google-api-core
+ # and google-auth are increased.
+
+ # TODO: Remove this function once google-auth >= 1.25.0 is required
+ @classmethod
+ def _get_scopes_kwargs(
+ cls, host: str, scopes: Optional[Sequence[str]]
+ ) -> Dict[str, Optional[Sequence[str]]]:
+ """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version"""
+
+ scopes_kwargs = {}
+
+ if _GOOGLE_AUTH_VERSION and (
+ packaging.version.parse(_GOOGLE_AUTH_VERSION)
+ >= packaging.version.parse("1.25.0")
+ ):
+ scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES}
+ else:
+ scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES}
+
+ return scopes_kwargs
+
+ # TODO: Remove this function once google-api-core >= 1.26.0 is required
+ @classmethod
+ def _get_self_signed_jwt_kwargs(
+ cls, host: str, scopes: Optional[Sequence[str]]
+ ) -> Dict[str, Union[Optional[Sequence[str]], str]]:
+ """Returns kwargs to pass to grpc_helpers.create_channel depending on the google-api-core version"""
+
+ self_signed_jwt_kwargs: Dict[str, Union[Optional[Sequence[str]], str]] = {}
+
+ if _API_CORE_VERSION and (
+ packaging.version.parse(_API_CORE_VERSION)
+ >= packaging.version.parse("1.26.0")
+ ):
+ self_signed_jwt_kwargs["default_scopes"] = cls.AUTH_SCOPES
+ self_signed_jwt_kwargs["scopes"] = scopes
+ self_signed_jwt_kwargs["default_host"] = cls.DEFAULT_HOST
+ else:
+ self_signed_jwt_kwargs["scopes"] = scopes or cls.AUTH_SCOPES
+
+ return self_signed_jwt_kwargs
+
def _prep_wrapped_messages(self, client_info):
# Precompute the wrapped methods.
self._wrapped_methods = {
@@ -153,80 +213,66 @@ def _prep_wrapped_messages(self, client_info):
@property
def get_table(
self,
- ) -> typing.Callable[
- [tables.GetTableRequest],
- typing.Union[tables.Table, typing.Awaitable[tables.Table]],
+ ) -> Callable[
+ [tables.GetTableRequest], Union[tables.Table, Awaitable[tables.Table]]
]:
raise NotImplementedError()
@property
def list_tables(
self,
- ) -> typing.Callable[
+ ) -> Callable[
[tables.ListTablesRequest],
- typing.Union[
- tables.ListTablesResponse, typing.Awaitable[tables.ListTablesResponse]
- ],
+ Union[tables.ListTablesResponse, Awaitable[tables.ListTablesResponse]],
]:
raise NotImplementedError()
@property
def get_workspace(
self,
- ) -> typing.Callable[
+ ) -> Callable[
[tables.GetWorkspaceRequest],
- typing.Union[tables.Workspace, typing.Awaitable[tables.Workspace]],
+ Union[tables.Workspace, Awaitable[tables.Workspace]],
]:
raise NotImplementedError()
@property
def list_workspaces(
self,
- ) -> typing.Callable[
+ ) -> Callable[
[tables.ListWorkspacesRequest],
- typing.Union[
- tables.ListWorkspacesResponse,
- typing.Awaitable[tables.ListWorkspacesResponse],
- ],
+ Union[tables.ListWorkspacesResponse, Awaitable[tables.ListWorkspacesResponse]],
]:
raise NotImplementedError()
@property
def get_row(
self,
- ) -> typing.Callable[
- [tables.GetRowRequest], typing.Union[tables.Row, typing.Awaitable[tables.Row]]
- ]:
+ ) -> Callable[[tables.GetRowRequest], Union[tables.Row, Awaitable[tables.Row]]]:
raise NotImplementedError()
@property
def list_rows(
self,
- ) -> typing.Callable[
+ ) -> Callable[
[tables.ListRowsRequest],
- typing.Union[
- tables.ListRowsResponse, typing.Awaitable[tables.ListRowsResponse]
- ],
+ Union[tables.ListRowsResponse, Awaitable[tables.ListRowsResponse]],
]:
raise NotImplementedError()
@property
def create_row(
self,
- ) -> typing.Callable[
- [tables.CreateRowRequest],
- typing.Union[tables.Row, typing.Awaitable[tables.Row]],
- ]:
+ ) -> Callable[[tables.CreateRowRequest], Union[tables.Row, Awaitable[tables.Row]]]:
raise NotImplementedError()
@property
def batch_create_rows(
self,
- ) -> typing.Callable[
+ ) -> Callable[
[tables.BatchCreateRowsRequest],
- typing.Union[
- tables.BatchCreateRowsResponse,
- typing.Awaitable[tables.BatchCreateRowsResponse],
+ Union[
+ tables.BatchCreateRowsResponse, Awaitable[tables.BatchCreateRowsResponse]
],
]:
raise NotImplementedError()
@@ -234,20 +280,16 @@ def batch_create_rows(
@property
def update_row(
self,
- ) -> typing.Callable[
- [tables.UpdateRowRequest],
- typing.Union[tables.Row, typing.Awaitable[tables.Row]],
- ]:
+ ) -> Callable[[tables.UpdateRowRequest], Union[tables.Row, Awaitable[tables.Row]]]:
raise NotImplementedError()
@property
def batch_update_rows(
self,
- ) -> typing.Callable[
+ ) -> Callable[
[tables.BatchUpdateRowsRequest],
- typing.Union[
- tables.BatchUpdateRowsResponse,
- typing.Awaitable[tables.BatchUpdateRowsResponse],
+ Union[
+ tables.BatchUpdateRowsResponse, Awaitable[tables.BatchUpdateRowsResponse]
],
]:
raise NotImplementedError()
@@ -255,18 +297,17 @@ def batch_update_rows(
@property
def delete_row(
self,
- ) -> typing.Callable[
- [tables.DeleteRowRequest],
- typing.Union[empty.Empty, typing.Awaitable[empty.Empty]],
+ ) -> Callable[
+ [tables.DeleteRowRequest], Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]]
]:
raise NotImplementedError()
@property
def batch_delete_rows(
self,
- ) -> typing.Callable[
+ ) -> Callable[
[tables.BatchDeleteRowsRequest],
- typing.Union[empty.Empty, typing.Awaitable[empty.Empty]],
+ Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]],
]:
raise NotImplementedError()
diff --git a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/transports/grpc.py b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/transports/grpc.py
index 4b031d41ceb6..f4a73427db44 100644
--- a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/transports/grpc.py
+++ b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/transports/grpc.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,21 +13,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
import warnings
-from typing import Callable, Dict, Optional, Sequence, Tuple
+from typing import Callable, Dict, Optional, Sequence, Tuple, Union
from google.api_core import grpc_helpers # type: ignore
from google.api_core import gapic_v1 # type: ignore
-from google import auth # type: ignore
-from google.auth import credentials # type: ignore
+import google.auth # type: ignore
+from google.auth import credentials as ga_credentials # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
import grpc # type: ignore
from google.area120.tables_v1alpha1.types import tables
-from google.protobuf import empty_pb2 as empty # type: ignore
-
+from google.protobuf import empty_pb2 # type: ignore
from .base import TablesServiceTransport, DEFAULT_CLIENT_INFO
@@ -64,7 +61,7 @@ def __init__(
self,
*,
host: str = "area120tables.googleapis.com",
- credentials: credentials.Credentials = None,
+ credentials: ga_credentials.Credentials = None,
credentials_file: str = None,
scopes: Sequence[str] = None,
channel: grpc.Channel = None,
@@ -78,7 +75,8 @@ def __init__(
"""Instantiate the transport.
Args:
- host (Optional[str]): The hostname to connect to.
+ host (Optional[str]):
+ The hostname to connect to.
credentials (Optional[google.auth.credentials.Credentials]): The
authorization credentials to attach to requests. These
credentials identify the application to the service; if none
@@ -188,7 +186,7 @@ def __init__(
def create_channel(
cls,
host: str = "area120tables.googleapis.com",
- credentials: credentials.Credentials = None,
+ credentials: ga_credentials.Credentials = None,
credentials_file: str = None,
scopes: Optional[Sequence[str]] = None,
quota_project_id: Optional[str] = None,
@@ -219,13 +217,15 @@ def create_channel(
google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
and ``credentials_file`` are passed.
"""
- scopes = scopes or cls.AUTH_SCOPES
+
+ self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes)
+
return grpc_helpers.create_channel(
host,
credentials=credentials,
credentials_file=credentials_file,
- scopes=scopes,
quota_project_id=quota_project_id,
+ **self_signed_jwt_kwargs,
**kwargs,
)
@@ -487,7 +487,7 @@ def batch_update_rows(
return self._stubs["batch_update_rows"]
@property
- def delete_row(self) -> Callable[[tables.DeleteRowRequest], empty.Empty]:
+ def delete_row(self) -> Callable[[tables.DeleteRowRequest], empty_pb2.Empty]:
r"""Return a callable for the delete row method over gRPC.
Deletes a row.
@@ -506,14 +506,14 @@ def delete_row(self) -> Callable[[tables.DeleteRowRequest], empty.Empty]:
self._stubs["delete_row"] = self.grpc_channel.unary_unary(
"/google.area120.tables.v1alpha1.TablesService/DeleteRow",
request_serializer=tables.DeleteRowRequest.serialize,
- response_deserializer=empty.Empty.FromString,
+ response_deserializer=empty_pb2.Empty.FromString,
)
return self._stubs["delete_row"]
@property
def batch_delete_rows(
self,
- ) -> Callable[[tables.BatchDeleteRowsRequest], empty.Empty]:
+ ) -> Callable[[tables.BatchDeleteRowsRequest], empty_pb2.Empty]:
r"""Return a callable for the batch delete rows method over gRPC.
Deletes multiple rows.
@@ -532,7 +532,7 @@ def batch_delete_rows(
self._stubs["batch_delete_rows"] = self.grpc_channel.unary_unary(
"/google.area120.tables.v1alpha1.TablesService/BatchDeleteRows",
request_serializer=tables.BatchDeleteRowsRequest.serialize,
- response_deserializer=empty.Empty.FromString,
+ response_deserializer=empty_pb2.Empty.FromString,
)
return self._stubs["batch_delete_rows"]
diff --git a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/transports/grpc_asyncio.py b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/transports/grpc_asyncio.py
index 45a9fc9dd33d..c3ff8005e995 100644
--- a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/transports/grpc_asyncio.py
+++ b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/transports/grpc_asyncio.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,22 +13,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
import warnings
-from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple
+from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
from google.api_core import gapic_v1 # type: ignore
from google.api_core import grpc_helpers_async # type: ignore
-from google import auth # type: ignore
-from google.auth import credentials # type: ignore
+from google.auth import credentials as ga_credentials # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
+import packaging.version
import grpc # type: ignore
from grpc.experimental import aio # type: ignore
from google.area120.tables_v1alpha1.types import tables
-from google.protobuf import empty_pb2 as empty # type: ignore
-
+from google.protobuf import empty_pb2 # type: ignore
from .base import TablesServiceTransport, DEFAULT_CLIENT_INFO
from .grpc import TablesServiceGrpcTransport
@@ -67,7 +64,7 @@ class TablesServiceGrpcAsyncIOTransport(TablesServiceTransport):
def create_channel(
cls,
host: str = "area120tables.googleapis.com",
- credentials: credentials.Credentials = None,
+ credentials: ga_credentials.Credentials = None,
credentials_file: Optional[str] = None,
scopes: Optional[Sequence[str]] = None,
quota_project_id: Optional[str] = None,
@@ -94,13 +91,15 @@ def create_channel(
Returns:
aio.Channel: A gRPC AsyncIO channel object.
"""
- scopes = scopes or cls.AUTH_SCOPES
+
+ self_signed_jwt_kwargs = cls._get_self_signed_jwt_kwargs(host, scopes)
+
return grpc_helpers_async.create_channel(
host,
credentials=credentials,
credentials_file=credentials_file,
- scopes=scopes,
quota_project_id=quota_project_id,
+ **self_signed_jwt_kwargs,
**kwargs,
)
@@ -108,7 +107,7 @@ def __init__(
self,
*,
host: str = "area120tables.googleapis.com",
- credentials: credentials.Credentials = None,
+ credentials: ga_credentials.Credentials = None,
credentials_file: Optional[str] = None,
scopes: Optional[Sequence[str]] = None,
channel: aio.Channel = None,
@@ -122,7 +121,8 @@ def __init__(
"""Instantiate the transport.
Args:
- host (Optional[str]): The hostname to connect to.
+ host (Optional[str]):
+ The hostname to connect to.
credentials (Optional[google.auth.credentials.Credentials]): The
authorization credentials to attach to requests. These
credentials identify the application to the service; if none
@@ -180,7 +180,6 @@ def __init__(
# If a channel was explicitly provided, set it.
self._grpc_channel = channel
self._ssl_channel_credentials = None
-
else:
if api_mtls_endpoint:
host = api_mtls_endpoint
@@ -501,7 +500,9 @@ def batch_update_rows(
return self._stubs["batch_update_rows"]
@property
- def delete_row(self) -> Callable[[tables.DeleteRowRequest], Awaitable[empty.Empty]]:
+ def delete_row(
+ self,
+ ) -> Callable[[tables.DeleteRowRequest], Awaitable[empty_pb2.Empty]]:
r"""Return a callable for the delete row method over gRPC.
Deletes a row.
@@ -520,14 +521,14 @@ def delete_row(self) -> Callable[[tables.DeleteRowRequest], Awaitable[empty.Empt
self._stubs["delete_row"] = self.grpc_channel.unary_unary(
"/google.area120.tables.v1alpha1.TablesService/DeleteRow",
request_serializer=tables.DeleteRowRequest.serialize,
- response_deserializer=empty.Empty.FromString,
+ response_deserializer=empty_pb2.Empty.FromString,
)
return self._stubs["delete_row"]
@property
def batch_delete_rows(
self,
- ) -> Callable[[tables.BatchDeleteRowsRequest], Awaitable[empty.Empty]]:
+ ) -> Callable[[tables.BatchDeleteRowsRequest], Awaitable[empty_pb2.Empty]]:
r"""Return a callable for the batch delete rows method over gRPC.
Deletes multiple rows.
@@ -546,7 +547,7 @@ def batch_delete_rows(
self._stubs["batch_delete_rows"] = self.grpc_channel.unary_unary(
"/google.area120.tables.v1alpha1.TablesService/BatchDeleteRows",
request_serializer=tables.BatchDeleteRowsRequest.serialize,
- response_deserializer=empty.Empty.FromString,
+ response_deserializer=empty_pb2.Empty.FromString,
)
return self._stubs["batch_delete_rows"]
diff --git a/packages/google-area120-tables/google/area120/tables_v1alpha1/types/__init__.py b/packages/google-area120-tables/google/area120/tables_v1alpha1/types/__init__.py
index c55da2ebd4e3..d57d90342c95 100644
--- a/packages/google-area120-tables/google/area120/tables_v1alpha1/types/__init__.py
+++ b/packages/google-area120-tables/google/area120/tables_v1alpha1/types/__init__.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
from .tables import (
BatchCreateRowsRequest,
BatchCreateRowsResponse,
diff --git a/packages/google-area120-tables/google/area120/tables_v1alpha1/types/tables.py b/packages/google-area120-tables/google/area120/tables_v1alpha1/types/tables.py
index b37d92c43dcd..359bcd07b0b4 100644
--- a/packages/google-area120-tables/google/area120/tables_v1alpha1/types/tables.py
+++ b/packages/google-area120-tables/google/area120/tables_v1alpha1/types/tables.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,12 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
import proto # type: ignore
-
-from google.protobuf import field_mask_pb2 as field_mask # type: ignore
-from google.protobuf import struct_pb2 as struct # type: ignore
+from google.protobuf import field_mask_pb2 # type: ignore
+from google.protobuf import struct_pb2 # type: ignore
__protobuf__ = proto.module(
@@ -62,19 +59,17 @@ class View(proto.Enum):
class GetTableRequest(proto.Message):
r"""Request message for TablesService.GetTable.
-
Attributes:
name (str):
Required. The name of the table to retrieve.
Format: tables/{table}
"""
- name = proto.Field(proto.STRING, number=1)
+ name = proto.Field(proto.STRING, number=1,)
class ListTablesRequest(proto.Message):
r"""Request message for TablesService.ListTables.
-
Attributes:
page_size (int):
The maximum number of tables to return. The
@@ -92,14 +87,12 @@ class ListTablesRequest(proto.Message):
token.
"""
- page_size = proto.Field(proto.INT32, number=1)
-
- page_token = proto.Field(proto.STRING, number=2)
+ page_size = proto.Field(proto.INT32, number=1,)
+ page_token = proto.Field(proto.STRING, number=2,)
class ListTablesResponse(proto.Message):
r"""Response message for TablesService.ListTables.
-
Attributes:
tables (Sequence[google.area120.tables_v1alpha1.types.Table]):
The list of tables.
@@ -114,25 +107,22 @@ def raw_page(self):
return self
tables = proto.RepeatedField(proto.MESSAGE, number=1, message="Table",)
-
- next_page_token = proto.Field(proto.STRING, number=2)
+ next_page_token = proto.Field(proto.STRING, number=2,)
class GetWorkspaceRequest(proto.Message):
r"""Request message for TablesService.GetWorkspace.
-
Attributes:
name (str):
Required. The name of the workspace to
retrieve. Format: workspaces/{workspace}
"""
- name = proto.Field(proto.STRING, number=1)
+ name = proto.Field(proto.STRING, number=1,)
class ListWorkspacesRequest(proto.Message):
r"""Request message for TablesService.ListWorkspaces.
-
Attributes:
page_size (int):
The maximum number of workspaces to return.
@@ -149,14 +139,12 @@ class ListWorkspacesRequest(proto.Message):
page token.
"""
- page_size = proto.Field(proto.INT32, number=1)
-
- page_token = proto.Field(proto.STRING, number=2)
+ page_size = proto.Field(proto.INT32, number=1,)
+ page_token = proto.Field(proto.STRING, number=2,)
class ListWorkspacesResponse(proto.Message):
r"""Response message for TablesService.ListWorkspaces.
-
Attributes:
workspaces (Sequence[google.area120.tables_v1alpha1.types.Workspace]):
The list of workspaces.
@@ -171,13 +159,11 @@ def raw_page(self):
return self
workspaces = proto.RepeatedField(proto.MESSAGE, number=1, message="Workspace",)
-
- next_page_token = proto.Field(proto.STRING, number=2)
+ next_page_token = proto.Field(proto.STRING, number=2,)
class GetRowRequest(proto.Message):
r"""Request message for TablesService.GetRow.
-
Attributes:
name (str):
Required. The name of the row to retrieve.
@@ -187,14 +173,12 @@ class GetRowRequest(proto.Message):
row. Defaults to user entered name.
"""
- name = proto.Field(proto.STRING, number=1)
-
+ name = proto.Field(proto.STRING, number=1,)
view = proto.Field(proto.ENUM, number=2, enum="View",)
class ListRowsRequest(proto.Message):
r"""Request message for TablesService.ListRows.
-
Attributes:
parent (str):
Required. The parent table.
@@ -223,20 +207,15 @@ class ListRowsRequest(proto.Message):
filtering not supported.
"""
- parent = proto.Field(proto.STRING, number=1)
-
- page_size = proto.Field(proto.INT32, number=2)
-
- page_token = proto.Field(proto.STRING, number=3)
-
+ parent = proto.Field(proto.STRING, number=1,)
+ page_size = proto.Field(proto.INT32, number=2,)
+ page_token = proto.Field(proto.STRING, number=3,)
view = proto.Field(proto.ENUM, number=4, enum="View",)
-
- filter = proto.Field(proto.STRING, number=5)
+ filter = proto.Field(proto.STRING, number=5,)
class ListRowsResponse(proto.Message):
r"""Response message for TablesService.ListRows.
-
Attributes:
rows (Sequence[google.area120.tables_v1alpha1.types.Row]):
The rows from the specified table.
@@ -251,13 +230,11 @@ def raw_page(self):
return self
rows = proto.RepeatedField(proto.MESSAGE, number=1, message="Row",)
-
- next_page_token = proto.Field(proto.STRING, number=2)
+ next_page_token = proto.Field(proto.STRING, number=2,)
class CreateRowRequest(proto.Message):
r"""Request message for TablesService.CreateRow.
-
Attributes:
parent (str):
Required. The parent table where this row
@@ -269,16 +246,13 @@ class CreateRowRequest(proto.Message):
row. Defaults to user entered name.
"""
- parent = proto.Field(proto.STRING, number=1)
-
+ parent = proto.Field(proto.STRING, number=1,)
row = proto.Field(proto.MESSAGE, number=2, message="Row",)
-
view = proto.Field(proto.ENUM, number=3, enum="View",)
class BatchCreateRowsRequest(proto.Message):
r"""Request message for TablesService.BatchCreateRows.
-
Attributes:
parent (str):
Required. The parent table where the rows
@@ -290,14 +264,12 @@ class BatchCreateRowsRequest(proto.Message):
batch.
"""
- parent = proto.Field(proto.STRING, number=1)
-
+ parent = proto.Field(proto.STRING, number=1,)
requests = proto.RepeatedField(proto.MESSAGE, number=2, message="CreateRowRequest",)
class BatchCreateRowsResponse(proto.Message):
r"""Response message for TablesService.BatchCreateRows.
-
Attributes:
rows (Sequence[google.area120.tables_v1alpha1.types.Row]):
The created rows.
@@ -308,7 +280,6 @@ class BatchCreateRowsResponse(proto.Message):
class UpdateRowRequest(proto.Message):
r"""Request message for TablesService.UpdateRow.
-
Attributes:
row (google.area120.tables_v1alpha1.types.Row):
Required. The row to update.
@@ -320,15 +291,14 @@ class UpdateRowRequest(proto.Message):
"""
row = proto.Field(proto.MESSAGE, number=1, message="Row",)
-
- update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask,)
-
+ update_mask = proto.Field(
+ proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask,
+ )
view = proto.Field(proto.ENUM, number=3, enum="View",)
class BatchUpdateRowsRequest(proto.Message):
r"""Request message for TablesService.BatchUpdateRows.
-
Attributes:
parent (str):
Required. The parent table shared by all rows
@@ -340,14 +310,12 @@ class BatchUpdateRowsRequest(proto.Message):
single batch.
"""
- parent = proto.Field(proto.STRING, number=1)
-
+ parent = proto.Field(proto.STRING, number=1,)
requests = proto.RepeatedField(proto.MESSAGE, number=2, message="UpdateRowRequest",)
class BatchUpdateRowsResponse(proto.Message):
r"""Response message for TablesService.BatchUpdateRows.
-
Attributes:
rows (Sequence[google.area120.tables_v1alpha1.types.Row]):
The updated rows.
@@ -358,19 +326,17 @@ class BatchUpdateRowsResponse(proto.Message):
class DeleteRowRequest(proto.Message):
r"""Request message for TablesService.DeleteRow
-
Attributes:
name (str):
Required. The name of the row to delete.
Format: tables/{table}/rows/{row}
"""
- name = proto.Field(proto.STRING, number=1)
+ name = proto.Field(proto.STRING, number=1,)
class BatchDeleteRowsRequest(proto.Message):
r"""Request message for TablesService.BatchDeleteRows
-
Attributes:
parent (str):
Required. The parent table shared by all rows
@@ -383,14 +349,12 @@ class BatchDeleteRowsRequest(proto.Message):
Format: tables/{table}/rows/{row}
"""
- parent = proto.Field(proto.STRING, number=1)
-
- names = proto.RepeatedField(proto.STRING, number=2)
+ parent = proto.Field(proto.STRING, number=1,)
+ names = proto.RepeatedField(proto.STRING, number=2,)
class Table(proto.Message):
r"""A single table.
-
Attributes:
name (str):
The resource name of the table. Table names have the form
@@ -402,16 +366,13 @@ class Table(proto.Message):
Order of columns matches the display order.
"""
- name = proto.Field(proto.STRING, number=1)
-
- display_name = proto.Field(proto.STRING, number=2)
-
+ name = proto.Field(proto.STRING, number=1,)
+ display_name = proto.Field(proto.STRING, number=2,)
columns = proto.RepeatedField(proto.MESSAGE, number=3, message="ColumnDescription",)
class ColumnDescription(proto.Message):
r"""Details on a column in the table.
-
Attributes:
name (str):
column name
@@ -443,24 +404,18 @@ class ColumnDescription(proto.Message):
relationship column.
"""
- name = proto.Field(proto.STRING, number=1)
-
- data_type = proto.Field(proto.STRING, number=2)
-
- id = proto.Field(proto.STRING, number=3)
-
+ name = proto.Field(proto.STRING, number=1,)
+ data_type = proto.Field(proto.STRING, number=2,)
+ id = proto.Field(proto.STRING, number=3,)
labels = proto.RepeatedField(proto.MESSAGE, number=4, message="LabeledItem",)
-
relationship_details = proto.Field(
proto.MESSAGE, number=5, message="RelationshipDetails",
)
-
lookup_details = proto.Field(proto.MESSAGE, number=6, message="LookupDetails",)
class LabeledItem(proto.Message):
r"""A single item in a labeled column.
-
Attributes:
name (str):
Display string as entered by user.
@@ -468,21 +423,19 @@ class LabeledItem(proto.Message):
Internal id associated with the item.
"""
- name = proto.Field(proto.STRING, number=1)
-
- id = proto.Field(proto.STRING, number=2)
+ name = proto.Field(proto.STRING, number=1,)
+ id = proto.Field(proto.STRING, number=2,)
class RelationshipDetails(proto.Message):
r"""Details about a relationship column.
-
Attributes:
linked_table (str):
The name of the table this relationship is
linked to.
"""
- linked_table = proto.Field(proto.STRING, number=1)
+ linked_table = proto.Field(proto.STRING, number=1,)
class LookupDetails(proto.Message):
@@ -497,14 +450,12 @@ class LookupDetails(proto.Message):
The id of the relationship column.
"""
- relationship_column = proto.Field(proto.STRING, number=1)
-
- relationship_column_id = proto.Field(proto.STRING, number=2)
+ relationship_column = proto.Field(proto.STRING, number=1,)
+ relationship_column_id = proto.Field(proto.STRING, number=2,)
class Row(proto.Message):
r"""A single row in a table.
-
Attributes:
name (str):
The resource name of the row. Row names have the form
@@ -517,16 +468,14 @@ class Row(proto.Message):
the view in the request.
"""
- name = proto.Field(proto.STRING, number=1)
-
+ name = proto.Field(proto.STRING, number=1,)
values = proto.MapField(
- proto.STRING, proto.MESSAGE, number=2, message=struct.Value,
+ proto.STRING, proto.MESSAGE, number=2, message=struct_pb2.Value,
)
class Workspace(proto.Message):
r"""A single workspace.
-
Attributes:
name (str):
The resource name of the workspace. Workspace names have the
@@ -537,10 +486,8 @@ class Workspace(proto.Message):
The list of tables in the workspace.
"""
- name = proto.Field(proto.STRING, number=1)
-
- display_name = proto.Field(proto.STRING, number=2)
-
+ name = proto.Field(proto.STRING, number=1,)
+ display_name = proto.Field(proto.STRING, number=2,)
tables = proto.RepeatedField(proto.MESSAGE, number=3, message="Table",)
diff --git a/packages/google-area120-tables/tests/__init__.py b/packages/google-area120-tables/tests/__init__.py
new file mode 100644
index 000000000000..4de65971c238
--- /dev/null
+++ b/packages/google-area120-tables/tests/__init__.py
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
diff --git a/packages/google-area120-tables/tests/unit/__init__.py b/packages/google-area120-tables/tests/unit/__init__.py
new file mode 100644
index 000000000000..4de65971c238
--- /dev/null
+++ b/packages/google-area120-tables/tests/unit/__init__.py
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
diff --git a/packages/google-area120-tables/tests/unit/gapic/__init__.py b/packages/google-area120-tables/tests/unit/gapic/__init__.py
new file mode 100644
index 000000000000..4de65971c238
--- /dev/null
+++ b/packages/google-area120-tables/tests/unit/gapic/__init__.py
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
diff --git a/packages/google-area120-tables/tests/unit/gapic/tables_v1alpha1/__init__.py b/packages/google-area120-tables/tests/unit/gapic/tables_v1alpha1/__init__.py
index 42ffdf2bc43d..4de65971c238 100644
--- a/packages/google-area120-tables/tests/unit/gapic/tables_v1alpha1/__init__.py
+++ b/packages/google-area120-tables/tests/unit/gapic/tables_v1alpha1/__init__.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/packages/google-area120-tables/tests/unit/gapic/tables_v1alpha1/test_tables_service.py b/packages/google-area120-tables/tests/unit/gapic/tables_v1alpha1/test_tables_service.py
index 68bca60d3690..02011b24f17d 100644
--- a/packages/google-area120-tables/tests/unit/gapic/tables_v1alpha1/test_tables_service.py
+++ b/packages/google-area120-tables/tests/unit/gapic/tables_v1alpha1/test_tables_service.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,9 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
import os
import mock
+import packaging.version
import grpc
from grpc.experimental import aio
@@ -24,9 +23,9 @@
import pytest
from proto.marshal.rules.dates import DurationRule, TimestampRule
-from google import auth
+
from google.api_core import client_options
-from google.api_core import exceptions
+from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1
from google.api_core import grpc_helpers
from google.api_core import grpc_helpers_async
@@ -36,12 +35,42 @@
from google.area120.tables_v1alpha1.services.tables_service import TablesServiceClient
from google.area120.tables_v1alpha1.services.tables_service import pagers
from google.area120.tables_v1alpha1.services.tables_service import transports
+from google.area120.tables_v1alpha1.services.tables_service.transports.base import (
+ _API_CORE_VERSION,
+)
+from google.area120.tables_v1alpha1.services.tables_service.transports.base import (
+ _GOOGLE_AUTH_VERSION,
+)
from google.area120.tables_v1alpha1.types import tables
-from google.auth import credentials
+from google.auth import credentials as ga_credentials
from google.auth.exceptions import MutualTLSChannelError
from google.oauth2 import service_account
-from google.protobuf import field_mask_pb2 as field_mask # type: ignore
-from google.protobuf import struct_pb2 as struct # type: ignore
+from google.protobuf import field_mask_pb2 # type: ignore
+from google.protobuf import struct_pb2 # type: ignore
+import google.auth
+
+
+# TODO(busunkim): Once google-api-core >= 1.26.0 is required:
+# - Delete all the api-core and auth "less than" test cases
+# - Delete these pytest markers (Make the "greater than or equal to" tests the default).
+requires_google_auth_lt_1_25_0 = pytest.mark.skipif(
+ packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"),
+ reason="This test requires google-auth < 1.25.0",
+)
+requires_google_auth_gte_1_25_0 = pytest.mark.skipif(
+ packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"),
+ reason="This test requires google-auth >= 1.25.0",
+)
+
+requires_api_core_lt_1_26_0 = pytest.mark.skipif(
+ packaging.version.parse(_API_CORE_VERSION) >= packaging.version.parse("1.26.0"),
+ reason="This test requires google-api-core < 1.26.0",
+)
+
+requires_api_core_gte_1_26_0 = pytest.mark.skipif(
+ packaging.version.parse(_API_CORE_VERSION) < packaging.version.parse("1.26.0"),
+ reason="This test requires google-api-core >= 1.26.0",
+)
def client_cert_source_callback():
@@ -92,7 +121,7 @@ def test__get_default_mtls_endpoint():
"client_class", [TablesServiceClient, TablesServiceAsyncClient,]
)
def test_tables_service_client_from_service_account_info(client_class):
- creds = credentials.AnonymousCredentials()
+ creds = ga_credentials.AnonymousCredentials()
with mock.patch.object(
service_account.Credentials, "from_service_account_info"
) as factory:
@@ -109,7 +138,7 @@ def test_tables_service_client_from_service_account_info(client_class):
"client_class", [TablesServiceClient, TablesServiceAsyncClient,]
)
def test_tables_service_client_from_service_account_file(client_class):
- creds = credentials.AnonymousCredentials()
+ creds = ga_credentials.AnonymousCredentials()
with mock.patch.object(
service_account.Credentials, "from_service_account_file"
) as factory:
@@ -162,7 +191,7 @@ def test_tables_service_client_client_options(
):
# Check that if channel is provided we won't create a new one.
with mock.patch.object(TablesServiceClient, "get_transport_class") as gtc:
- transport = transport_class(credentials=credentials.AnonymousCredentials())
+ transport = transport_class(credentials=ga_credentials.AnonymousCredentials())
client = client_class(transport=transport)
gtc.assert_not_called()
@@ -448,7 +477,7 @@ def test_tables_service_client_client_options_from_dict():
def test_get_table(transport: str = "grpc", request_type=tables.GetTableRequest):
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -461,21 +490,16 @@ def test_get_table(transport: str = "grpc", request_type=tables.GetTableRequest)
call.return_value = tables.Table(
name="name_value", display_name="display_name_value",
)
-
response = client.get_table(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.GetTableRequest()
# Establish that the response is the type that we expect.
-
assert isinstance(response, tables.Table)
-
assert response.name == "name_value"
-
assert response.display_name == "display_name_value"
@@ -487,7 +511,7 @@ def test_get_table_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -495,7 +519,6 @@ def test_get_table_empty_call():
client.get_table()
call.assert_called()
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.GetTableRequest()
@@ -504,7 +527,7 @@ async def test_get_table_async(
transport: str = "grpc_asyncio", request_type=tables.GetTableRequest
):
client = TablesServiceAsyncClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -517,20 +540,16 @@ async def test_get_table_async(
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
tables.Table(name="name_value", display_name="display_name_value",)
)
-
response = await client.get_table(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.GetTableRequest()
# Establish that the response is the type that we expect.
assert isinstance(response, tables.Table)
-
assert response.name == "name_value"
-
assert response.display_name == "display_name_value"
@@ -540,17 +559,17 @@ async def test_get_table_async_from_dict():
def test_get_table_field_headers():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = tables.GetTableRequest()
+
request.name = "name/value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_table), "__call__") as call:
call.return_value = tables.Table()
-
client.get_table(request)
# Establish that the underlying gRPC stub method was called.
@@ -565,17 +584,19 @@ def test_get_table_field_headers():
@pytest.mark.asyncio
async def test_get_table_field_headers_async():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceAsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = tables.GetTableRequest()
+
request.name = "name/value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_table), "__call__") as call:
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(tables.Table())
-
await client.get_table(request)
# Establish that the underlying gRPC stub method was called.
@@ -589,13 +610,12 @@ async def test_get_table_field_headers_async():
def test_get_table_flattened():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_table), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = tables.Table()
-
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
client.get_table(name="name_value",)
@@ -604,12 +624,11 @@ def test_get_table_flattened():
# request object values.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
-
assert args[0].name == "name_value"
def test_get_table_flattened_error():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
# Attempting to call a method with both a request object and flattened
# fields is an error.
@@ -621,7 +640,9 @@ def test_get_table_flattened_error():
@pytest.mark.asyncio
async def test_get_table_flattened_async():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceAsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_table), "__call__") as call:
@@ -637,13 +658,14 @@ async def test_get_table_flattened_async():
# request object values.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
-
assert args[0].name == "name_value"
@pytest.mark.asyncio
async def test_get_table_flattened_error_async():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceAsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
@@ -655,7 +677,7 @@ async def test_get_table_flattened_error_async():
def test_list_tables(transport: str = "grpc", request_type=tables.ListTablesRequest):
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -668,19 +690,15 @@ def test_list_tables(transport: str = "grpc", request_type=tables.ListTablesRequ
call.return_value = tables.ListTablesResponse(
next_page_token="next_page_token_value",
)
-
response = client.list_tables(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.ListTablesRequest()
# Establish that the response is the type that we expect.
-
assert isinstance(response, pagers.ListTablesPager)
-
assert response.next_page_token == "next_page_token_value"
@@ -692,7 +710,7 @@ def test_list_tables_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -700,7 +718,6 @@ def test_list_tables_empty_call():
client.list_tables()
call.assert_called()
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.ListTablesRequest()
@@ -709,7 +726,7 @@ async def test_list_tables_async(
transport: str = "grpc_asyncio", request_type=tables.ListTablesRequest
):
client = TablesServiceAsyncClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -722,18 +739,15 @@ async def test_list_tables_async(
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
tables.ListTablesResponse(next_page_token="next_page_token_value",)
)
-
response = await client.list_tables(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.ListTablesRequest()
# Establish that the response is the type that we expect.
assert isinstance(response, pagers.ListTablesAsyncPager)
-
assert response.next_page_token == "next_page_token_value"
@@ -743,7 +757,7 @@ async def test_list_tables_async_from_dict():
def test_list_tables_pager():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials,)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials,)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_tables), "__call__") as call:
@@ -770,7 +784,7 @@ def test_list_tables_pager():
def test_list_tables_pages():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials,)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials,)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_tables), "__call__") as call:
@@ -792,7 +806,7 @@ def test_list_tables_pages():
@pytest.mark.asyncio
async def test_list_tables_async_pager():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials,)
+ client = TablesServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials,)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
@@ -821,7 +835,7 @@ async def test_list_tables_async_pager():
@pytest.mark.asyncio
async def test_list_tables_async_pages():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials,)
+ client = TablesServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials,)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
@@ -849,7 +863,7 @@ def test_get_workspace(
transport: str = "grpc", request_type=tables.GetWorkspaceRequest
):
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -862,21 +876,16 @@ def test_get_workspace(
call.return_value = tables.Workspace(
name="name_value", display_name="display_name_value",
)
-
response = client.get_workspace(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.GetWorkspaceRequest()
# Establish that the response is the type that we expect.
-
assert isinstance(response, tables.Workspace)
-
assert response.name == "name_value"
-
assert response.display_name == "display_name_value"
@@ -888,7 +897,7 @@ def test_get_workspace_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -896,7 +905,6 @@ def test_get_workspace_empty_call():
client.get_workspace()
call.assert_called()
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.GetWorkspaceRequest()
@@ -905,7 +913,7 @@ async def test_get_workspace_async(
transport: str = "grpc_asyncio", request_type=tables.GetWorkspaceRequest
):
client = TablesServiceAsyncClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -918,20 +926,16 @@ async def test_get_workspace_async(
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
tables.Workspace(name="name_value", display_name="display_name_value",)
)
-
response = await client.get_workspace(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.GetWorkspaceRequest()
# Establish that the response is the type that we expect.
assert isinstance(response, tables.Workspace)
-
assert response.name == "name_value"
-
assert response.display_name == "display_name_value"
@@ -941,17 +945,17 @@ async def test_get_workspace_async_from_dict():
def test_get_workspace_field_headers():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = tables.GetWorkspaceRequest()
+
request.name = "name/value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_workspace), "__call__") as call:
call.return_value = tables.Workspace()
-
client.get_workspace(request)
# Establish that the underlying gRPC stub method was called.
@@ -966,17 +970,19 @@ def test_get_workspace_field_headers():
@pytest.mark.asyncio
async def test_get_workspace_field_headers_async():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceAsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = tables.GetWorkspaceRequest()
+
request.name = "name/value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_workspace), "__call__") as call:
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(tables.Workspace())
-
await client.get_workspace(request)
# Establish that the underlying gRPC stub method was called.
@@ -990,13 +996,12 @@ async def test_get_workspace_field_headers_async():
def test_get_workspace_flattened():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_workspace), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = tables.Workspace()
-
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
client.get_workspace(name="name_value",)
@@ -1005,12 +1010,11 @@ def test_get_workspace_flattened():
# request object values.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
-
assert args[0].name == "name_value"
def test_get_workspace_flattened_error():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
# Attempting to call a method with both a request object and flattened
# fields is an error.
@@ -1022,7 +1026,9 @@ def test_get_workspace_flattened_error():
@pytest.mark.asyncio
async def test_get_workspace_flattened_async():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceAsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_workspace), "__call__") as call:
@@ -1038,13 +1044,14 @@ async def test_get_workspace_flattened_async():
# request object values.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
-
assert args[0].name == "name_value"
@pytest.mark.asyncio
async def test_get_workspace_flattened_error_async():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceAsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
@@ -1058,7 +1065,7 @@ def test_list_workspaces(
transport: str = "grpc", request_type=tables.ListWorkspacesRequest
):
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1071,19 +1078,15 @@ def test_list_workspaces(
call.return_value = tables.ListWorkspacesResponse(
next_page_token="next_page_token_value",
)
-
response = client.list_workspaces(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.ListWorkspacesRequest()
# Establish that the response is the type that we expect.
-
assert isinstance(response, pagers.ListWorkspacesPager)
-
assert response.next_page_token == "next_page_token_value"
@@ -1095,7 +1098,7 @@ def test_list_workspaces_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1103,7 +1106,6 @@ def test_list_workspaces_empty_call():
client.list_workspaces()
call.assert_called()
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.ListWorkspacesRequest()
@@ -1112,7 +1114,7 @@ async def test_list_workspaces_async(
transport: str = "grpc_asyncio", request_type=tables.ListWorkspacesRequest
):
client = TablesServiceAsyncClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1125,18 +1127,15 @@ async def test_list_workspaces_async(
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
tables.ListWorkspacesResponse(next_page_token="next_page_token_value",)
)
-
response = await client.list_workspaces(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.ListWorkspacesRequest()
# Establish that the response is the type that we expect.
assert isinstance(response, pagers.ListWorkspacesAsyncPager)
-
assert response.next_page_token == "next_page_token_value"
@@ -1146,7 +1145,7 @@ async def test_list_workspaces_async_from_dict():
def test_list_workspaces_pager():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials,)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials,)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_workspaces), "__call__") as call:
@@ -1181,7 +1180,7 @@ def test_list_workspaces_pager():
def test_list_workspaces_pages():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials,)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials,)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_workspaces), "__call__") as call:
@@ -1211,7 +1210,7 @@ def test_list_workspaces_pages():
@pytest.mark.asyncio
async def test_list_workspaces_async_pager():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials,)
+ client = TablesServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials,)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
@@ -1248,7 +1247,7 @@ async def test_list_workspaces_async_pager():
@pytest.mark.asyncio
async def test_list_workspaces_async_pages():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials,)
+ client = TablesServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials,)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
@@ -1282,7 +1281,7 @@ async def test_list_workspaces_async_pages():
def test_get_row(transport: str = "grpc", request_type=tables.GetRowRequest):
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1293,19 +1292,15 @@ def test_get_row(transport: str = "grpc", request_type=tables.GetRowRequest):
with mock.patch.object(type(client.transport.get_row), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = tables.Row(name="name_value",)
-
response = client.get_row(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.GetRowRequest()
# Establish that the response is the type that we expect.
-
assert isinstance(response, tables.Row)
-
assert response.name == "name_value"
@@ -1317,7 +1312,7 @@ def test_get_row_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1325,7 +1320,6 @@ def test_get_row_empty_call():
client.get_row()
call.assert_called()
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.GetRowRequest()
@@ -1334,7 +1328,7 @@ async def test_get_row_async(
transport: str = "grpc_asyncio", request_type=tables.GetRowRequest
):
client = TablesServiceAsyncClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1347,18 +1341,15 @@ async def test_get_row_async(
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
tables.Row(name="name_value",)
)
-
response = await client.get_row(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.GetRowRequest()
# Establish that the response is the type that we expect.
assert isinstance(response, tables.Row)
-
assert response.name == "name_value"
@@ -1368,17 +1359,17 @@ async def test_get_row_async_from_dict():
def test_get_row_field_headers():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = tables.GetRowRequest()
+
request.name = "name/value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_row), "__call__") as call:
call.return_value = tables.Row()
-
client.get_row(request)
# Establish that the underlying gRPC stub method was called.
@@ -1393,17 +1384,19 @@ def test_get_row_field_headers():
@pytest.mark.asyncio
async def test_get_row_field_headers_async():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceAsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = tables.GetRowRequest()
+
request.name = "name/value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_row), "__call__") as call:
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(tables.Row())
-
await client.get_row(request)
# Establish that the underlying gRPC stub method was called.
@@ -1417,13 +1410,12 @@ async def test_get_row_field_headers_async():
def test_get_row_flattened():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_row), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = tables.Row()
-
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
client.get_row(name="name_value",)
@@ -1432,12 +1424,11 @@ def test_get_row_flattened():
# request object values.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
-
assert args[0].name == "name_value"
def test_get_row_flattened_error():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
# Attempting to call a method with both a request object and flattened
# fields is an error.
@@ -1449,7 +1440,9 @@ def test_get_row_flattened_error():
@pytest.mark.asyncio
async def test_get_row_flattened_async():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceAsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_row), "__call__") as call:
@@ -1465,13 +1458,14 @@ async def test_get_row_flattened_async():
# request object values.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
-
assert args[0].name == "name_value"
@pytest.mark.asyncio
async def test_get_row_flattened_error_async():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceAsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
@@ -1483,7 +1477,7 @@ async def test_get_row_flattened_error_async():
def test_list_rows(transport: str = "grpc", request_type=tables.ListRowsRequest):
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1496,19 +1490,15 @@ def test_list_rows(transport: str = "grpc", request_type=tables.ListRowsRequest)
call.return_value = tables.ListRowsResponse(
next_page_token="next_page_token_value",
)
-
response = client.list_rows(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.ListRowsRequest()
# Establish that the response is the type that we expect.
-
assert isinstance(response, pagers.ListRowsPager)
-
assert response.next_page_token == "next_page_token_value"
@@ -1520,7 +1510,7 @@ def test_list_rows_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1528,7 +1518,6 @@ def test_list_rows_empty_call():
client.list_rows()
call.assert_called()
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.ListRowsRequest()
@@ -1537,7 +1526,7 @@ async def test_list_rows_async(
transport: str = "grpc_asyncio", request_type=tables.ListRowsRequest
):
client = TablesServiceAsyncClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1550,18 +1539,15 @@ async def test_list_rows_async(
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
tables.ListRowsResponse(next_page_token="next_page_token_value",)
)
-
response = await client.list_rows(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.ListRowsRequest()
# Establish that the response is the type that we expect.
assert isinstance(response, pagers.ListRowsAsyncPager)
-
assert response.next_page_token == "next_page_token_value"
@@ -1571,17 +1557,17 @@ async def test_list_rows_async_from_dict():
def test_list_rows_field_headers():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = tables.ListRowsRequest()
+
request.parent = "parent/value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_rows), "__call__") as call:
call.return_value = tables.ListRowsResponse()
-
client.list_rows(request)
# Establish that the underlying gRPC stub method was called.
@@ -1596,11 +1582,14 @@ def test_list_rows_field_headers():
@pytest.mark.asyncio
async def test_list_rows_field_headers_async():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceAsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = tables.ListRowsRequest()
+
request.parent = "parent/value"
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1608,7 +1597,6 @@ async def test_list_rows_field_headers_async():
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
tables.ListRowsResponse()
)
-
await client.list_rows(request)
# Establish that the underlying gRPC stub method was called.
@@ -1622,13 +1610,12 @@ async def test_list_rows_field_headers_async():
def test_list_rows_flattened():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_rows), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = tables.ListRowsResponse()
-
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
client.list_rows(parent="parent_value",)
@@ -1637,12 +1624,11 @@ def test_list_rows_flattened():
# request object values.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
-
assert args[0].parent == "parent_value"
def test_list_rows_flattened_error():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
# Attempting to call a method with both a request object and flattened
# fields is an error.
@@ -1654,7 +1640,9 @@ def test_list_rows_flattened_error():
@pytest.mark.asyncio
async def test_list_rows_flattened_async():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceAsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_rows), "__call__") as call:
@@ -1672,13 +1660,14 @@ async def test_list_rows_flattened_async():
# request object values.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
-
assert args[0].parent == "parent_value"
@pytest.mark.asyncio
async def test_list_rows_flattened_error_async():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceAsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
@@ -1689,7 +1678,7 @@ async def test_list_rows_flattened_error_async():
def test_list_rows_pager():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials,)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials,)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_rows), "__call__") as call:
@@ -1718,7 +1707,7 @@ def test_list_rows_pager():
def test_list_rows_pages():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials,)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials,)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_rows), "__call__") as call:
@@ -1739,7 +1728,7 @@ def test_list_rows_pages():
@pytest.mark.asyncio
async def test_list_rows_async_pager():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials,)
+ client = TablesServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials,)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
@@ -1767,7 +1756,7 @@ async def test_list_rows_async_pager():
@pytest.mark.asyncio
async def test_list_rows_async_pages():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials,)
+ client = TablesServiceAsyncClient(credentials=ga_credentials.AnonymousCredentials,)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
@@ -1792,7 +1781,7 @@ async def test_list_rows_async_pages():
def test_create_row(transport: str = "grpc", request_type=tables.CreateRowRequest):
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1803,19 +1792,15 @@ def test_create_row(transport: str = "grpc", request_type=tables.CreateRowReques
with mock.patch.object(type(client.transport.create_row), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = tables.Row(name="name_value",)
-
response = client.create_row(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.CreateRowRequest()
# Establish that the response is the type that we expect.
-
assert isinstance(response, tables.Row)
-
assert response.name == "name_value"
@@ -1827,7 +1812,7 @@ def test_create_row_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1835,7 +1820,6 @@ def test_create_row_empty_call():
client.create_row()
call.assert_called()
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.CreateRowRequest()
@@ -1844,7 +1828,7 @@ async def test_create_row_async(
transport: str = "grpc_asyncio", request_type=tables.CreateRowRequest
):
client = TablesServiceAsyncClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1857,18 +1841,15 @@ async def test_create_row_async(
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
tables.Row(name="name_value",)
)
-
response = await client.create_row(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.CreateRowRequest()
# Establish that the response is the type that we expect.
assert isinstance(response, tables.Row)
-
assert response.name == "name_value"
@@ -1878,17 +1859,17 @@ async def test_create_row_async_from_dict():
def test_create_row_field_headers():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = tables.CreateRowRequest()
+
request.parent = "parent/value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.create_row), "__call__") as call:
call.return_value = tables.Row()
-
client.create_row(request)
# Establish that the underlying gRPC stub method was called.
@@ -1903,17 +1884,19 @@ def test_create_row_field_headers():
@pytest.mark.asyncio
async def test_create_row_field_headers_async():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceAsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = tables.CreateRowRequest()
+
request.parent = "parent/value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.create_row), "__call__") as call:
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(tables.Row())
-
await client.create_row(request)
# Establish that the underlying gRPC stub method was called.
@@ -1927,13 +1910,12 @@ async def test_create_row_field_headers_async():
def test_create_row_flattened():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.create_row), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = tables.Row()
-
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
client.create_row(
@@ -1944,14 +1926,12 @@ def test_create_row_flattened():
# request object values.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
-
assert args[0].parent == "parent_value"
-
assert args[0].row == tables.Row(name="name_value")
def test_create_row_flattened_error():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
# Attempting to call a method with both a request object and flattened
# fields is an error.
@@ -1965,7 +1945,9 @@ def test_create_row_flattened_error():
@pytest.mark.asyncio
async def test_create_row_flattened_async():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceAsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.create_row), "__call__") as call:
@@ -1983,15 +1965,15 @@ async def test_create_row_flattened_async():
# request object values.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
-
assert args[0].parent == "parent_value"
-
assert args[0].row == tables.Row(name="name_value")
@pytest.mark.asyncio
async def test_create_row_flattened_error_async():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceAsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
@@ -2007,7 +1989,7 @@ def test_batch_create_rows(
transport: str = "grpc", request_type=tables.BatchCreateRowsRequest
):
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -2020,17 +2002,14 @@ def test_batch_create_rows(
) as call:
# Designate an appropriate return value for the call.
call.return_value = tables.BatchCreateRowsResponse()
-
response = client.batch_create_rows(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.BatchCreateRowsRequest()
# Establish that the response is the type that we expect.
-
assert isinstance(response, tables.BatchCreateRowsResponse)
@@ -2042,7 +2021,7 @@ def test_batch_create_rows_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -2052,7 +2031,6 @@ def test_batch_create_rows_empty_call():
client.batch_create_rows()
call.assert_called()
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.BatchCreateRowsRequest()
@@ -2061,7 +2039,7 @@ async def test_batch_create_rows_async(
transport: str = "grpc_asyncio", request_type=tables.BatchCreateRowsRequest
):
client = TablesServiceAsyncClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -2076,13 +2054,11 @@ async def test_batch_create_rows_async(
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
tables.BatchCreateRowsResponse()
)
-
response = await client.batch_create_rows(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.BatchCreateRowsRequest()
# Establish that the response is the type that we expect.
@@ -2095,11 +2071,12 @@ async def test_batch_create_rows_async_from_dict():
def test_batch_create_rows_field_headers():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = tables.BatchCreateRowsRequest()
+
request.parent = "parent/value"
# Mock the actual call within the gRPC stub, and fake the request.
@@ -2107,7 +2084,6 @@ def test_batch_create_rows_field_headers():
type(client.transport.batch_create_rows), "__call__"
) as call:
call.return_value = tables.BatchCreateRowsResponse()
-
client.batch_create_rows(request)
# Establish that the underlying gRPC stub method was called.
@@ -2122,11 +2098,14 @@ def test_batch_create_rows_field_headers():
@pytest.mark.asyncio
async def test_batch_create_rows_field_headers_async():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceAsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = tables.BatchCreateRowsRequest()
+
request.parent = "parent/value"
# Mock the actual call within the gRPC stub, and fake the request.
@@ -2136,7 +2115,6 @@ async def test_batch_create_rows_field_headers_async():
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
tables.BatchCreateRowsResponse()
)
-
await client.batch_create_rows(request)
# Establish that the underlying gRPC stub method was called.
@@ -2151,7 +2129,7 @@ async def test_batch_create_rows_field_headers_async():
def test_update_row(transport: str = "grpc", request_type=tables.UpdateRowRequest):
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -2162,19 +2140,15 @@ def test_update_row(transport: str = "grpc", request_type=tables.UpdateRowReques
with mock.patch.object(type(client.transport.update_row), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = tables.Row(name="name_value",)
-
response = client.update_row(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.UpdateRowRequest()
# Establish that the response is the type that we expect.
-
assert isinstance(response, tables.Row)
-
assert response.name == "name_value"
@@ -2186,7 +2160,7 @@ def test_update_row_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -2194,7 +2168,6 @@ def test_update_row_empty_call():
client.update_row()
call.assert_called()
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.UpdateRowRequest()
@@ -2203,7 +2176,7 @@ async def test_update_row_async(
transport: str = "grpc_asyncio", request_type=tables.UpdateRowRequest
):
client = TablesServiceAsyncClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -2216,18 +2189,15 @@ async def test_update_row_async(
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
tables.Row(name="name_value",)
)
-
response = await client.update_row(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.UpdateRowRequest()
# Establish that the response is the type that we expect.
assert isinstance(response, tables.Row)
-
assert response.name == "name_value"
@@ -2237,17 +2207,17 @@ async def test_update_row_async_from_dict():
def test_update_row_field_headers():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = tables.UpdateRowRequest()
+
request.row.name = "row.name/value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.update_row), "__call__") as call:
call.return_value = tables.Row()
-
client.update_row(request)
# Establish that the underlying gRPC stub method was called.
@@ -2262,17 +2232,19 @@ def test_update_row_field_headers():
@pytest.mark.asyncio
async def test_update_row_field_headers_async():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceAsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = tables.UpdateRowRequest()
+
request.row.name = "row.name/value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.update_row), "__call__") as call:
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(tables.Row())
-
await client.update_row(request)
# Establish that the underlying gRPC stub method was called.
@@ -2286,32 +2258,29 @@ async def test_update_row_field_headers_async():
def test_update_row_flattened():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.update_row), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = tables.Row()
-
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
client.update_row(
row=tables.Row(name="name_value"),
- update_mask=field_mask.FieldMask(paths=["paths_value"]),
+ update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]),
)
# Establish that the underlying call was made with the expected
# request object values.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
-
assert args[0].row == tables.Row(name="name_value")
-
- assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"])
+ assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"])
def test_update_row_flattened_error():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
# Attempting to call a method with both a request object and flattened
# fields is an error.
@@ -2319,13 +2288,15 @@ def test_update_row_flattened_error():
client.update_row(
tables.UpdateRowRequest(),
row=tables.Row(name="name_value"),
- update_mask=field_mask.FieldMask(paths=["paths_value"]),
+ update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]),
)
@pytest.mark.asyncio
async def test_update_row_flattened_async():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceAsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.update_row), "__call__") as call:
@@ -2337,22 +2308,22 @@ async def test_update_row_flattened_async():
# using the keyword arguments to the method.
response = await client.update_row(
row=tables.Row(name="name_value"),
- update_mask=field_mask.FieldMask(paths=["paths_value"]),
+ update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]),
)
# Establish that the underlying call was made with the expected
# request object values.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
-
assert args[0].row == tables.Row(name="name_value")
-
- assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"])
+ assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"])
@pytest.mark.asyncio
async def test_update_row_flattened_error_async():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceAsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
@@ -2360,7 +2331,7 @@ async def test_update_row_flattened_error_async():
await client.update_row(
tables.UpdateRowRequest(),
row=tables.Row(name="name_value"),
- update_mask=field_mask.FieldMask(paths=["paths_value"]),
+ update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]),
)
@@ -2368,7 +2339,7 @@ def test_batch_update_rows(
transport: str = "grpc", request_type=tables.BatchUpdateRowsRequest
):
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -2381,17 +2352,14 @@ def test_batch_update_rows(
) as call:
# Designate an appropriate return value for the call.
call.return_value = tables.BatchUpdateRowsResponse()
-
response = client.batch_update_rows(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.BatchUpdateRowsRequest()
# Establish that the response is the type that we expect.
-
assert isinstance(response, tables.BatchUpdateRowsResponse)
@@ -2403,7 +2371,7 @@ def test_batch_update_rows_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -2413,7 +2381,6 @@ def test_batch_update_rows_empty_call():
client.batch_update_rows()
call.assert_called()
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.BatchUpdateRowsRequest()
@@ -2422,7 +2389,7 @@ async def test_batch_update_rows_async(
transport: str = "grpc_asyncio", request_type=tables.BatchUpdateRowsRequest
):
client = TablesServiceAsyncClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -2437,13 +2404,11 @@ async def test_batch_update_rows_async(
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
tables.BatchUpdateRowsResponse()
)
-
response = await client.batch_update_rows(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.BatchUpdateRowsRequest()
# Establish that the response is the type that we expect.
@@ -2456,11 +2421,12 @@ async def test_batch_update_rows_async_from_dict():
def test_batch_update_rows_field_headers():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = tables.BatchUpdateRowsRequest()
+
request.parent = "parent/value"
# Mock the actual call within the gRPC stub, and fake the request.
@@ -2468,7 +2434,6 @@ def test_batch_update_rows_field_headers():
type(client.transport.batch_update_rows), "__call__"
) as call:
call.return_value = tables.BatchUpdateRowsResponse()
-
client.batch_update_rows(request)
# Establish that the underlying gRPC stub method was called.
@@ -2483,11 +2448,14 @@ def test_batch_update_rows_field_headers():
@pytest.mark.asyncio
async def test_batch_update_rows_field_headers_async():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceAsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = tables.BatchUpdateRowsRequest()
+
request.parent = "parent/value"
# Mock the actual call within the gRPC stub, and fake the request.
@@ -2497,7 +2465,6 @@ async def test_batch_update_rows_field_headers_async():
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
tables.BatchUpdateRowsResponse()
)
-
await client.batch_update_rows(request)
# Establish that the underlying gRPC stub method was called.
@@ -2512,7 +2479,7 @@ async def test_batch_update_rows_field_headers_async():
def test_delete_row(transport: str = "grpc", request_type=tables.DeleteRowRequest):
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -2523,13 +2490,11 @@ def test_delete_row(transport: str = "grpc", request_type=tables.DeleteRowReques
with mock.patch.object(type(client.transport.delete_row), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = None
-
response = client.delete_row(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.DeleteRowRequest()
# Establish that the response is the type that we expect.
@@ -2544,7 +2509,7 @@ def test_delete_row_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -2552,7 +2517,6 @@ def test_delete_row_empty_call():
client.delete_row()
call.assert_called()
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.DeleteRowRequest()
@@ -2561,7 +2525,7 @@ async def test_delete_row_async(
transport: str = "grpc_asyncio", request_type=tables.DeleteRowRequest
):
client = TablesServiceAsyncClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -2572,13 +2536,11 @@ async def test_delete_row_async(
with mock.patch.object(type(client.transport.delete_row), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
-
response = await client.delete_row(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.DeleteRowRequest()
# Establish that the response is the type that we expect.
@@ -2591,17 +2553,17 @@ async def test_delete_row_async_from_dict():
def test_delete_row_field_headers():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = tables.DeleteRowRequest()
+
request.name = "name/value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.delete_row), "__call__") as call:
call.return_value = None
-
client.delete_row(request)
# Establish that the underlying gRPC stub method was called.
@@ -2616,17 +2578,19 @@ def test_delete_row_field_headers():
@pytest.mark.asyncio
async def test_delete_row_field_headers_async():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceAsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = tables.DeleteRowRequest()
+
request.name = "name/value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.delete_row), "__call__") as call:
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
-
await client.delete_row(request)
# Establish that the underlying gRPC stub method was called.
@@ -2640,13 +2604,12 @@ async def test_delete_row_field_headers_async():
def test_delete_row_flattened():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.delete_row), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = None
-
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
client.delete_row(name="name_value",)
@@ -2655,12 +2618,11 @@ def test_delete_row_flattened():
# request object values.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
-
assert args[0].name == "name_value"
def test_delete_row_flattened_error():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
# Attempting to call a method with both a request object and flattened
# fields is an error.
@@ -2672,7 +2634,9 @@ def test_delete_row_flattened_error():
@pytest.mark.asyncio
async def test_delete_row_flattened_async():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceAsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.delete_row), "__call__") as call:
@@ -2688,13 +2652,14 @@ async def test_delete_row_flattened_async():
# request object values.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
-
assert args[0].name == "name_value"
@pytest.mark.asyncio
async def test_delete_row_flattened_error_async():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceAsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
@@ -2708,7 +2673,7 @@ def test_batch_delete_rows(
transport: str = "grpc", request_type=tables.BatchDeleteRowsRequest
):
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -2721,13 +2686,11 @@ def test_batch_delete_rows(
) as call:
# Designate an appropriate return value for the call.
call.return_value = None
-
response = client.batch_delete_rows(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.BatchDeleteRowsRequest()
# Establish that the response is the type that we expect.
@@ -2742,7 +2705,7 @@ def test_batch_delete_rows_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -2752,7 +2715,6 @@ def test_batch_delete_rows_empty_call():
client.batch_delete_rows()
call.assert_called()
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.BatchDeleteRowsRequest()
@@ -2761,7 +2723,7 @@ async def test_batch_delete_rows_async(
transport: str = "grpc_asyncio", request_type=tables.BatchDeleteRowsRequest
):
client = TablesServiceAsyncClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -2774,13 +2736,11 @@ async def test_batch_delete_rows_async(
) as call:
# Designate an appropriate return value for the call.
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
-
response = await client.batch_delete_rows(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
-
assert args[0] == tables.BatchDeleteRowsRequest()
# Establish that the response is the type that we expect.
@@ -2793,11 +2753,12 @@ async def test_batch_delete_rows_async_from_dict():
def test_batch_delete_rows_field_headers():
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = tables.BatchDeleteRowsRequest()
+
request.parent = "parent/value"
# Mock the actual call within the gRPC stub, and fake the request.
@@ -2805,7 +2766,6 @@ def test_batch_delete_rows_field_headers():
type(client.transport.batch_delete_rows), "__call__"
) as call:
call.return_value = None
-
client.batch_delete_rows(request)
# Establish that the underlying gRPC stub method was called.
@@ -2820,11 +2780,14 @@ def test_batch_delete_rows_field_headers():
@pytest.mark.asyncio
async def test_batch_delete_rows_field_headers_async():
- client = TablesServiceAsyncClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceAsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = tables.BatchDeleteRowsRequest()
+
request.parent = "parent/value"
# Mock the actual call within the gRPC stub, and fake the request.
@@ -2832,7 +2795,6 @@ async def test_batch_delete_rows_field_headers_async():
type(client.transport.batch_delete_rows), "__call__"
) as call:
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
-
await client.batch_delete_rows(request)
# Establish that the underlying gRPC stub method was called.
@@ -2848,16 +2810,16 @@ async def test_batch_delete_rows_field_headers_async():
def test_credentials_transport_error():
# It is an error to provide credentials and a transport instance.
transport = transports.TablesServiceGrpcTransport(
- credentials=credentials.AnonymousCredentials(),
+ credentials=ga_credentials.AnonymousCredentials(),
)
with pytest.raises(ValueError):
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(), transport=transport,
)
# It is an error to provide a credentials file and a transport instance.
transport = transports.TablesServiceGrpcTransport(
- credentials=credentials.AnonymousCredentials(),
+ credentials=ga_credentials.AnonymousCredentials(),
)
with pytest.raises(ValueError):
client = TablesServiceClient(
@@ -2867,7 +2829,7 @@ def test_credentials_transport_error():
# It is an error to provide scopes and a transport instance.
transport = transports.TablesServiceGrpcTransport(
- credentials=credentials.AnonymousCredentials(),
+ credentials=ga_credentials.AnonymousCredentials(),
)
with pytest.raises(ValueError):
client = TablesServiceClient(
@@ -2878,7 +2840,7 @@ def test_credentials_transport_error():
def test_transport_instance():
# A client may be instantiated with a custom transport instance.
transport = transports.TablesServiceGrpcTransport(
- credentials=credentials.AnonymousCredentials(),
+ credentials=ga_credentials.AnonymousCredentials(),
)
client = TablesServiceClient(transport=transport)
assert client.transport is transport
@@ -2887,13 +2849,13 @@ def test_transport_instance():
def test_transport_get_channel():
# A client may be instantiated with a custom transport instance.
transport = transports.TablesServiceGrpcTransport(
- credentials=credentials.AnonymousCredentials(),
+ credentials=ga_credentials.AnonymousCredentials(),
)
channel = transport.grpc_channel
assert channel
transport = transports.TablesServiceGrpcAsyncIOTransport(
- credentials=credentials.AnonymousCredentials(),
+ credentials=ga_credentials.AnonymousCredentials(),
)
channel = transport.grpc_channel
assert channel
@@ -2908,23 +2870,23 @@ def test_transport_get_channel():
)
def test_transport_adc(transport_class):
# Test default credentials are used if not provided.
- with mock.patch.object(auth, "default") as adc:
- adc.return_value = (credentials.AnonymousCredentials(), None)
+ with mock.patch.object(google.auth, "default") as adc:
+ adc.return_value = (ga_credentials.AnonymousCredentials(), None)
transport_class()
adc.assert_called_once()
def test_transport_grpc_default():
# A client should use the gRPC transport by default.
- client = TablesServiceClient(credentials=credentials.AnonymousCredentials(),)
+ client = TablesServiceClient(credentials=ga_credentials.AnonymousCredentials(),)
assert isinstance(client.transport, transports.TablesServiceGrpcTransport,)
def test_tables_service_base_transport_error():
# Passing both a credentials object and credentials_file should raise an error
- with pytest.raises(exceptions.DuplicateCredentialArgs):
+ with pytest.raises(core_exceptions.DuplicateCredentialArgs):
transport = transports.TablesServiceTransport(
- credentials=credentials.AnonymousCredentials(),
+ credentials=ga_credentials.AnonymousCredentials(),
credentials_file="credentials.json",
)
@@ -2936,7 +2898,7 @@ def test_tables_service_base_transport():
) as Transport:
Transport.return_value = None
transport = transports.TablesServiceTransport(
- credentials=credentials.AnonymousCredentials(),
+ credentials=ga_credentials.AnonymousCredentials(),
)
# Every method on the transport should just blindly
@@ -2960,15 +2922,44 @@ def test_tables_service_base_transport():
getattr(transport, method)(request=object())
+@requires_google_auth_gte_1_25_0
def test_tables_service_base_transport_with_credentials_file():
# Instantiate the base transport with a credentials file
with mock.patch.object(
- auth, "load_credentials_from_file"
+ google.auth, "load_credentials_from_file", autospec=True
) as load_creds, mock.patch(
"google.area120.tables_v1alpha1.services.tables_service.transports.TablesServiceTransport._prep_wrapped_messages"
) as Transport:
Transport.return_value = None
- load_creds.return_value = (credentials.AnonymousCredentials(), None)
+ load_creds.return_value = (ga_credentials.AnonymousCredentials(), None)
+ transport = transports.TablesServiceTransport(
+ credentials_file="credentials.json", quota_project_id="octopus",
+ )
+ load_creds.assert_called_once_with(
+ "credentials.json",
+ scopes=None,
+ default_scopes=(
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.readonly",
+ "https://www.googleapis.com/auth/spreadsheets",
+ "https://www.googleapis.com/auth/spreadsheets.readonly",
+ "https://www.googleapis.com/auth/tables",
+ ),
+ quota_project_id="octopus",
+ )
+
+
+@requires_google_auth_lt_1_25_0
+def test_tables_service_base_transport_with_credentials_file_old_google_auth():
+ # Instantiate the base transport with a credentials file
+ with mock.patch.object(
+ google.auth, "load_credentials_from_file", autospec=True
+ ) as load_creds, mock.patch(
+ "google.area120.tables_v1alpha1.services.tables_service.transports.TablesServiceTransport._prep_wrapped_messages"
+ ) as Transport:
+ Transport.return_value = None
+ load_creds.return_value = (ga_credentials.AnonymousCredentials(), None)
transport = transports.TablesServiceTransport(
credentials_file="credentials.json", quota_project_id="octopus",
)
@@ -2988,19 +2979,40 @@ def test_tables_service_base_transport_with_credentials_file():
def test_tables_service_base_transport_with_adc():
# Test the default credentials are used if credentials and credentials_file are None.
- with mock.patch.object(auth, "default") as adc, mock.patch(
+ with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch(
"google.area120.tables_v1alpha1.services.tables_service.transports.TablesServiceTransport._prep_wrapped_messages"
) as Transport:
Transport.return_value = None
- adc.return_value = (credentials.AnonymousCredentials(), None)
+ adc.return_value = (ga_credentials.AnonymousCredentials(), None)
transport = transports.TablesServiceTransport()
adc.assert_called_once()
+@requires_google_auth_gte_1_25_0
def test_tables_service_auth_adc():
# If no credentials are provided, we should use ADC credentials.
- with mock.patch.object(auth, "default") as adc:
- adc.return_value = (credentials.AnonymousCredentials(), None)
+ with mock.patch.object(google.auth, "default", autospec=True) as adc:
+ adc.return_value = (ga_credentials.AnonymousCredentials(), None)
+ TablesServiceClient()
+ adc.assert_called_once_with(
+ scopes=None,
+ default_scopes=(
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.readonly",
+ "https://www.googleapis.com/auth/spreadsheets",
+ "https://www.googleapis.com/auth/spreadsheets.readonly",
+ "https://www.googleapis.com/auth/tables",
+ ),
+ quota_project_id=None,
+ )
+
+
+@requires_google_auth_lt_1_25_0
+def test_tables_service_auth_adc_old_google_auth():
+ # If no credentials are provided, we should use ADC credentials.
+ with mock.patch.object(google.auth, "default", autospec=True) as adc:
+ adc.return_value = (ga_credentials.AnonymousCredentials(), None)
TablesServiceClient()
adc.assert_called_once_with(
scopes=(
@@ -3015,14 +3027,48 @@ def test_tables_service_auth_adc():
)
-def test_tables_service_transport_auth_adc():
+@pytest.mark.parametrize(
+ "transport_class",
+ [
+ transports.TablesServiceGrpcTransport,
+ transports.TablesServiceGrpcAsyncIOTransport,
+ ],
+)
+@requires_google_auth_gte_1_25_0
+def test_tables_service_transport_auth_adc(transport_class):
# If credentials and host are not provided, the transport class should use
# ADC credentials.
- with mock.patch.object(auth, "default") as adc:
- adc.return_value = (credentials.AnonymousCredentials(), None)
- transports.TablesServiceGrpcTransport(
- host="squid.clam.whelk", quota_project_id="octopus"
+ with mock.patch.object(google.auth, "default", autospec=True) as adc:
+ adc.return_value = (ga_credentials.AnonymousCredentials(), None)
+ transport_class(quota_project_id="octopus", scopes=["1", "2"])
+ adc.assert_called_once_with(
+ scopes=["1", "2"],
+ default_scopes=(
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.readonly",
+ "https://www.googleapis.com/auth/spreadsheets",
+ "https://www.googleapis.com/auth/spreadsheets.readonly",
+ "https://www.googleapis.com/auth/tables",
+ ),
+ quota_project_id="octopus",
)
+
+
+@pytest.mark.parametrize(
+ "transport_class",
+ [
+ transports.TablesServiceGrpcTransport,
+ transports.TablesServiceGrpcAsyncIOTransport,
+ ],
+)
+@requires_google_auth_lt_1_25_0
+def test_tables_service_transport_auth_adc_old_google_auth(transport_class):
+ # If credentials and host are not provided, the transport class should use
+ # ADC credentials.
+ with mock.patch.object(google.auth, "default", autospec=True) as adc:
+ adc.return_value = (ga_credentials.AnonymousCredentials(), None)
+ transport_class(quota_project_id="octopus")
adc.assert_called_once_with(
scopes=(
"https://www.googleapis.com/auth/drive",
@@ -3036,6 +3082,129 @@ def test_tables_service_transport_auth_adc():
)
+@pytest.mark.parametrize(
+ "transport_class,grpc_helpers",
+ [
+ (transports.TablesServiceGrpcTransport, grpc_helpers),
+ (transports.TablesServiceGrpcAsyncIOTransport, grpc_helpers_async),
+ ],
+)
+@requires_api_core_gte_1_26_0
+def test_tables_service_transport_create_channel(transport_class, grpc_helpers):
+ # If credentials and host are not provided, the transport class should use
+ # ADC credentials.
+ with mock.patch.object(
+ google.auth, "default", autospec=True
+ ) as adc, mock.patch.object(
+ grpc_helpers, "create_channel", autospec=True
+ ) as create_channel:
+ creds = ga_credentials.AnonymousCredentials()
+ adc.return_value = (creds, None)
+ transport_class(quota_project_id="octopus", scopes=["1", "2"])
+
+ create_channel.assert_called_with(
+ "area120tables.googleapis.com:443",
+ credentials=creds,
+ credentials_file=None,
+ quota_project_id="octopus",
+ default_scopes=(
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.readonly",
+ "https://www.googleapis.com/auth/spreadsheets",
+ "https://www.googleapis.com/auth/spreadsheets.readonly",
+ "https://www.googleapis.com/auth/tables",
+ ),
+ scopes=["1", "2"],
+ default_host="area120tables.googleapis.com",
+ ssl_credentials=None,
+ options=[
+ ("grpc.max_send_message_length", -1),
+ ("grpc.max_receive_message_length", -1),
+ ],
+ )
+
+
+@pytest.mark.parametrize(
+ "transport_class,grpc_helpers",
+ [
+ (transports.TablesServiceGrpcTransport, grpc_helpers),
+ (transports.TablesServiceGrpcAsyncIOTransport, grpc_helpers_async),
+ ],
+)
+@requires_api_core_lt_1_26_0
+def test_tables_service_transport_create_channel_old_api_core(
+ transport_class, grpc_helpers
+):
+ # If credentials and host are not provided, the transport class should use
+ # ADC credentials.
+ with mock.patch.object(
+ google.auth, "default", autospec=True
+ ) as adc, mock.patch.object(
+ grpc_helpers, "create_channel", autospec=True
+ ) as create_channel:
+ creds = ga_credentials.AnonymousCredentials()
+ adc.return_value = (creds, None)
+ transport_class(quota_project_id="octopus")
+
+ create_channel.assert_called_with(
+ "area120tables.googleapis.com:443",
+ credentials=creds,
+ credentials_file=None,
+ quota_project_id="octopus",
+ scopes=(
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.readonly",
+ "https://www.googleapis.com/auth/spreadsheets",
+ "https://www.googleapis.com/auth/spreadsheets.readonly",
+ "https://www.googleapis.com/auth/tables",
+ ),
+ ssl_credentials=None,
+ options=[
+ ("grpc.max_send_message_length", -1),
+ ("grpc.max_receive_message_length", -1),
+ ],
+ )
+
+
+@pytest.mark.parametrize(
+ "transport_class,grpc_helpers",
+ [
+ (transports.TablesServiceGrpcTransport, grpc_helpers),
+ (transports.TablesServiceGrpcAsyncIOTransport, grpc_helpers_async),
+ ],
+)
+@requires_api_core_lt_1_26_0
+def test_tables_service_transport_create_channel_user_scopes(
+ transport_class, grpc_helpers
+):
+ # If credentials and host are not provided, the transport class should use
+ # ADC credentials.
+ with mock.patch.object(
+ google.auth, "default", autospec=True
+ ) as adc, mock.patch.object(
+ grpc_helpers, "create_channel", autospec=True
+ ) as create_channel:
+ creds = ga_credentials.AnonymousCredentials()
+ adc.return_value = (creds, None)
+
+ transport_class(quota_project_id="octopus", scopes=["1", "2"])
+
+ create_channel.assert_called_with(
+ "area120tables.googleapis.com:443",
+ credentials=creds,
+ credentials_file=None,
+ quota_project_id="octopus",
+ scopes=["1", "2"],
+ ssl_credentials=None,
+ options=[
+ ("grpc.max_send_message_length", -1),
+ ("grpc.max_receive_message_length", -1),
+ ],
+ )
+
+
@pytest.mark.parametrize(
"transport_class",
[
@@ -3044,7 +3213,7 @@ def test_tables_service_transport_auth_adc():
],
)
def test_tables_service_grpc_transport_client_cert_source_for_mtls(transport_class):
- cred = credentials.AnonymousCredentials()
+ cred = ga_credentials.AnonymousCredentials()
# Check ssl_channel_credentials is used if provided.
with mock.patch.object(transport_class, "create_channel") as mock_create_channel:
@@ -3090,7 +3259,7 @@ def test_tables_service_grpc_transport_client_cert_source_for_mtls(transport_cla
def test_tables_service_host_no_port():
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(),
+ credentials=ga_credentials.AnonymousCredentials(),
client_options=client_options.ClientOptions(
api_endpoint="area120tables.googleapis.com"
),
@@ -3100,7 +3269,7 @@ def test_tables_service_host_no_port():
def test_tables_service_host_with_port():
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(),
+ credentials=ga_credentials.AnonymousCredentials(),
client_options=client_options.ClientOptions(
api_endpoint="area120tables.googleapis.com:8000"
),
@@ -3154,9 +3323,9 @@ def test_tables_service_transport_channel_mtls_with_client_cert_source(transport
mock_grpc_channel = mock.Mock()
grpc_create_channel.return_value = mock_grpc_channel
- cred = credentials.AnonymousCredentials()
+ cred = ga_credentials.AnonymousCredentials()
with pytest.warns(DeprecationWarning):
- with mock.patch.object(auth, "default") as adc:
+ with mock.patch.object(google.auth, "default") as adc:
adc.return_value = (cred, None)
transport = transport_class(
host="squid.clam.whelk",
@@ -3247,7 +3416,6 @@ def test_tables_service_transport_channel_mtls_with_adc(transport_class):
def test_row_path():
table = "squid"
row = "clam"
-
expected = "tables/{table}/rows/{row}".format(table=table, row=row,)
actual = TablesServiceClient.row_path(table, row)
assert expected == actual
@@ -3267,7 +3435,6 @@ def test_parse_row_path():
def test_table_path():
table = "oyster"
-
expected = "tables/{table}".format(table=table,)
actual = TablesServiceClient.table_path(table)
assert expected == actual
@@ -3286,7 +3453,6 @@ def test_parse_table_path():
def test_workspace_path():
workspace = "cuttlefish"
-
expected = "workspaces/{workspace}".format(workspace=workspace,)
actual = TablesServiceClient.workspace_path(workspace)
assert expected == actual
@@ -3305,7 +3471,6 @@ def test_parse_workspace_path():
def test_common_billing_account_path():
billing_account = "winkle"
-
expected = "billingAccounts/{billing_account}".format(
billing_account=billing_account,
)
@@ -3326,7 +3491,6 @@ def test_parse_common_billing_account_path():
def test_common_folder_path():
folder = "scallop"
-
expected = "folders/{folder}".format(folder=folder,)
actual = TablesServiceClient.common_folder_path(folder)
assert expected == actual
@@ -3345,7 +3509,6 @@ def test_parse_common_folder_path():
def test_common_organization_path():
organization = "squid"
-
expected = "organizations/{organization}".format(organization=organization,)
actual = TablesServiceClient.common_organization_path(organization)
assert expected == actual
@@ -3364,7 +3527,6 @@ def test_parse_common_organization_path():
def test_common_project_path():
project = "whelk"
-
expected = "projects/{project}".format(project=project,)
actual = TablesServiceClient.common_project_path(project)
assert expected == actual
@@ -3384,7 +3546,6 @@ def test_parse_common_project_path():
def test_common_location_path():
project = "oyster"
location = "nudibranch"
-
expected = "projects/{project}/locations/{location}".format(
project=project, location=location,
)
@@ -3411,7 +3572,7 @@ def test_client_withDEFAULT_CLIENT_INFO():
transports.TablesServiceTransport, "_prep_wrapped_messages"
) as prep:
client = TablesServiceClient(
- credentials=credentials.AnonymousCredentials(), client_info=client_info,
+ credentials=ga_credentials.AnonymousCredentials(), client_info=client_info,
)
prep.assert_called_once_with(client_info)
@@ -3420,6 +3581,6 @@ def test_client_withDEFAULT_CLIENT_INFO():
) as prep:
transport_class = TablesServiceClient.get_transport_class()
transport = transport_class(
- credentials=credentials.AnonymousCredentials(), client_info=client_info,
+ credentials=ga_credentials.AnonymousCredentials(), client_info=client_info,
)
prep.assert_called_once_with(client_info)