diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index fa57622..757c9dc 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd -# created: 2022-04-01T15:48:07.524222836Z + digest: sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32 +# created: 2022-05-05T22:08:23.383410683Z diff --git a/.github/auto-approve.yml b/.github/auto-approve.yml new file mode 100644 index 0000000..311ebbb --- /dev/null +++ b/.github/auto-approve.yml @@ -0,0 +1,3 @@ +# https://github.com/googleapis/repo-automation-bots/tree/main/packages/auto-approve +processes: + - "OwlBotTemplateChanges" diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml index 09c8d73..41bff0b 100644 --- a/.github/auto-label.yaml +++ b/.github/auto-label.yaml @@ -1,2 +1,15 @@ +# Copyright 2022 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. requestsize: enabled: true diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index 4e1b1fb..238b87b 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ubuntu:20.04 +from ubuntu:22.04 ENV DEBIAN_FRONTEND noninteractive @@ -60,8 +60,24 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* \ && rm -f /var/cache/apt/archives/*.deb +###################### Install python 3.8.11 + +# Download python 3.8.11 +RUN wget https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tgz + +# Extract files +RUN tar -xvf Python-3.8.11.tgz + +# Install python 3.8.11 +RUN ./Python-3.8.11/configure --enable-optimizations +RUN make altinstall + +###################### Install pip RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && python3.8 /tmp/get-pip.py \ + && python3 /tmp/get-pip.py \ && rm /tmp/get-pip.py +# Test pip +RUN python3 -m pip + CMD ["python3.8"] diff --git a/CHANGELOG.md b/CHANGELOG.md index a7126dc..f00b4e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [0.4.1](https://github.com/googleapis/python-bigquery-migration/compare/v0.4.0...v0.4.1) (2022-05-05) + + +### Documentation + +* fix type in docstring for map fields ([6c5982b](https://github.com/googleapis/python-bigquery-migration/commit/6c5982bf2fcc0d90d6a6951a7dd676e9b7974627)) + ## [0.4.0](https://github.com/googleapis/python-bigquery-migration/compare/v0.3.1...v0.4.0) (2022-04-03) diff --git a/docs/conf.py b/docs/conf.py index 2a7d645..64a60d0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,9 +24,9 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys import os import shlex +import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the diff --git a/google/cloud/bigquery_migration/__init__.py b/google/cloud/bigquery_migration/__init__.py index 214c2d8..fee5209 100644 --- a/google/cloud/bigquery_migration/__init__.py +++ b/google/cloud/bigquery_migration/__init__.py @@ -14,81 +14,58 @@ # limitations under the License. # -from google.cloud.bigquery_migration_v2.services.migration_service.client import ( - MigrationServiceClient, -) from google.cloud.bigquery_migration_v2.services.migration_service.async_client import ( MigrationServiceAsyncClient, ) - -from google.cloud.bigquery_migration_v2.types.migration_entities import MigrationSubtask -from google.cloud.bigquery_migration_v2.types.migration_entities import MigrationTask +from google.cloud.bigquery_migration_v2.services.migration_service.client import ( + MigrationServiceClient, +) from google.cloud.bigquery_migration_v2.types.migration_entities import ( + MigrationSubtask, + MigrationTask, MigrationWorkflow, ) -from google.cloud.bigquery_migration_v2.types.migration_error_details import ErrorDetail from google.cloud.bigquery_migration_v2.types.migration_error_details import ( + ErrorDetail, ErrorLocation, -) -from google.cloud.bigquery_migration_v2.types.migration_error_details import ( ResourceErrorDetail, ) -from google.cloud.bigquery_migration_v2.types.migration_metrics import Point -from google.cloud.bigquery_migration_v2.types.migration_metrics import TimeInterval -from google.cloud.bigquery_migration_v2.types.migration_metrics import TimeSeries -from google.cloud.bigquery_migration_v2.types.migration_metrics import TypedValue -from google.cloud.bigquery_migration_v2.types.migration_service import ( - CreateMigrationWorkflowRequest, +from google.cloud.bigquery_migration_v2.types.migration_metrics import ( + Point, + TimeInterval, + TimeSeries, + TypedValue, ) from google.cloud.bigquery_migration_v2.types.migration_service import ( + CreateMigrationWorkflowRequest, DeleteMigrationWorkflowRequest, -) -from google.cloud.bigquery_migration_v2.types.migration_service import ( GetMigrationSubtaskRequest, -) -from google.cloud.bigquery_migration_v2.types.migration_service import ( GetMigrationWorkflowRequest, -) -from google.cloud.bigquery_migration_v2.types.migration_service import ( ListMigrationSubtasksRequest, -) -from google.cloud.bigquery_migration_v2.types.migration_service import ( ListMigrationSubtasksResponse, -) -from google.cloud.bigquery_migration_v2.types.migration_service import ( ListMigrationWorkflowsRequest, -) -from google.cloud.bigquery_migration_v2.types.migration_service import ( ListMigrationWorkflowsResponse, -) -from google.cloud.bigquery_migration_v2.types.migration_service import ( StartMigrationWorkflowRequest, ) from google.cloud.bigquery_migration_v2.types.translation_config import ( AzureSynapseDialect, -) -from google.cloud.bigquery_migration_v2.types.translation_config import BigQueryDialect -from google.cloud.bigquery_migration_v2.types.translation_config import Dialect -from google.cloud.bigquery_migration_v2.types.translation_config import HiveQLDialect -from google.cloud.bigquery_migration_v2.types.translation_config import NameMappingKey -from google.cloud.bigquery_migration_v2.types.translation_config import NameMappingValue -from google.cloud.bigquery_migration_v2.types.translation_config import NetezzaDialect -from google.cloud.bigquery_migration_v2.types.translation_config import ( + BigQueryDialect, + Dialect, + HiveQLDialect, + NameMappingKey, + NameMappingValue, + NetezzaDialect, ObjectNameMapping, -) -from google.cloud.bigquery_migration_v2.types.translation_config import ( ObjectNameMappingList, -) -from google.cloud.bigquery_migration_v2.types.translation_config import OracleDialect -from google.cloud.bigquery_migration_v2.types.translation_config import RedshiftDialect -from google.cloud.bigquery_migration_v2.types.translation_config import SnowflakeDialect -from google.cloud.bigquery_migration_v2.types.translation_config import SourceEnv -from google.cloud.bigquery_migration_v2.types.translation_config import SparkSQLDialect -from google.cloud.bigquery_migration_v2.types.translation_config import TeradataDialect -from google.cloud.bigquery_migration_v2.types.translation_config import ( + OracleDialect, + RedshiftDialect, + SnowflakeDialect, + SourceEnv, + SparkSQLDialect, + TeradataDialect, TranslationConfigDetails, + VerticaDialect, ) -from google.cloud.bigquery_migration_v2.types.translation_config import VerticaDialect __all__ = ( "MigrationServiceClient", diff --git a/google/cloud/bigquery_migration_v2/__init__.py b/google/cloud/bigquery_migration_v2/__init__.py index c503015..3701195 100644 --- a/google/cloud/bigquery_migration_v2/__init__.py +++ b/google/cloud/bigquery_migration_v2/__init__.py @@ -14,45 +14,47 @@ # limitations under the License. # -from .services.migration_service import MigrationServiceClient -from .services.migration_service import MigrationServiceAsyncClient - -from .types.migration_entities import MigrationSubtask -from .types.migration_entities import MigrationTask -from .types.migration_entities import MigrationWorkflow -from .types.migration_error_details import ErrorDetail -from .types.migration_error_details import ErrorLocation -from .types.migration_error_details import ResourceErrorDetail -from .types.migration_metrics import Point -from .types.migration_metrics import TimeInterval -from .types.migration_metrics import TimeSeries -from .types.migration_metrics import TypedValue -from .types.migration_service import CreateMigrationWorkflowRequest -from .types.migration_service import DeleteMigrationWorkflowRequest -from .types.migration_service import GetMigrationSubtaskRequest -from .types.migration_service import GetMigrationWorkflowRequest -from .types.migration_service import ListMigrationSubtasksRequest -from .types.migration_service import ListMigrationSubtasksResponse -from .types.migration_service import ListMigrationWorkflowsRequest -from .types.migration_service import ListMigrationWorkflowsResponse -from .types.migration_service import StartMigrationWorkflowRequest -from .types.translation_config import AzureSynapseDialect -from .types.translation_config import BigQueryDialect -from .types.translation_config import Dialect -from .types.translation_config import HiveQLDialect -from .types.translation_config import NameMappingKey -from .types.translation_config import NameMappingValue -from .types.translation_config import NetezzaDialect -from .types.translation_config import ObjectNameMapping -from .types.translation_config import ObjectNameMappingList -from .types.translation_config import OracleDialect -from .types.translation_config import RedshiftDialect -from .types.translation_config import SnowflakeDialect -from .types.translation_config import SourceEnv -from .types.translation_config import SparkSQLDialect -from .types.translation_config import TeradataDialect -from .types.translation_config import TranslationConfigDetails -from .types.translation_config import VerticaDialect +from .services.migration_service import ( + MigrationServiceAsyncClient, + MigrationServiceClient, +) +from .types.migration_entities import MigrationSubtask, MigrationTask, MigrationWorkflow +from .types.migration_error_details import ( + ErrorDetail, + ErrorLocation, + ResourceErrorDetail, +) +from .types.migration_metrics import Point, TimeInterval, TimeSeries, TypedValue +from .types.migration_service import ( + CreateMigrationWorkflowRequest, + DeleteMigrationWorkflowRequest, + GetMigrationSubtaskRequest, + GetMigrationWorkflowRequest, + ListMigrationSubtasksRequest, + ListMigrationSubtasksResponse, + ListMigrationWorkflowsRequest, + ListMigrationWorkflowsResponse, + StartMigrationWorkflowRequest, +) +from .types.translation_config import ( + AzureSynapseDialect, + BigQueryDialect, + Dialect, + HiveQLDialect, + NameMappingKey, + NameMappingValue, + NetezzaDialect, + ObjectNameMapping, + ObjectNameMappingList, + OracleDialect, + RedshiftDialect, + SnowflakeDialect, + SourceEnv, + SparkSQLDialect, + TeradataDialect, + TranslationConfigDetails, + VerticaDialect, +) __all__ = ( "MigrationServiceAsyncClient", diff --git a/google/cloud/bigquery_migration_v2/services/migration_service/__init__.py b/google/cloud/bigquery_migration_v2/services/migration_service/__init__.py index 36329bb..1b4ccd9 100644 --- a/google/cloud/bigquery_migration_v2/services/migration_service/__init__.py +++ b/google/cloud/bigquery_migration_v2/services/migration_service/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import MigrationServiceClient from .async_client import MigrationServiceAsyncClient +from .client import MigrationServiceClient __all__ = ( "MigrationServiceClient", diff --git a/google/cloud/bigquery_migration_v2/services/migration_service/async_client.py b/google/cloud/bigquery_migration_v2/services/migration_service/async_client.py index 54730a6..e73563d 100644 --- a/google/cloud/bigquery_migration_v2/services/migration_service/async_client.py +++ b/google/cloud/bigquery_migration_v2/services/migration_service/async_client.py @@ -16,31 +16,35 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore -from google.cloud.bigquery_migration_v2.services.migration_service import pagers -from google.cloud.bigquery_migration_v2.types import migration_entities -from google.cloud.bigquery_migration_v2.types import migration_error_details -from google.cloud.bigquery_migration_v2.types import migration_metrics -from google.cloud.bigquery_migration_v2.types import migration_service from google.protobuf import timestamp_pb2 # type: ignore from google.rpc import error_details_pb2 # type: ignore -from .transports.base import MigrationServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import MigrationServiceGrpcAsyncIOTransport + +from google.cloud.bigquery_migration_v2.services.migration_service import pagers +from google.cloud.bigquery_migration_v2.types import ( + migration_entities, + migration_error_details, + migration_metrics, + migration_service, +) + from .client import MigrationServiceClient +from .transports.base import DEFAULT_CLIENT_INFO, MigrationServiceTransport +from .transports.grpc_asyncio import MigrationServiceGrpcAsyncIOTransport class MigrationServiceAsyncClient: @@ -231,9 +235,9 @@ async def create_migration_workflow( from google.cloud import bigquery_migration_v2 - def sample_create_migration_workflow(): + async def sample_create_migration_workflow(): # Create a client - client = bigquery_migration_v2.MigrationServiceClient() + client = bigquery_migration_v2.MigrationServiceAsyncClient() # Initialize request argument(s) request = bigquery_migration_v2.CreateMigrationWorkflowRequest( @@ -241,7 +245,7 @@ def sample_create_migration_workflow(): ) # Make the request - response = client.create_migration_workflow(request=request) + response = await client.create_migration_workflow(request=request) # Handle the response print(response) @@ -337,9 +341,9 @@ async def get_migration_workflow( from google.cloud import bigquery_migration_v2 - def sample_get_migration_workflow(): + async def sample_get_migration_workflow(): # Create a client - client = bigquery_migration_v2.MigrationServiceClient() + client = bigquery_migration_v2.MigrationServiceAsyncClient() # Initialize request argument(s) request = bigquery_migration_v2.GetMigrationWorkflowRequest( @@ -347,7 +351,7 @@ def sample_get_migration_workflow(): ) # Make the request - response = client.get_migration_workflow(request=request) + response = await client.get_migration_workflow(request=request) # Handle the response print(response) @@ -443,9 +447,9 @@ async def list_migration_workflows( from google.cloud import bigquery_migration_v2 - def sample_list_migration_workflows(): + async def sample_list_migration_workflows(): # Create a client - client = bigquery_migration_v2.MigrationServiceClient() + client = bigquery_migration_v2.MigrationServiceAsyncClient() # Initialize request argument(s) request = bigquery_migration_v2.ListMigrationWorkflowsRequest( @@ -456,7 +460,7 @@ def sample_list_migration_workflows(): page_result = client.list_migration_workflows(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -560,9 +564,9 @@ async def delete_migration_workflow( from google.cloud import bigquery_migration_v2 - def sample_delete_migration_workflow(): + async def sample_delete_migration_workflow(): # Create a client - client = bigquery_migration_v2.MigrationServiceClient() + client = bigquery_migration_v2.MigrationServiceAsyncClient() # Initialize request argument(s) request = bigquery_migration_v2.DeleteMigrationWorkflowRequest( @@ -570,7 +574,7 @@ def sample_delete_migration_workflow(): ) # Make the request - client.delete_migration_workflow(request=request) + await client.delete_migration_workflow(request=request) Args: request (Union[google.cloud.bigquery_migration_v2.types.DeleteMigrationWorkflowRequest, dict]): @@ -644,14 +648,13 @@ async def start_migration_workflow( signaled if the state is anything other than DRAFT or RUNNING. - .. code-block:: python from google.cloud import bigquery_migration_v2 - def sample_start_migration_workflow(): + async def sample_start_migration_workflow(): # Create a client - client = bigquery_migration_v2.MigrationServiceClient() + client = bigquery_migration_v2.MigrationServiceAsyncClient() # Initialize request argument(s) request = bigquery_migration_v2.StartMigrationWorkflowRequest( @@ -659,7 +662,7 @@ def sample_start_migration_workflow(): ) # Make the request - client.start_migration_workflow(request=request) + await client.start_migration_workflow(request=request) Args: request (Union[google.cloud.bigquery_migration_v2.types.StartMigrationWorkflowRequest, dict]): @@ -742,9 +745,9 @@ async def get_migration_subtask( from google.cloud import bigquery_migration_v2 - def sample_get_migration_subtask(): + async def sample_get_migration_subtask(): # Create a client - client = bigquery_migration_v2.MigrationServiceClient() + client = bigquery_migration_v2.MigrationServiceAsyncClient() # Initialize request argument(s) request = bigquery_migration_v2.GetMigrationSubtaskRequest( @@ -752,7 +755,7 @@ def sample_get_migration_subtask(): ) # Make the request - response = client.get_migration_subtask(request=request) + response = await client.get_migration_subtask(request=request) # Handle the response print(response) @@ -842,9 +845,9 @@ async def list_migration_subtasks( from google.cloud import bigquery_migration_v2 - def sample_list_migration_subtasks(): + async def sample_list_migration_subtasks(): # Create a client - client = bigquery_migration_v2.MigrationServiceClient() + client = bigquery_migration_v2.MigrationServiceAsyncClient() # Initialize request argument(s) request = bigquery_migration_v2.ListMigrationSubtasksRequest( @@ -855,7 +858,7 @@ def sample_list_migration_subtasks(): page_result = client.list_migration_subtasks(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: diff --git a/google/cloud/bigquery_migration_v2/services/migration_service/client.py b/google/cloud/bigquery_migration_v2/services/migration_service/client.py index b808306..de6faad 100644 --- a/google/cloud/bigquery_migration_v2/services/migration_service/client.py +++ b/google/cloud/bigquery_migration_v2/services/migration_service/client.py @@ -16,32 +16,36 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # 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 from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore -from google.cloud.bigquery_migration_v2.services.migration_service import pagers -from google.cloud.bigquery_migration_v2.types import migration_entities -from google.cloud.bigquery_migration_v2.types import migration_error_details -from google.cloud.bigquery_migration_v2.types import migration_metrics -from google.cloud.bigquery_migration_v2.types import migration_service from google.protobuf import timestamp_pb2 # type: ignore from google.rpc import error_details_pb2 # type: ignore -from .transports.base import MigrationServiceTransport, DEFAULT_CLIENT_INFO + +from google.cloud.bigquery_migration_v2.services.migration_service import pagers +from google.cloud.bigquery_migration_v2.types import ( + migration_entities, + migration_error_details, + migration_metrics, + migration_service, +) + +from .transports.base import DEFAULT_CLIENT_INFO, MigrationServiceTransport from .transports.grpc import MigrationServiceGrpcTransport from .transports.grpc_asyncio import MigrationServiceGrpcAsyncIOTransport @@ -870,7 +874,6 @@ def start_migration_workflow( signaled if the state is anything other than DRAFT or RUNNING. - .. code-block:: python from google.cloud import bigquery_migration_v2 diff --git a/google/cloud/bigquery_migration_v2/services/migration_service/pagers.py b/google/cloud/bigquery_migration_v2/services/migration_service/pagers.py index c890f78..cdd5a00 100644 --- a/google/cloud/bigquery_migration_v2/services/migration_service/pagers.py +++ b/google/cloud/bigquery_migration_v2/services/migration_service/pagers.py @@ -18,14 +18,16 @@ AsyncIterator, Awaitable, Callable, + Iterator, + Optional, Sequence, Tuple, - Optional, - Iterator, ) -from google.cloud.bigquery_migration_v2.types import migration_entities -from google.cloud.bigquery_migration_v2.types import migration_service +from google.cloud.bigquery_migration_v2.types import ( + migration_entities, + migration_service, +) class ListMigrationWorkflowsPager: diff --git a/google/cloud/bigquery_migration_v2/services/migration_service/transports/__init__.py b/google/cloud/bigquery_migration_v2/services/migration_service/transports/__init__.py index 10ee142..3baa428 100644 --- a/google/cloud/bigquery_migration_v2/services/migration_service/transports/__init__.py +++ b/google/cloud/bigquery_migration_v2/services/migration_service/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import MigrationServiceGrpcTransport from .grpc_asyncio import MigrationServiceGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[MigrationServiceTransport]] _transport_registry["grpc"] = MigrationServiceGrpcTransport diff --git a/google/cloud/bigquery_migration_v2/services/migration_service/transports/base.py b/google/cloud/bigquery_migration_v2/services/migration_service/transports/base.py index 4c2a173..fe28c31 100644 --- a/google/cloud/bigquery_migration_v2/services/migration_service/transports/base.py +++ b/google/cloud/bigquery_migration_v2/services/migration_service/transports/base.py @@ -15,19 +15,21 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore - -from google.cloud.bigquery_migration_v2.types import migration_entities -from google.cloud.bigquery_migration_v2.types import migration_service from google.protobuf import empty_pb2 # type: ignore +import pkg_resources + +from google.cloud.bigquery_migration_v2.types import ( + migration_entities, + migration_service, +) try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -82,6 +84,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -273,5 +276,9 @@ def list_migration_subtasks( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("MigrationServiceTransport",) diff --git a/google/cloud/bigquery_migration_v2/services/migration_service/transports/grpc.py b/google/cloud/bigquery_migration_v2/services/migration_service/transports/grpc.py index 1a88446..93a4193 100644 --- a/google/cloud/bigquery_migration_v2/services/migration_service/transports/grpc.py +++ b/google/cloud/bigquery_migration_v2/services/migration_service/transports/grpc.py @@ -13,21 +13,22 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.protobuf import empty_pb2 # type: ignore import grpc # type: ignore -from google.cloud.bigquery_migration_v2.types import migration_entities -from google.cloud.bigquery_migration_v2.types import migration_service -from google.protobuf import empty_pb2 # type: ignore -from .base import MigrationServiceTransport, DEFAULT_CLIENT_INFO +from google.cloud.bigquery_migration_v2.types import ( + migration_entities, + migration_service, +) + +from .base import DEFAULT_CLIENT_INFO, MigrationServiceTransport class MigrationServiceGrpcTransport(MigrationServiceTransport): @@ -433,5 +434,9 @@ def list_migration_subtasks( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("MigrationServiceGrpcTransport",) diff --git a/google/cloud/bigquery_migration_v2/services/migration_service/transports/grpc_asyncio.py b/google/cloud/bigquery_migration_v2/services/migration_service/transports/grpc_asyncio.py index 3dafa3e..bc6d578 100644 --- a/google/cloud/bigquery_migration_v2/services/migration_service/transports/grpc_asyncio.py +++ b/google/cloud/bigquery_migration_v2/services/migration_service/transports/grpc_asyncio.py @@ -13,21 +13,22 @@ # 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, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async +from google.api_core import gapic_v1, grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.protobuf import empty_pb2 # type: ignore import grpc # type: ignore from grpc.experimental import aio # type: ignore -from google.cloud.bigquery_migration_v2.types import migration_entities -from google.cloud.bigquery_migration_v2.types import migration_service -from google.protobuf import empty_pb2 # type: ignore -from .base import MigrationServiceTransport, DEFAULT_CLIENT_INFO +from google.cloud.bigquery_migration_v2.types import ( + migration_entities, + migration_service, +) + +from .base import DEFAULT_CLIENT_INFO, MigrationServiceTransport from .grpc import MigrationServiceGrpcTransport diff --git a/google/cloud/bigquery_migration_v2/types/__init__.py b/google/cloud/bigquery_migration_v2/types/__init__.py index c22d36d..5a7e5d7 100644 --- a/google/cloud/bigquery_migration_v2/types/__init__.py +++ b/google/cloud/bigquery_migration_v2/types/__init__.py @@ -13,22 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .migration_entities import ( - MigrationSubtask, - MigrationTask, - MigrationWorkflow, -) -from .migration_error_details import ( - ErrorDetail, - ErrorLocation, - ResourceErrorDetail, -) -from .migration_metrics import ( - Point, - TimeInterval, - TimeSeries, - TypedValue, -) +from .migration_entities import MigrationSubtask, MigrationTask, MigrationWorkflow +from .migration_error_details import ErrorDetail, ErrorLocation, ResourceErrorDetail +from .migration_metrics import Point, TimeInterval, TimeSeries, TypedValue from .migration_service import ( CreateMigrationWorkflowRequest, DeleteMigrationWorkflowRequest, diff --git a/google/cloud/bigquery_migration_v2/types/migration_entities.py b/google/cloud/bigquery_migration_v2/types/migration_entities.py index 9225a7e..aae3940 100644 --- a/google/cloud/bigquery_migration_v2/types/migration_entities.py +++ b/google/cloud/bigquery_migration_v2/types/migration_entities.py @@ -13,14 +13,15 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - -from google.cloud.bigquery_migration_v2.types import migration_error_details -from google.cloud.bigquery_migration_v2.types import migration_metrics -from google.cloud.bigquery_migration_v2.types import translation_config from google.protobuf import timestamp_pb2 # type: ignore from google.rpc import error_details_pb2 # type: ignore +import proto # type: ignore +from google.cloud.bigquery_migration_v2.types import ( + migration_error_details, + migration_metrics, + translation_config, +) __protobuf__ = proto.module( package="google.cloud.bigquery.migration.v2", @@ -46,7 +47,7 @@ class MigrationWorkflow(proto.Message): The display name of the workflow. This can be set to give a workflow a descriptive name. There is no guarantee or enforcement of uniqueness. - tasks (Sequence[google.cloud.bigquery_migration_v2.types.MigrationWorkflow.TasksEntry]): + tasks (Mapping[str, google.cloud.bigquery_migration_v2.types.MigrationTask]): The tasks in a workflow in a named map. The name (i.e. key) has no meaning and is merely a convenient way to address a specific task in a diff --git a/google/cloud/bigquery_migration_v2/types/migration_error_details.py b/google/cloud/bigquery_migration_v2/types/migration_error_details.py index e7446b4..3274fd7 100644 --- a/google/cloud/bigquery_migration_v2/types/migration_error_details.py +++ b/google/cloud/bigquery_migration_v2/types/migration_error_details.py @@ -13,10 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.rpc import error_details_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.cloud.bigquery.migration.v2", diff --git a/google/cloud/bigquery_migration_v2/types/migration_metrics.py b/google/cloud/bigquery_migration_v2/types/migration_metrics.py index 6204272..e3d0d16 100644 --- a/google/cloud/bigquery_migration_v2/types/migration_metrics.py +++ b/google/cloud/bigquery_migration_v2/types/migration_metrics.py @@ -13,12 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.api import distribution_pb2 # type: ignore from google.api import metric_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.cloud.bigquery.migration.v2", diff --git a/google/cloud/bigquery_migration_v2/types/migration_service.py b/google/cloud/bigquery_migration_v2/types/migration_service.py index 28555d6..85c9a67 100644 --- a/google/cloud/bigquery_migration_v2/types/migration_service.py +++ b/google/cloud/bigquery_migration_v2/types/migration_service.py @@ -13,11 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.protobuf import field_mask_pb2 # type: ignore import proto # type: ignore from google.cloud.bigquery_migration_v2.types import migration_entities -from google.protobuf import field_mask_pb2 # type: ignore - __protobuf__ = proto.module( package="google.cloud.bigquery.migration.v2", diff --git a/google/cloud/bigquery_migration_v2/types/translation_config.py b/google/cloud/bigquery_migration_v2/types/translation_config.py index 5e3979b..d200c4a 100644 --- a/google/cloud/bigquery_migration_v2/types/translation_config.py +++ b/google/cloud/bigquery_migration_v2/types/translation_config.py @@ -15,7 +15,6 @@ # import proto # type: ignore - __protobuf__ = proto.module( package="google.cloud.bigquery.migration.v2", manifest={ diff --git a/google/cloud/bigquery_migration_v2alpha/__init__.py b/google/cloud/bigquery_migration_v2alpha/__init__.py index 0680af1..2b5588b 100644 --- a/google/cloud/bigquery_migration_v2alpha/__init__.py +++ b/google/cloud/bigquery_migration_v2alpha/__init__.py @@ -14,38 +14,46 @@ # limitations under the License. # -from .services.migration_service import MigrationServiceClient -from .services.migration_service import MigrationServiceAsyncClient - -from .types.assessment_task import AssessmentOrchestrationResultDetails -from .types.assessment_task import AssessmentTaskDetails -from .types.migration_entities import MigrationSubtask -from .types.migration_entities import MigrationTask -from .types.migration_entities import MigrationTaskOrchestrationResult -from .types.migration_entities import MigrationWorkflow -from .types.migration_error_details import ErrorDetail -from .types.migration_error_details import ErrorLocation -from .types.migration_error_details import ResourceErrorDetail -from .types.migration_metrics import Point -from .types.migration_metrics import TimeInterval -from .types.migration_metrics import TimeSeries -from .types.migration_metrics import TypedValue -from .types.migration_service import CreateMigrationWorkflowRequest -from .types.migration_service import DeleteMigrationWorkflowRequest -from .types.migration_service import GetMigrationSubtaskRequest -from .types.migration_service import GetMigrationWorkflowRequest -from .types.migration_service import ListMigrationSubtasksRequest -from .types.migration_service import ListMigrationSubtasksResponse -from .types.migration_service import ListMigrationWorkflowsRequest -from .types.migration_service import ListMigrationWorkflowsResponse -from .types.migration_service import StartMigrationWorkflowRequest -from .types.translation_task import BteqOptions -from .types.translation_task import DatasetReference -from .types.translation_task import Filter -from .types.translation_task import IdentifierSettings -from .types.translation_task import TeradataOptions -from .types.translation_task import TranslationFileMapping -from .types.translation_task import TranslationTaskDetails +from .services.migration_service import ( + MigrationServiceAsyncClient, + MigrationServiceClient, +) +from .types.assessment_task import ( + AssessmentOrchestrationResultDetails, + AssessmentTaskDetails, +) +from .types.migration_entities import ( + MigrationSubtask, + MigrationTask, + MigrationTaskOrchestrationResult, + MigrationWorkflow, +) +from .types.migration_error_details import ( + ErrorDetail, + ErrorLocation, + ResourceErrorDetail, +) +from .types.migration_metrics import Point, TimeInterval, TimeSeries, TypedValue +from .types.migration_service import ( + CreateMigrationWorkflowRequest, + DeleteMigrationWorkflowRequest, + GetMigrationSubtaskRequest, + GetMigrationWorkflowRequest, + ListMigrationSubtasksRequest, + ListMigrationSubtasksResponse, + ListMigrationWorkflowsRequest, + ListMigrationWorkflowsResponse, + StartMigrationWorkflowRequest, +) +from .types.translation_task import ( + BteqOptions, + DatasetReference, + Filter, + IdentifierSettings, + TeradataOptions, + TranslationFileMapping, + TranslationTaskDetails, +) __all__ = ( "MigrationServiceAsyncClient", diff --git a/google/cloud/bigquery_migration_v2alpha/services/migration_service/__init__.py b/google/cloud/bigquery_migration_v2alpha/services/migration_service/__init__.py index 36329bb..1b4ccd9 100644 --- a/google/cloud/bigquery_migration_v2alpha/services/migration_service/__init__.py +++ b/google/cloud/bigquery_migration_v2alpha/services/migration_service/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import MigrationServiceClient from .async_client import MigrationServiceAsyncClient +from .client import MigrationServiceClient __all__ = ( "MigrationServiceClient", diff --git a/google/cloud/bigquery_migration_v2alpha/services/migration_service/async_client.py b/google/cloud/bigquery_migration_v2alpha/services/migration_service/async_client.py index c7dc00a..2bb9922 100644 --- a/google/cloud/bigquery_migration_v2alpha/services/migration_service/async_client.py +++ b/google/cloud/bigquery_migration_v2alpha/services/migration_service/async_client.py @@ -16,31 +16,35 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore -from google.cloud.bigquery_migration_v2alpha.services.migration_service import pagers -from google.cloud.bigquery_migration_v2alpha.types import migration_entities -from google.cloud.bigquery_migration_v2alpha.types import migration_error_details -from google.cloud.bigquery_migration_v2alpha.types import migration_metrics -from google.cloud.bigquery_migration_v2alpha.types import migration_service from google.protobuf import timestamp_pb2 # type: ignore from google.rpc import error_details_pb2 # type: ignore -from .transports.base import MigrationServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import MigrationServiceGrpcAsyncIOTransport + +from google.cloud.bigquery_migration_v2alpha.services.migration_service import pagers +from google.cloud.bigquery_migration_v2alpha.types import ( + migration_entities, + migration_error_details, + migration_metrics, + migration_service, +) + from .client import MigrationServiceClient +from .transports.base import DEFAULT_CLIENT_INFO, MigrationServiceTransport +from .transports.grpc_asyncio import MigrationServiceGrpcAsyncIOTransport class MigrationServiceAsyncClient: @@ -231,9 +235,9 @@ async def create_migration_workflow( from google.cloud import bigquery_migration_v2alpha - def sample_create_migration_workflow(): + async def sample_create_migration_workflow(): # Create a client - client = bigquery_migration_v2alpha.MigrationServiceClient() + client = bigquery_migration_v2alpha.MigrationServiceAsyncClient() # Initialize request argument(s) request = bigquery_migration_v2alpha.CreateMigrationWorkflowRequest( @@ -241,7 +245,7 @@ def sample_create_migration_workflow(): ) # Make the request - response = client.create_migration_workflow(request=request) + response = await client.create_migration_workflow(request=request) # Handle the response print(response) @@ -337,9 +341,9 @@ async def get_migration_workflow( from google.cloud import bigquery_migration_v2alpha - def sample_get_migration_workflow(): + async def sample_get_migration_workflow(): # Create a client - client = bigquery_migration_v2alpha.MigrationServiceClient() + client = bigquery_migration_v2alpha.MigrationServiceAsyncClient() # Initialize request argument(s) request = bigquery_migration_v2alpha.GetMigrationWorkflowRequest( @@ -347,7 +351,7 @@ def sample_get_migration_workflow(): ) # Make the request - response = client.get_migration_workflow(request=request) + response = await client.get_migration_workflow(request=request) # Handle the response print(response) @@ -443,9 +447,9 @@ async def list_migration_workflows( from google.cloud import bigquery_migration_v2alpha - def sample_list_migration_workflows(): + async def sample_list_migration_workflows(): # Create a client - client = bigquery_migration_v2alpha.MigrationServiceClient() + client = bigquery_migration_v2alpha.MigrationServiceAsyncClient() # Initialize request argument(s) request = bigquery_migration_v2alpha.ListMigrationWorkflowsRequest( @@ -456,7 +460,7 @@ def sample_list_migration_workflows(): page_result = client.list_migration_workflows(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -560,9 +564,9 @@ async def delete_migration_workflow( from google.cloud import bigquery_migration_v2alpha - def sample_delete_migration_workflow(): + async def sample_delete_migration_workflow(): # Create a client - client = bigquery_migration_v2alpha.MigrationServiceClient() + client = bigquery_migration_v2alpha.MigrationServiceAsyncClient() # Initialize request argument(s) request = bigquery_migration_v2alpha.DeleteMigrationWorkflowRequest( @@ -570,7 +574,7 @@ def sample_delete_migration_workflow(): ) # Make the request - client.delete_migration_workflow(request=request) + await client.delete_migration_workflow(request=request) Args: request (Union[google.cloud.bigquery_migration_v2alpha.types.DeleteMigrationWorkflowRequest, dict]): @@ -644,14 +648,13 @@ async def start_migration_workflow( signaled if the state is anything other than DRAFT or RUNNING. - .. code-block:: python from google.cloud import bigquery_migration_v2alpha - def sample_start_migration_workflow(): + async def sample_start_migration_workflow(): # Create a client - client = bigquery_migration_v2alpha.MigrationServiceClient() + client = bigquery_migration_v2alpha.MigrationServiceAsyncClient() # Initialize request argument(s) request = bigquery_migration_v2alpha.StartMigrationWorkflowRequest( @@ -659,7 +662,7 @@ def sample_start_migration_workflow(): ) # Make the request - client.start_migration_workflow(request=request) + await client.start_migration_workflow(request=request) Args: request (Union[google.cloud.bigquery_migration_v2alpha.types.StartMigrationWorkflowRequest, dict]): @@ -742,9 +745,9 @@ async def get_migration_subtask( from google.cloud import bigquery_migration_v2alpha - def sample_get_migration_subtask(): + async def sample_get_migration_subtask(): # Create a client - client = bigquery_migration_v2alpha.MigrationServiceClient() + client = bigquery_migration_v2alpha.MigrationServiceAsyncClient() # Initialize request argument(s) request = bigquery_migration_v2alpha.GetMigrationSubtaskRequest( @@ -752,7 +755,7 @@ def sample_get_migration_subtask(): ) # Make the request - response = client.get_migration_subtask(request=request) + response = await client.get_migration_subtask(request=request) # Handle the response print(response) @@ -851,9 +854,9 @@ async def list_migration_subtasks( from google.cloud import bigquery_migration_v2alpha - def sample_list_migration_subtasks(): + async def sample_list_migration_subtasks(): # Create a client - client = bigquery_migration_v2alpha.MigrationServiceClient() + client = bigquery_migration_v2alpha.MigrationServiceAsyncClient() # Initialize request argument(s) request = bigquery_migration_v2alpha.ListMigrationSubtasksRequest( @@ -864,7 +867,7 @@ def sample_list_migration_subtasks(): page_result = client.list_migration_subtasks(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: diff --git a/google/cloud/bigquery_migration_v2alpha/services/migration_service/client.py b/google/cloud/bigquery_migration_v2alpha/services/migration_service/client.py index 4b84546..1c545c3 100644 --- a/google/cloud/bigquery_migration_v2alpha/services/migration_service/client.py +++ b/google/cloud/bigquery_migration_v2alpha/services/migration_service/client.py @@ -16,32 +16,36 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # 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 from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore -from google.cloud.bigquery_migration_v2alpha.services.migration_service import pagers -from google.cloud.bigquery_migration_v2alpha.types import migration_entities -from google.cloud.bigquery_migration_v2alpha.types import migration_error_details -from google.cloud.bigquery_migration_v2alpha.types import migration_metrics -from google.cloud.bigquery_migration_v2alpha.types import migration_service from google.protobuf import timestamp_pb2 # type: ignore from google.rpc import error_details_pb2 # type: ignore -from .transports.base import MigrationServiceTransport, DEFAULT_CLIENT_INFO + +from google.cloud.bigquery_migration_v2alpha.services.migration_service import pagers +from google.cloud.bigquery_migration_v2alpha.types import ( + migration_entities, + migration_error_details, + migration_metrics, + migration_service, +) + +from .transports.base import DEFAULT_CLIENT_INFO, MigrationServiceTransport from .transports.grpc import MigrationServiceGrpcTransport from .transports.grpc_asyncio import MigrationServiceGrpcAsyncIOTransport @@ -870,7 +874,6 @@ def start_migration_workflow( signaled if the state is anything other than DRAFT or RUNNING. - .. code-block:: python from google.cloud import bigquery_migration_v2alpha diff --git a/google/cloud/bigquery_migration_v2alpha/services/migration_service/pagers.py b/google/cloud/bigquery_migration_v2alpha/services/migration_service/pagers.py index 86f159b..312df0a 100644 --- a/google/cloud/bigquery_migration_v2alpha/services/migration_service/pagers.py +++ b/google/cloud/bigquery_migration_v2alpha/services/migration_service/pagers.py @@ -18,14 +18,16 @@ AsyncIterator, Awaitable, Callable, + Iterator, + Optional, Sequence, Tuple, - Optional, - Iterator, ) -from google.cloud.bigquery_migration_v2alpha.types import migration_entities -from google.cloud.bigquery_migration_v2alpha.types import migration_service +from google.cloud.bigquery_migration_v2alpha.types import ( + migration_entities, + migration_service, +) class ListMigrationWorkflowsPager: diff --git a/google/cloud/bigquery_migration_v2alpha/services/migration_service/transports/__init__.py b/google/cloud/bigquery_migration_v2alpha/services/migration_service/transports/__init__.py index 10ee142..3baa428 100644 --- a/google/cloud/bigquery_migration_v2alpha/services/migration_service/transports/__init__.py +++ b/google/cloud/bigquery_migration_v2alpha/services/migration_service/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import MigrationServiceGrpcTransport from .grpc_asyncio import MigrationServiceGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[MigrationServiceTransport]] _transport_registry["grpc"] = MigrationServiceGrpcTransport diff --git a/google/cloud/bigquery_migration_v2alpha/services/migration_service/transports/base.py b/google/cloud/bigquery_migration_v2alpha/services/migration_service/transports/base.py index 984bd13..083f473 100644 --- a/google/cloud/bigquery_migration_v2alpha/services/migration_service/transports/base.py +++ b/google/cloud/bigquery_migration_v2alpha/services/migration_service/transports/base.py @@ -15,19 +15,21 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore - -from google.cloud.bigquery_migration_v2alpha.types import migration_entities -from google.cloud.bigquery_migration_v2alpha.types import migration_service from google.protobuf import empty_pb2 # type: ignore +import pkg_resources + +from google.cloud.bigquery_migration_v2alpha.types import ( + migration_entities, + migration_service, +) try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -82,6 +84,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -291,5 +294,9 @@ def list_migration_subtasks( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("MigrationServiceTransport",) diff --git a/google/cloud/bigquery_migration_v2alpha/services/migration_service/transports/grpc.py b/google/cloud/bigquery_migration_v2alpha/services/migration_service/transports/grpc.py index 990cddf..a295cda 100644 --- a/google/cloud/bigquery_migration_v2alpha/services/migration_service/transports/grpc.py +++ b/google/cloud/bigquery_migration_v2alpha/services/migration_service/transports/grpc.py @@ -13,21 +13,22 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.protobuf import empty_pb2 # type: ignore import grpc # type: ignore -from google.cloud.bigquery_migration_v2alpha.types import migration_entities -from google.cloud.bigquery_migration_v2alpha.types import migration_service -from google.protobuf import empty_pb2 # type: ignore -from .base import MigrationServiceTransport, DEFAULT_CLIENT_INFO +from google.cloud.bigquery_migration_v2alpha.types import ( + migration_entities, + migration_service, +) + +from .base import DEFAULT_CLIENT_INFO, MigrationServiceTransport class MigrationServiceGrpcTransport(MigrationServiceTransport): @@ -433,5 +434,9 @@ def list_migration_subtasks( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("MigrationServiceGrpcTransport",) diff --git a/google/cloud/bigquery_migration_v2alpha/services/migration_service/transports/grpc_asyncio.py b/google/cloud/bigquery_migration_v2alpha/services/migration_service/transports/grpc_asyncio.py index 59f2c0c..3b2b936 100644 --- a/google/cloud/bigquery_migration_v2alpha/services/migration_service/transports/grpc_asyncio.py +++ b/google/cloud/bigquery_migration_v2alpha/services/migration_service/transports/grpc_asyncio.py @@ -13,21 +13,22 @@ # 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, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async +from google.api_core import gapic_v1, grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.protobuf import empty_pb2 # type: ignore import grpc # type: ignore from grpc.experimental import aio # type: ignore -from google.cloud.bigquery_migration_v2alpha.types import migration_entities -from google.cloud.bigquery_migration_v2alpha.types import migration_service -from google.protobuf import empty_pb2 # type: ignore -from .base import MigrationServiceTransport, DEFAULT_CLIENT_INFO +from google.cloud.bigquery_migration_v2alpha.types import ( + migration_entities, + migration_service, +) + +from .base import DEFAULT_CLIENT_INFO, MigrationServiceTransport from .grpc import MigrationServiceGrpcTransport diff --git a/google/cloud/bigquery_migration_v2alpha/types/__init__.py b/google/cloud/bigquery_migration_v2alpha/types/__init__.py index 214cfbb..8d18db5 100644 --- a/google/cloud/bigquery_migration_v2alpha/types/__init__.py +++ b/google/cloud/bigquery_migration_v2alpha/types/__init__.py @@ -13,27 +13,15 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .assessment_task import ( - AssessmentOrchestrationResultDetails, - AssessmentTaskDetails, -) +from .assessment_task import AssessmentOrchestrationResultDetails, AssessmentTaskDetails from .migration_entities import ( MigrationSubtask, MigrationTask, MigrationTaskOrchestrationResult, MigrationWorkflow, ) -from .migration_error_details import ( - ErrorDetail, - ErrorLocation, - ResourceErrorDetail, -) -from .migration_metrics import ( - Point, - TimeInterval, - TimeSeries, - TypedValue, -) +from .migration_error_details import ErrorDetail, ErrorLocation, ResourceErrorDetail +from .migration_metrics import Point, TimeInterval, TimeSeries, TypedValue from .migration_service import ( CreateMigrationWorkflowRequest, DeleteMigrationWorkflowRequest, diff --git a/google/cloud/bigquery_migration_v2alpha/types/assessment_task.py b/google/cloud/bigquery_migration_v2alpha/types/assessment_task.py index 6865bc7..9688fc7 100644 --- a/google/cloud/bigquery_migration_v2alpha/types/assessment_task.py +++ b/google/cloud/bigquery_migration_v2alpha/types/assessment_task.py @@ -15,7 +15,6 @@ # import proto # type: ignore - __protobuf__ = proto.module( package="google.cloud.bigquery.migration.v2alpha", manifest={ diff --git a/google/cloud/bigquery_migration_v2alpha/types/migration_entities.py b/google/cloud/bigquery_migration_v2alpha/types/migration_entities.py index be880f7..47885ef 100644 --- a/google/cloud/bigquery_migration_v2alpha/types/migration_entities.py +++ b/google/cloud/bigquery_migration_v2alpha/types/migration_entities.py @@ -13,16 +13,17 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - -from google.cloud.bigquery_migration_v2alpha.types import assessment_task -from google.cloud.bigquery_migration_v2alpha.types import migration_error_details -from google.cloud.bigquery_migration_v2alpha.types import migration_metrics -from google.cloud.bigquery_migration_v2alpha.types import translation_task from google.protobuf import any_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore from google.rpc import error_details_pb2 # type: ignore +import proto # type: ignore +from google.cloud.bigquery_migration_v2alpha.types import ( + assessment_task, + migration_error_details, + migration_metrics, + translation_task, +) __protobuf__ = proto.module( package="google.cloud.bigquery.migration.v2alpha", @@ -49,7 +50,7 @@ class MigrationWorkflow(proto.Message): The display name of the workflow. This can be set to give a workflow a descriptive name. There is no guarantee or enforcement of uniqueness. - tasks (Sequence[google.cloud.bigquery_migration_v2alpha.types.MigrationWorkflow.TasksEntry]): + tasks (Mapping[str, google.cloud.bigquery_migration_v2alpha.types.MigrationTask]): The tasks in a workflow in a named map. The name (i.e. key) has no meaning and is merely a convenient way to address a specific task in a diff --git a/google/cloud/bigquery_migration_v2alpha/types/migration_error_details.py b/google/cloud/bigquery_migration_v2alpha/types/migration_error_details.py index 7885bd7..fedccca 100644 --- a/google/cloud/bigquery_migration_v2alpha/types/migration_error_details.py +++ b/google/cloud/bigquery_migration_v2alpha/types/migration_error_details.py @@ -13,10 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.rpc import error_details_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.cloud.bigquery.migration.v2alpha", diff --git a/google/cloud/bigquery_migration_v2alpha/types/migration_metrics.py b/google/cloud/bigquery_migration_v2alpha/types/migration_metrics.py index a3f53be..761250d 100644 --- a/google/cloud/bigquery_migration_v2alpha/types/migration_metrics.py +++ b/google/cloud/bigquery_migration_v2alpha/types/migration_metrics.py @@ -13,12 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.api import distribution_pb2 # type: ignore from google.api import metric_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.cloud.bigquery.migration.v2alpha", diff --git a/google/cloud/bigquery_migration_v2alpha/types/migration_service.py b/google/cloud/bigquery_migration_v2alpha/types/migration_service.py index 20e9bc3..76bccf8 100644 --- a/google/cloud/bigquery_migration_v2alpha/types/migration_service.py +++ b/google/cloud/bigquery_migration_v2alpha/types/migration_service.py @@ -13,11 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.protobuf import field_mask_pb2 # type: ignore import proto # type: ignore from google.cloud.bigquery_migration_v2alpha.types import migration_entities -from google.protobuf import field_mask_pb2 # type: ignore - __protobuf__ = proto.module( package="google.cloud.bigquery.migration.v2alpha", diff --git a/google/cloud/bigquery_migration_v2alpha/types/translation_task.py b/google/cloud/bigquery_migration_v2alpha/types/translation_task.py index 5c76b7b..5c2b58a 100644 --- a/google/cloud/bigquery_migration_v2alpha/types/translation_task.py +++ b/google/cloud/bigquery_migration_v2alpha/types/translation_task.py @@ -15,7 +15,6 @@ # import proto # type: ignore - __protobuf__ = proto.module( package="google.cloud.bigquery.migration.v2alpha", manifest={ @@ -91,7 +90,7 @@ class TranslationTaskDetails(proto.Message): The file encoding type. identifier_settings (google.cloud.bigquery_migration_v2alpha.types.IdentifierSettings): The settings for SQL identifiers. - special_token_map (Sequence[google.cloud.bigquery_migration_v2alpha.types.TranslationTaskDetails.SpecialTokenMapEntry]): + special_token_map (Mapping[str, google.cloud.bigquery_migration_v2alpha.types.TranslationTaskDetails.TokenType]): The map capturing special tokens to be replaced during translation. The key is special token in string. The value is the token data @@ -259,7 +258,7 @@ class BteqOptions(proto.Message): The Cloud Storage location to be used as the default path for files that are not otherwise specified in the file replacement map. - file_replacement_map (Sequence[google.cloud.bigquery_migration_v2alpha.types.BteqOptions.FileReplacementMapEntry]): + file_replacement_map (Mapping[str, str]): Maps the local paths that are used in BTEQ scripts (the keys) to the paths in Cloud Storage that should be used in their stead in the diff --git a/noxfile.py b/noxfile.py index 6ee5e8a..7c1742d 100644 --- a/noxfile.py +++ b/noxfile.py @@ -17,6 +17,7 @@ # Generated by synthtool. DO NOT EDIT! from __future__ import absolute_import + import os import pathlib import shutil @@ -25,7 +26,8 @@ import nox BLACK_VERSION = "black==22.3.0" -BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +ISORT_VERSION = "isort==5.10.1" +LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" @@ -83,7 +85,7 @@ def lint(session): session.run( "black", "--check", - *BLACK_PATHS, + *LINT_PATHS, ) session.run("flake8", "google", "tests") @@ -94,7 +96,27 @@ def blacken(session): session.install(BLACK_VERSION) session.run( "black", - *BLACK_PATHS, + *LINT_PATHS, + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def format(session): + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run( + "isort", + "--fss", + *LINT_PATHS, + ) + session.run( + "black", + *LINT_PATHS, ) diff --git a/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_create_migration_workflow_async.py b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_create_migration_workflow_async.py new file mode 100644 index 0000000..5fa45d2 --- /dev/null +++ b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_create_migration_workflow_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateMigrationWorkflow +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-bigquery-migration + + +# [START bigquerymigration_v2alpha_generated_MigrationService_CreateMigrationWorkflow_async] +from google.cloud import bigquery_migration_v2alpha + + +async def sample_create_migration_workflow(): + # Create a client + client = bigquery_migration_v2alpha.MigrationServiceAsyncClient() + + # Initialize request argument(s) + request = bigquery_migration_v2alpha.CreateMigrationWorkflowRequest( + parent="parent_value", + ) + + # Make the request + response = await client.create_migration_workflow(request=request) + + # Handle the response + print(response) + +# [END bigquerymigration_v2alpha_generated_MigrationService_CreateMigrationWorkflow_async] diff --git a/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_create_migration_workflow_sync.py b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_create_migration_workflow_sync.py new file mode 100644 index 0000000..e669e6e --- /dev/null +++ b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_create_migration_workflow_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateMigrationWorkflow +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-bigquery-migration + + +# [START bigquerymigration_v2alpha_generated_MigrationService_CreateMigrationWorkflow_sync] +from google.cloud import bigquery_migration_v2alpha + + +def sample_create_migration_workflow(): + # Create a client + client = bigquery_migration_v2alpha.MigrationServiceClient() + + # Initialize request argument(s) + request = bigquery_migration_v2alpha.CreateMigrationWorkflowRequest( + parent="parent_value", + ) + + # Make the request + response = client.create_migration_workflow(request=request) + + # Handle the response + print(response) + +# [END bigquerymigration_v2alpha_generated_MigrationService_CreateMigrationWorkflow_sync] diff --git a/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_delete_migration_workflow_async.py b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_delete_migration_workflow_async.py new file mode 100644 index 0000000..9754d02 --- /dev/null +++ b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_delete_migration_workflow_async.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteMigrationWorkflow +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-bigquery-migration + + +# [START bigquerymigration_v2alpha_generated_MigrationService_DeleteMigrationWorkflow_async] +from google.cloud import bigquery_migration_v2alpha + + +async def sample_delete_migration_workflow(): + # Create a client + client = bigquery_migration_v2alpha.MigrationServiceAsyncClient() + + # Initialize request argument(s) + request = bigquery_migration_v2alpha.DeleteMigrationWorkflowRequest( + name="name_value", + ) + + # Make the request + await client.delete_migration_workflow(request=request) + + +# [END bigquerymigration_v2alpha_generated_MigrationService_DeleteMigrationWorkflow_async] diff --git a/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_delete_migration_workflow_sync.py b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_delete_migration_workflow_sync.py new file mode 100644 index 0000000..cf7a9ac --- /dev/null +++ b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_delete_migration_workflow_sync.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteMigrationWorkflow +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-bigquery-migration + + +# [START bigquerymigration_v2alpha_generated_MigrationService_DeleteMigrationWorkflow_sync] +from google.cloud import bigquery_migration_v2alpha + + +def sample_delete_migration_workflow(): + # Create a client + client = bigquery_migration_v2alpha.MigrationServiceClient() + + # Initialize request argument(s) + request = bigquery_migration_v2alpha.DeleteMigrationWorkflowRequest( + name="name_value", + ) + + # Make the request + client.delete_migration_workflow(request=request) + + +# [END bigquerymigration_v2alpha_generated_MigrationService_DeleteMigrationWorkflow_sync] diff --git a/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_get_migration_subtask_async.py b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_get_migration_subtask_async.py new file mode 100644 index 0000000..238c7c4 --- /dev/null +++ b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_get_migration_subtask_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetMigrationSubtask +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-bigquery-migration + + +# [START bigquerymigration_v2alpha_generated_MigrationService_GetMigrationSubtask_async] +from google.cloud import bigquery_migration_v2alpha + + +async def sample_get_migration_subtask(): + # Create a client + client = bigquery_migration_v2alpha.MigrationServiceAsyncClient() + + # Initialize request argument(s) + request = bigquery_migration_v2alpha.GetMigrationSubtaskRequest( + name="name_value", + ) + + # Make the request + response = await client.get_migration_subtask(request=request) + + # Handle the response + print(response) + +# [END bigquerymigration_v2alpha_generated_MigrationService_GetMigrationSubtask_async] diff --git a/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_get_migration_subtask_sync.py b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_get_migration_subtask_sync.py new file mode 100644 index 0000000..eb7b23c --- /dev/null +++ b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_get_migration_subtask_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetMigrationSubtask +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-bigquery-migration + + +# [START bigquerymigration_v2alpha_generated_MigrationService_GetMigrationSubtask_sync] +from google.cloud import bigquery_migration_v2alpha + + +def sample_get_migration_subtask(): + # Create a client + client = bigquery_migration_v2alpha.MigrationServiceClient() + + # Initialize request argument(s) + request = bigquery_migration_v2alpha.GetMigrationSubtaskRequest( + name="name_value", + ) + + # Make the request + response = client.get_migration_subtask(request=request) + + # Handle the response + print(response) + +# [END bigquerymigration_v2alpha_generated_MigrationService_GetMigrationSubtask_sync] diff --git a/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_get_migration_workflow_async.py b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_get_migration_workflow_async.py new file mode 100644 index 0000000..45a6473 --- /dev/null +++ b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_get_migration_workflow_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetMigrationWorkflow +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-bigquery-migration + + +# [START bigquerymigration_v2alpha_generated_MigrationService_GetMigrationWorkflow_async] +from google.cloud import bigquery_migration_v2alpha + + +async def sample_get_migration_workflow(): + # Create a client + client = bigquery_migration_v2alpha.MigrationServiceAsyncClient() + + # Initialize request argument(s) + request = bigquery_migration_v2alpha.GetMigrationWorkflowRequest( + name="name_value", + ) + + # Make the request + response = await client.get_migration_workflow(request=request) + + # Handle the response + print(response) + +# [END bigquerymigration_v2alpha_generated_MigrationService_GetMigrationWorkflow_async] diff --git a/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_get_migration_workflow_sync.py b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_get_migration_workflow_sync.py new file mode 100644 index 0000000..fad8d73 --- /dev/null +++ b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_get_migration_workflow_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetMigrationWorkflow +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-bigquery-migration + + +# [START bigquerymigration_v2alpha_generated_MigrationService_GetMigrationWorkflow_sync] +from google.cloud import bigquery_migration_v2alpha + + +def sample_get_migration_workflow(): + # Create a client + client = bigquery_migration_v2alpha.MigrationServiceClient() + + # Initialize request argument(s) + request = bigquery_migration_v2alpha.GetMigrationWorkflowRequest( + name="name_value", + ) + + # Make the request + response = client.get_migration_workflow(request=request) + + # Handle the response + print(response) + +# [END bigquerymigration_v2alpha_generated_MigrationService_GetMigrationWorkflow_sync] diff --git a/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_list_migration_subtasks_async.py b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_list_migration_subtasks_async.py new file mode 100644 index 0000000..dc4cda1 --- /dev/null +++ b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_list_migration_subtasks_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListMigrationSubtasks +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-bigquery-migration + + +# [START bigquerymigration_v2alpha_generated_MigrationService_ListMigrationSubtasks_async] +from google.cloud import bigquery_migration_v2alpha + + +async def sample_list_migration_subtasks(): + # Create a client + client = bigquery_migration_v2alpha.MigrationServiceAsyncClient() + + # Initialize request argument(s) + request = bigquery_migration_v2alpha.ListMigrationSubtasksRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_migration_subtasks(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END bigquerymigration_v2alpha_generated_MigrationService_ListMigrationSubtasks_async] diff --git a/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_list_migration_subtasks_sync.py b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_list_migration_subtasks_sync.py new file mode 100644 index 0000000..f3f4bd0 --- /dev/null +++ b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_list_migration_subtasks_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListMigrationSubtasks +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-bigquery-migration + + +# [START bigquerymigration_v2alpha_generated_MigrationService_ListMigrationSubtasks_sync] +from google.cloud import bigquery_migration_v2alpha + + +def sample_list_migration_subtasks(): + # Create a client + client = bigquery_migration_v2alpha.MigrationServiceClient() + + # Initialize request argument(s) + request = bigquery_migration_v2alpha.ListMigrationSubtasksRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_migration_subtasks(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END bigquerymigration_v2alpha_generated_MigrationService_ListMigrationSubtasks_sync] diff --git a/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_list_migration_workflows_async.py b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_list_migration_workflows_async.py new file mode 100644 index 0000000..868a82f --- /dev/null +++ b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_list_migration_workflows_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListMigrationWorkflows +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-bigquery-migration + + +# [START bigquerymigration_v2alpha_generated_MigrationService_ListMigrationWorkflows_async] +from google.cloud import bigquery_migration_v2alpha + + +async def sample_list_migration_workflows(): + # Create a client + client = bigquery_migration_v2alpha.MigrationServiceAsyncClient() + + # Initialize request argument(s) + request = bigquery_migration_v2alpha.ListMigrationWorkflowsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_migration_workflows(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END bigquerymigration_v2alpha_generated_MigrationService_ListMigrationWorkflows_async] diff --git a/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_list_migration_workflows_sync.py b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_list_migration_workflows_sync.py new file mode 100644 index 0000000..c48711f --- /dev/null +++ b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_list_migration_workflows_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListMigrationWorkflows +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-bigquery-migration + + +# [START bigquerymigration_v2alpha_generated_MigrationService_ListMigrationWorkflows_sync] +from google.cloud import bigquery_migration_v2alpha + + +def sample_list_migration_workflows(): + # Create a client + client = bigquery_migration_v2alpha.MigrationServiceClient() + + # Initialize request argument(s) + request = bigquery_migration_v2alpha.ListMigrationWorkflowsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_migration_workflows(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END bigquerymigration_v2alpha_generated_MigrationService_ListMigrationWorkflows_sync] diff --git a/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_start_migration_workflow_async.py b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_start_migration_workflow_async.py new file mode 100644 index 0000000..670e67a --- /dev/null +++ b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_start_migration_workflow_async.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for StartMigrationWorkflow +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-bigquery-migration + + +# [START bigquerymigration_v2alpha_generated_MigrationService_StartMigrationWorkflow_async] +from google.cloud import bigquery_migration_v2alpha + + +async def sample_start_migration_workflow(): + # Create a client + client = bigquery_migration_v2alpha.MigrationServiceAsyncClient() + + # Initialize request argument(s) + request = bigquery_migration_v2alpha.StartMigrationWorkflowRequest( + name="name_value", + ) + + # Make the request + await client.start_migration_workflow(request=request) + + +# [END bigquerymigration_v2alpha_generated_MigrationService_StartMigrationWorkflow_async] diff --git a/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_start_migration_workflow_sync.py b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_start_migration_workflow_sync.py new file mode 100644 index 0000000..6f8ad6b --- /dev/null +++ b/samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_start_migration_workflow_sync.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for StartMigrationWorkflow +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-bigquery-migration + + +# [START bigquerymigration_v2alpha_generated_MigrationService_StartMigrationWorkflow_sync] +from google.cloud import bigquery_migration_v2alpha + + +def sample_start_migration_workflow(): + # Create a client + client = bigquery_migration_v2alpha.MigrationServiceClient() + + # Initialize request argument(s) + request = bigquery_migration_v2alpha.StartMigrationWorkflowRequest( + name="name_value", + ) + + # Make the request + client.start_migration_workflow(request=request) + + +# [END bigquerymigration_v2alpha_generated_MigrationService_StartMigrationWorkflow_sync] diff --git a/samples/generated_samples/snippet_metadata_bigquery migration_v2.json b/samples/generated_samples/snippet_metadata_bigquery migration_v2.json index f7ba68b..5d9f389 100644 --- a/samples/generated_samples/snippet_metadata_bigquery migration_v2.json +++ b/samples/generated_samples/snippet_metadata_bigquery migration_v2.json @@ -1,16 +1,65 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.bigquery.migration.v2", + "version": "v2" + } + ], + "language": "PYTHON", + "name": "google-cloud-bigquery-migration" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceAsyncClient", + "shortName": "MigrationServiceAsyncClient" + }, + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceAsyncClient.create_migration_workflow", "method": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService.CreateMigrationWorkflow", "service": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService", "shortName": "MigrationService" }, "shortName": "CreateMigrationWorkflow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2.types.CreateMigrationWorkflowRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "migration_workflow", + "type": "google.cloud.bigquery_migration_v2.types.MigrationWorkflow" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_migration_v2.types.MigrationWorkflow", + "shortName": "create_migration_workflow" }, + "description": "Sample for CreateMigrationWorkflow", "file": "bigquerymigration_v2_generated_migration_service_create_migration_workflow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigquerymigration_v2_generated_MigrationService_CreateMigrationWorkflow_async", "segments": [ { @@ -43,18 +92,58 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigquerymigration_v2_generated_migration_service_create_migration_workflow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceClient", + "shortName": "MigrationServiceClient" + }, + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceClient.create_migration_workflow", "method": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService.CreateMigrationWorkflow", "service": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService", "shortName": "MigrationService" }, "shortName": "CreateMigrationWorkflow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2.types.CreateMigrationWorkflowRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "migration_workflow", + "type": "google.cloud.bigquery_migration_v2.types.MigrationWorkflow" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_migration_v2.types.MigrationWorkflow", + "shortName": "create_migration_workflow" }, + "description": "Sample for CreateMigrationWorkflow", "file": "bigquerymigration_v2_generated_migration_service_create_migration_workflow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigquerymigration_v2_generated_MigrationService_CreateMigrationWorkflow_sync", "segments": [ { @@ -87,19 +176,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigquerymigration_v2_generated_migration_service_create_migration_workflow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceAsyncClient", + "shortName": "MigrationServiceAsyncClient" + }, + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceAsyncClient.delete_migration_workflow", "method": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService.DeleteMigrationWorkflow", "service": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService", "shortName": "MigrationService" }, "shortName": "DeleteMigrationWorkflow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2.types.DeleteMigrationWorkflowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_migration_workflow" }, + "description": "Sample for DeleteMigrationWorkflow", "file": "bigquerymigration_v2_generated_migration_service_delete_migration_workflow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigquerymigration_v2_generated_MigrationService_DeleteMigrationWorkflow_async", "segments": [ { @@ -130,18 +254,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigquerymigration_v2_generated_migration_service_delete_migration_workflow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceClient", + "shortName": "MigrationServiceClient" + }, + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceClient.delete_migration_workflow", "method": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService.DeleteMigrationWorkflow", "service": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService", "shortName": "MigrationService" }, "shortName": "DeleteMigrationWorkflow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2.types.DeleteMigrationWorkflowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_migration_workflow" }, + "description": "Sample for DeleteMigrationWorkflow", "file": "bigquerymigration_v2_generated_migration_service_delete_migration_workflow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigquerymigration_v2_generated_MigrationService_DeleteMigrationWorkflow_sync", "segments": [ { @@ -172,19 +331,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigquerymigration_v2_generated_migration_service_delete_migration_workflow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceAsyncClient", + "shortName": "MigrationServiceAsyncClient" + }, + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceAsyncClient.get_migration_subtask", "method": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService.GetMigrationSubtask", "service": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService", "shortName": "MigrationService" }, "shortName": "GetMigrationSubtask" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2.types.GetMigrationSubtaskRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_migration_v2.types.MigrationSubtask", + "shortName": "get_migration_subtask" }, + "description": "Sample for GetMigrationSubtask", "file": "bigquerymigration_v2_generated_migration_service_get_migration_subtask_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigquerymigration_v2_generated_MigrationService_GetMigrationSubtask_async", "segments": [ { @@ -217,18 +412,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigquerymigration_v2_generated_migration_service_get_migration_subtask_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceClient", + "shortName": "MigrationServiceClient" + }, + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceClient.get_migration_subtask", "method": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService.GetMigrationSubtask", "service": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService", "shortName": "MigrationService" }, "shortName": "GetMigrationSubtask" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2.types.GetMigrationSubtaskRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_migration_v2.types.MigrationSubtask", + "shortName": "get_migration_subtask" }, + "description": "Sample for GetMigrationSubtask", "file": "bigquerymigration_v2_generated_migration_service_get_migration_subtask_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigquerymigration_v2_generated_MigrationService_GetMigrationSubtask_sync", "segments": [ { @@ -261,19 +492,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigquerymigration_v2_generated_migration_service_get_migration_subtask_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceAsyncClient", + "shortName": "MigrationServiceAsyncClient" + }, + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceAsyncClient.get_migration_workflow", "method": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService.GetMigrationWorkflow", "service": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService", "shortName": "MigrationService" }, "shortName": "GetMigrationWorkflow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2.types.GetMigrationWorkflowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_migration_v2.types.MigrationWorkflow", + "shortName": "get_migration_workflow" }, + "description": "Sample for GetMigrationWorkflow", "file": "bigquerymigration_v2_generated_migration_service_get_migration_workflow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigquerymigration_v2_generated_MigrationService_GetMigrationWorkflow_async", "segments": [ { @@ -306,18 +573,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigquerymigration_v2_generated_migration_service_get_migration_workflow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceClient", + "shortName": "MigrationServiceClient" + }, + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceClient.get_migration_workflow", "method": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService.GetMigrationWorkflow", "service": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService", "shortName": "MigrationService" }, "shortName": "GetMigrationWorkflow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2.types.GetMigrationWorkflowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_migration_v2.types.MigrationWorkflow", + "shortName": "get_migration_workflow" }, + "description": "Sample for GetMigrationWorkflow", "file": "bigquerymigration_v2_generated_migration_service_get_migration_workflow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigquerymigration_v2_generated_MigrationService_GetMigrationWorkflow_sync", "segments": [ { @@ -350,19 +653,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigquerymigration_v2_generated_migration_service_get_migration_workflow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceAsyncClient", + "shortName": "MigrationServiceAsyncClient" + }, + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceAsyncClient.list_migration_subtasks", "method": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService.ListMigrationSubtasks", "service": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService", "shortName": "MigrationService" }, "shortName": "ListMigrationSubtasks" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2.types.ListMigrationSubtasksRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_migration_v2.services.migration_service.pagers.ListMigrationSubtasksAsyncPager", + "shortName": "list_migration_subtasks" }, + "description": "Sample for ListMigrationSubtasks", "file": "bigquerymigration_v2_generated_migration_service_list_migration_subtasks_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigquerymigration_v2_generated_MigrationService_ListMigrationSubtasks_async", "segments": [ { @@ -395,18 +734,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigquerymigration_v2_generated_migration_service_list_migration_subtasks_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceClient", + "shortName": "MigrationServiceClient" + }, + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceClient.list_migration_subtasks", "method": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService.ListMigrationSubtasks", "service": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService", "shortName": "MigrationService" }, "shortName": "ListMigrationSubtasks" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2.types.ListMigrationSubtasksRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_migration_v2.services.migration_service.pagers.ListMigrationSubtasksPager", + "shortName": "list_migration_subtasks" }, + "description": "Sample for ListMigrationSubtasks", "file": "bigquerymigration_v2_generated_migration_service_list_migration_subtasks_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigquerymigration_v2_generated_MigrationService_ListMigrationSubtasks_sync", "segments": [ { @@ -439,19 +814,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigquerymigration_v2_generated_migration_service_list_migration_subtasks_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceAsyncClient", + "shortName": "MigrationServiceAsyncClient" + }, + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceAsyncClient.list_migration_workflows", "method": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService.ListMigrationWorkflows", "service": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService", "shortName": "MigrationService" }, "shortName": "ListMigrationWorkflows" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2.types.ListMigrationWorkflowsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_migration_v2.services.migration_service.pagers.ListMigrationWorkflowsAsyncPager", + "shortName": "list_migration_workflows" }, + "description": "Sample for ListMigrationWorkflows", "file": "bigquerymigration_v2_generated_migration_service_list_migration_workflows_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigquerymigration_v2_generated_MigrationService_ListMigrationWorkflows_async", "segments": [ { @@ -484,18 +895,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigquerymigration_v2_generated_migration_service_list_migration_workflows_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceClient", + "shortName": "MigrationServiceClient" + }, + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceClient.list_migration_workflows", "method": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService.ListMigrationWorkflows", "service": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService", "shortName": "MigrationService" }, "shortName": "ListMigrationWorkflows" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2.types.ListMigrationWorkflowsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_migration_v2.services.migration_service.pagers.ListMigrationWorkflowsPager", + "shortName": "list_migration_workflows" }, + "description": "Sample for ListMigrationWorkflows", "file": "bigquerymigration_v2_generated_migration_service_list_migration_workflows_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigquerymigration_v2_generated_MigrationService_ListMigrationWorkflows_sync", "segments": [ { @@ -528,19 +975,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigquerymigration_v2_generated_migration_service_list_migration_workflows_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceAsyncClient", + "shortName": "MigrationServiceAsyncClient" + }, + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceAsyncClient.start_migration_workflow", "method": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService.StartMigrationWorkflow", "service": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService", "shortName": "MigrationService" }, "shortName": "StartMigrationWorkflow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2.types.StartMigrationWorkflowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "start_migration_workflow" }, + "description": "Sample for StartMigrationWorkflow", "file": "bigquerymigration_v2_generated_migration_service_start_migration_workflow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigquerymigration_v2_generated_MigrationService_StartMigrationWorkflow_async", "segments": [ { @@ -571,18 +1053,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigquerymigration_v2_generated_migration_service_start_migration_workflow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceClient", + "shortName": "MigrationServiceClient" + }, + "fullName": "google.cloud.bigquery_migration_v2.MigrationServiceClient.start_migration_workflow", "method": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService.StartMigrationWorkflow", "service": { + "fullName": "google.cloud.bigquery.migration.v2.MigrationService", "shortName": "MigrationService" }, "shortName": "StartMigrationWorkflow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2.types.StartMigrationWorkflowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "start_migration_workflow" }, + "description": "Sample for StartMigrationWorkflow", "file": "bigquerymigration_v2_generated_migration_service_start_migration_workflow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "bigquerymigration_v2_generated_MigrationService_StartMigrationWorkflow_sync", "segments": [ { @@ -613,7 +1130,8 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "bigquerymigration_v2_generated_migration_service_start_migration_workflow_sync.py" } ] } diff --git a/samples/generated_samples/snippet_metadata_bigquery migration_v2alpha.json b/samples/generated_samples/snippet_metadata_bigquery migration_v2alpha.json new file mode 100644 index 0000000..287e139 --- /dev/null +++ b/samples/generated_samples/snippet_metadata_bigquery migration_v2alpha.json @@ -0,0 +1,1137 @@ +{ + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.bigquery.migration.v2alpha", + "version": "v2alpha" + } + ], + "language": "PYTHON", + "name": "google-cloud-bigquery-migration" + }, + "snippets": [ + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceAsyncClient", + "shortName": "MigrationServiceAsyncClient" + }, + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceAsyncClient.create_migration_workflow", + "method": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService.CreateMigrationWorkflow", + "service": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService", + "shortName": "MigrationService" + }, + "shortName": "CreateMigrationWorkflow" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2alpha.types.CreateMigrationWorkflowRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "migration_workflow", + "type": "google.cloud.bigquery_migration_v2alpha.types.MigrationWorkflow" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_migration_v2alpha.types.MigrationWorkflow", + "shortName": "create_migration_workflow" + }, + "description": "Sample for CreateMigrationWorkflow", + "file": "bigquerymigration_v2alpha_generated_migration_service_create_migration_workflow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "bigquerymigration_v2alpha_generated_MigrationService_CreateMigrationWorkflow_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "bigquerymigration_v2alpha_generated_migration_service_create_migration_workflow_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceClient", + "shortName": "MigrationServiceClient" + }, + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceClient.create_migration_workflow", + "method": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService.CreateMigrationWorkflow", + "service": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService", + "shortName": "MigrationService" + }, + "shortName": "CreateMigrationWorkflow" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2alpha.types.CreateMigrationWorkflowRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "migration_workflow", + "type": "google.cloud.bigquery_migration_v2alpha.types.MigrationWorkflow" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_migration_v2alpha.types.MigrationWorkflow", + "shortName": "create_migration_workflow" + }, + "description": "Sample for CreateMigrationWorkflow", + "file": "bigquerymigration_v2alpha_generated_migration_service_create_migration_workflow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "bigquerymigration_v2alpha_generated_MigrationService_CreateMigrationWorkflow_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "bigquerymigration_v2alpha_generated_migration_service_create_migration_workflow_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceAsyncClient", + "shortName": "MigrationServiceAsyncClient" + }, + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceAsyncClient.delete_migration_workflow", + "method": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService.DeleteMigrationWorkflow", + "service": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService", + "shortName": "MigrationService" + }, + "shortName": "DeleteMigrationWorkflow" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2alpha.types.DeleteMigrationWorkflowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_migration_workflow" + }, + "description": "Sample for DeleteMigrationWorkflow", + "file": "bigquerymigration_v2alpha_generated_migration_service_delete_migration_workflow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "bigquerymigration_v2alpha_generated_MigrationService_DeleteMigrationWorkflow_async", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ], + "title": "bigquerymigration_v2alpha_generated_migration_service_delete_migration_workflow_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceClient", + "shortName": "MigrationServiceClient" + }, + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceClient.delete_migration_workflow", + "method": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService.DeleteMigrationWorkflow", + "service": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService", + "shortName": "MigrationService" + }, + "shortName": "DeleteMigrationWorkflow" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2alpha.types.DeleteMigrationWorkflowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_migration_workflow" + }, + "description": "Sample for DeleteMigrationWorkflow", + "file": "bigquerymigration_v2alpha_generated_migration_service_delete_migration_workflow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "bigquerymigration_v2alpha_generated_MigrationService_DeleteMigrationWorkflow_sync", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ], + "title": "bigquerymigration_v2alpha_generated_migration_service_delete_migration_workflow_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceAsyncClient", + "shortName": "MigrationServiceAsyncClient" + }, + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceAsyncClient.get_migration_subtask", + "method": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService.GetMigrationSubtask", + "service": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService", + "shortName": "MigrationService" + }, + "shortName": "GetMigrationSubtask" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2alpha.types.GetMigrationSubtaskRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_migration_v2alpha.types.MigrationSubtask", + "shortName": "get_migration_subtask" + }, + "description": "Sample for GetMigrationSubtask", + "file": "bigquerymigration_v2alpha_generated_migration_service_get_migration_subtask_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "bigquerymigration_v2alpha_generated_MigrationService_GetMigrationSubtask_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "bigquerymigration_v2alpha_generated_migration_service_get_migration_subtask_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceClient", + "shortName": "MigrationServiceClient" + }, + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceClient.get_migration_subtask", + "method": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService.GetMigrationSubtask", + "service": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService", + "shortName": "MigrationService" + }, + "shortName": "GetMigrationSubtask" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2alpha.types.GetMigrationSubtaskRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_migration_v2alpha.types.MigrationSubtask", + "shortName": "get_migration_subtask" + }, + "description": "Sample for GetMigrationSubtask", + "file": "bigquerymigration_v2alpha_generated_migration_service_get_migration_subtask_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "bigquerymigration_v2alpha_generated_MigrationService_GetMigrationSubtask_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "bigquerymigration_v2alpha_generated_migration_service_get_migration_subtask_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceAsyncClient", + "shortName": "MigrationServiceAsyncClient" + }, + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceAsyncClient.get_migration_workflow", + "method": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService.GetMigrationWorkflow", + "service": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService", + "shortName": "MigrationService" + }, + "shortName": "GetMigrationWorkflow" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2alpha.types.GetMigrationWorkflowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_migration_v2alpha.types.MigrationWorkflow", + "shortName": "get_migration_workflow" + }, + "description": "Sample for GetMigrationWorkflow", + "file": "bigquerymigration_v2alpha_generated_migration_service_get_migration_workflow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "bigquerymigration_v2alpha_generated_MigrationService_GetMigrationWorkflow_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "bigquerymigration_v2alpha_generated_migration_service_get_migration_workflow_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceClient", + "shortName": "MigrationServiceClient" + }, + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceClient.get_migration_workflow", + "method": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService.GetMigrationWorkflow", + "service": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService", + "shortName": "MigrationService" + }, + "shortName": "GetMigrationWorkflow" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2alpha.types.GetMigrationWorkflowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_migration_v2alpha.types.MigrationWorkflow", + "shortName": "get_migration_workflow" + }, + "description": "Sample for GetMigrationWorkflow", + "file": "bigquerymigration_v2alpha_generated_migration_service_get_migration_workflow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "bigquerymigration_v2alpha_generated_MigrationService_GetMigrationWorkflow_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "bigquerymigration_v2alpha_generated_migration_service_get_migration_workflow_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceAsyncClient", + "shortName": "MigrationServiceAsyncClient" + }, + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceAsyncClient.list_migration_subtasks", + "method": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService.ListMigrationSubtasks", + "service": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService", + "shortName": "MigrationService" + }, + "shortName": "ListMigrationSubtasks" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2alpha.types.ListMigrationSubtasksRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_migration_v2alpha.services.migration_service.pagers.ListMigrationSubtasksAsyncPager", + "shortName": "list_migration_subtasks" + }, + "description": "Sample for ListMigrationSubtasks", + "file": "bigquerymigration_v2alpha_generated_migration_service_list_migration_subtasks_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "bigquerymigration_v2alpha_generated_MigrationService_ListMigrationSubtasks_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "bigquerymigration_v2alpha_generated_migration_service_list_migration_subtasks_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceClient", + "shortName": "MigrationServiceClient" + }, + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceClient.list_migration_subtasks", + "method": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService.ListMigrationSubtasks", + "service": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService", + "shortName": "MigrationService" + }, + "shortName": "ListMigrationSubtasks" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2alpha.types.ListMigrationSubtasksRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_migration_v2alpha.services.migration_service.pagers.ListMigrationSubtasksPager", + "shortName": "list_migration_subtasks" + }, + "description": "Sample for ListMigrationSubtasks", + "file": "bigquerymigration_v2alpha_generated_migration_service_list_migration_subtasks_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "bigquerymigration_v2alpha_generated_MigrationService_ListMigrationSubtasks_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "bigquerymigration_v2alpha_generated_migration_service_list_migration_subtasks_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceAsyncClient", + "shortName": "MigrationServiceAsyncClient" + }, + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceAsyncClient.list_migration_workflows", + "method": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService.ListMigrationWorkflows", + "service": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService", + "shortName": "MigrationService" + }, + "shortName": "ListMigrationWorkflows" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2alpha.types.ListMigrationWorkflowsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_migration_v2alpha.services.migration_service.pagers.ListMigrationWorkflowsAsyncPager", + "shortName": "list_migration_workflows" + }, + "description": "Sample for ListMigrationWorkflows", + "file": "bigquerymigration_v2alpha_generated_migration_service_list_migration_workflows_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "bigquerymigration_v2alpha_generated_MigrationService_ListMigrationWorkflows_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "bigquerymigration_v2alpha_generated_migration_service_list_migration_workflows_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceClient", + "shortName": "MigrationServiceClient" + }, + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceClient.list_migration_workflows", + "method": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService.ListMigrationWorkflows", + "service": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService", + "shortName": "MigrationService" + }, + "shortName": "ListMigrationWorkflows" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2alpha.types.ListMigrationWorkflowsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.bigquery_migration_v2alpha.services.migration_service.pagers.ListMigrationWorkflowsPager", + "shortName": "list_migration_workflows" + }, + "description": "Sample for ListMigrationWorkflows", + "file": "bigquerymigration_v2alpha_generated_migration_service_list_migration_workflows_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "bigquerymigration_v2alpha_generated_MigrationService_ListMigrationWorkflows_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "bigquerymigration_v2alpha_generated_migration_service_list_migration_workflows_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceAsyncClient", + "shortName": "MigrationServiceAsyncClient" + }, + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceAsyncClient.start_migration_workflow", + "method": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService.StartMigrationWorkflow", + "service": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService", + "shortName": "MigrationService" + }, + "shortName": "StartMigrationWorkflow" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2alpha.types.StartMigrationWorkflowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "start_migration_workflow" + }, + "description": "Sample for StartMigrationWorkflow", + "file": "bigquerymigration_v2alpha_generated_migration_service_start_migration_workflow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "bigquerymigration_v2alpha_generated_MigrationService_StartMigrationWorkflow_async", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ], + "title": "bigquerymigration_v2alpha_generated_migration_service_start_migration_workflow_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceClient", + "shortName": "MigrationServiceClient" + }, + "fullName": "google.cloud.bigquery_migration_v2alpha.MigrationServiceClient.start_migration_workflow", + "method": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService.StartMigrationWorkflow", + "service": { + "fullName": "google.cloud.bigquery.migration.v2alpha.MigrationService", + "shortName": "MigrationService" + }, + "shortName": "StartMigrationWorkflow" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.bigquery_migration_v2alpha.types.StartMigrationWorkflowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "start_migration_workflow" + }, + "description": "Sample for StartMigrationWorkflow", + "file": "bigquerymigration_v2alpha_generated_migration_service_start_migration_workflow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "bigquerymigration_v2alpha_generated_MigrationService_StartMigrationWorkflow_sync", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ], + "title": "bigquerymigration_v2alpha_generated_migration_service_start_migration_workflow_sync.py" + } + ] +} diff --git a/scripts/readme-gen/readme_gen.py b/scripts/readme-gen/readme_gen.py index d309d6e..91b5967 100644 --- a/scripts/readme-gen/readme_gen.py +++ b/scripts/readme-gen/readme_gen.py @@ -28,7 +28,10 @@ jinja_env = jinja2.Environment( trim_blocks=True, loader=jinja2.FileSystemLoader( - os.path.abspath(os.path.join(os.path.dirname(__file__), 'templates')))) + os.path.abspath(os.path.join(os.path.dirname(__file__), "templates")) + ), + autoescape=True, +) README_TMPL = jinja_env.get_template('README.tmpl.rst') diff --git a/setup.py b/setup.py index ece9e47..616263c 100644 --- a/setup.py +++ b/setup.py @@ -15,9 +15,10 @@ # import io import os + import setuptools # type: ignore -version = "0.4.0" +version = "0.4.1" package_root = os.path.abspath(os.path.dirname(__file__)) diff --git a/tests/unit/gapic/bigquery_migration_v2/test_migration_service.py b/tests/unit/gapic/bigquery_migration_v2/test_migration_service.py index 08dc9c1..33cec52 100644 --- a/tests/unit/gapic/bigquery_migration_v2/test_migration_service.py +++ b/tests/unit/gapic/bigquery_migration_v2/test_migration_service.py @@ -13,42 +13,38 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import os -import mock - -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule - +import os +from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template from google.api_core import client_options 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 -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError -from google.cloud.bigquery_migration_v2.services.migration_service import ( - MigrationServiceAsyncClient, -) -from google.cloud.bigquery_migration_v2.services.migration_service import ( - MigrationServiceClient, -) -from google.cloud.bigquery_migration_v2.services.migration_service import pagers -from google.cloud.bigquery_migration_v2.services.migration_service import transports -from google.cloud.bigquery_migration_v2.types import migration_entities -from google.cloud.bigquery_migration_v2.types import migration_error_details -from google.cloud.bigquery_migration_v2.types import migration_metrics -from google.cloud.bigquery_migration_v2.types import migration_service -from google.cloud.bigquery_migration_v2.types import translation_config from google.oauth2 import service_account from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore from google.rpc import error_details_pb2 # type: ignore -import google.auth +import grpc +from grpc.experimental import aio +import mock +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + +from google.cloud.bigquery_migration_v2.services.migration_service import ( + MigrationServiceAsyncClient, + MigrationServiceClient, + pagers, + transports, +) +from google.cloud.bigquery_migration_v2.types import ( + migration_entities, + migration_error_details, + migration_metrics, + migration_service, + translation_config, +) def client_cert_source_callback(): @@ -97,24 +93,26 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - MigrationServiceClient, - MigrationServiceAsyncClient, + (MigrationServiceClient, "grpc"), + (MigrationServiceAsyncClient, "grpc_asyncio"), ], ) -def test_migration_service_client_from_service_account_info(client_class): +def test_migration_service_client_from_service_account_info( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "bigquerymigration.googleapis.com:443" + assert client.transport._host == ("bigquerymigration.googleapis.com:443") @pytest.mark.parametrize( @@ -143,27 +141,33 @@ def test_migration_service_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - MigrationServiceClient, - MigrationServiceAsyncClient, + (MigrationServiceClient, "grpc"), + (MigrationServiceAsyncClient, "grpc_asyncio"), ], ) -def test_migration_service_client_from_service_account_file(client_class): +def test_migration_service_client_from_service_account_file( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "bigquerymigration.googleapis.com:443" + assert client.transport._host == ("bigquerymigration.googleapis.com:443") def test_migration_service_client_get_transport_class(): @@ -776,7 +780,7 @@ def test_create_migration_workflow_field_headers(): # a field header. Set these to a non-empty value. request = migration_service.CreateMigrationWorkflowRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -794,7 +798,7 @@ def test_create_migration_workflow_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -808,7 +812,7 @@ async def test_create_migration_workflow_field_headers_async(): # a field header. Set these to a non-empty value. request = migration_service.CreateMigrationWorkflowRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -828,7 +832,7 @@ async def test_create_migration_workflow_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1041,7 +1045,7 @@ def test_get_migration_workflow_field_headers(): # a field header. Set these to a non-empty value. request = migration_service.GetMigrationWorkflowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1059,7 +1063,7 @@ def test_get_migration_workflow_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1073,7 +1077,7 @@ async def test_get_migration_workflow_field_headers_async(): # a field header. Set these to a non-empty value. request = migration_service.GetMigrationWorkflowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1093,7 +1097,7 @@ async def test_get_migration_workflow_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1288,7 +1292,7 @@ def test_list_migration_workflows_field_headers(): # a field header. Set these to a non-empty value. request = migration_service.ListMigrationWorkflowsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1306,7 +1310,7 @@ def test_list_migration_workflows_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1320,7 +1324,7 @@ async def test_list_migration_workflows_field_headers_async(): # a field header. Set these to a non-empty value. request = migration_service.ListMigrationWorkflowsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1340,7 +1344,7 @@ async def test_list_migration_workflows_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1477,7 +1481,7 @@ def test_list_migration_workflows_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, migration_entities.MigrationWorkflow) for i in results) @@ -1570,7 +1574,7 @@ async def test_list_migration_workflows_async_pager(): ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1620,7 +1624,9 @@ async def test_list_migration_workflows_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_migration_workflows(request={})).pages: + async for page_ in ( + await client.list_migration_workflows(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -1723,7 +1729,7 @@ def test_delete_migration_workflow_field_headers(): # a field header. Set these to a non-empty value. request = migration_service.DeleteMigrationWorkflowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1741,7 +1747,7 @@ def test_delete_migration_workflow_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1755,7 +1761,7 @@ async def test_delete_migration_workflow_field_headers_async(): # a field header. Set these to a non-empty value. request = migration_service.DeleteMigrationWorkflowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1773,7 +1779,7 @@ async def test_delete_migration_workflow_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1958,7 +1964,7 @@ def test_start_migration_workflow_field_headers(): # a field header. Set these to a non-empty value. request = migration_service.StartMigrationWorkflowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1976,7 +1982,7 @@ def test_start_migration_workflow_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1990,7 +1996,7 @@ async def test_start_migration_workflow_field_headers_async(): # a field header. Set these to a non-empty value. request = migration_service.StartMigrationWorkflowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2008,7 +2014,7 @@ async def test_start_migration_workflow_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2217,7 +2223,7 @@ def test_get_migration_subtask_field_headers(): # a field header. Set these to a non-empty value. request = migration_service.GetMigrationSubtaskRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2235,7 +2241,7 @@ def test_get_migration_subtask_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2249,7 +2255,7 @@ async def test_get_migration_subtask_field_headers_async(): # a field header. Set these to a non-empty value. request = migration_service.GetMigrationSubtaskRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2269,7 +2275,7 @@ async def test_get_migration_subtask_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2464,7 +2470,7 @@ def test_list_migration_subtasks_field_headers(): # a field header. Set these to a non-empty value. request = migration_service.ListMigrationSubtasksRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2482,7 +2488,7 @@ def test_list_migration_subtasks_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -2496,7 +2502,7 @@ async def test_list_migration_subtasks_field_headers_async(): # a field header. Set these to a non-empty value. request = migration_service.ListMigrationSubtasksRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2516,7 +2522,7 @@ async def test_list_migration_subtasks_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -2653,7 +2659,7 @@ def test_list_migration_subtasks_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, migration_entities.MigrationSubtask) for i in results) @@ -2746,7 +2752,7 @@ async def test_list_migration_subtasks_async_pager(): ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -2796,7 +2802,9 @@ async def test_list_migration_subtasks_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_migration_subtasks(request={})).pages: + async for page_ in ( + await client.list_migration_subtasks(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -2893,6 +2901,19 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = MigrationServiceClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = MigrationServiceClient( @@ -2941,6 +2962,14 @@ def test_migration_service_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_migration_service_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -3086,24 +3115,40 @@ def test_migration_service_grpc_transport_client_cert_source_for_mtls(transport_ ) -def test_migration_service_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_migration_service_host_no_port(transport_name): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="bigquerymigration.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "bigquerymigration.googleapis.com:443" + assert client.transport._host == ("bigquerymigration.googleapis.com:443") -def test_migration_service_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_migration_service_host_with_port(transport_name): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="bigquerymigration.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "bigquerymigration.googleapis.com:8000" + assert client.transport._host == ("bigquerymigration.googleapis.com:8000") def test_migration_service_grpc_transport_channel(): diff --git a/tests/unit/gapic/bigquery_migration_v2alpha/test_migration_service.py b/tests/unit/gapic/bigquery_migration_v2alpha/test_migration_service.py index 598f95d..59b17f6 100644 --- a/tests/unit/gapic/bigquery_migration_v2alpha/test_migration_service.py +++ b/tests/unit/gapic/bigquery_migration_v2alpha/test_migration_service.py @@ -13,46 +13,40 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import os -import mock - -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule - +import os +from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template from google.api_core import client_options 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 -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError -from google.cloud.bigquery_migration_v2alpha.services.migration_service import ( - MigrationServiceAsyncClient, -) -from google.cloud.bigquery_migration_v2alpha.services.migration_service import ( - MigrationServiceClient, -) -from google.cloud.bigquery_migration_v2alpha.services.migration_service import pagers -from google.cloud.bigquery_migration_v2alpha.services.migration_service import ( - transports, -) -from google.cloud.bigquery_migration_v2alpha.types import assessment_task -from google.cloud.bigquery_migration_v2alpha.types import migration_entities -from google.cloud.bigquery_migration_v2alpha.types import migration_error_details -from google.cloud.bigquery_migration_v2alpha.types import migration_metrics -from google.cloud.bigquery_migration_v2alpha.types import migration_service -from google.cloud.bigquery_migration_v2alpha.types import translation_task from google.oauth2 import service_account from google.protobuf import any_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore from google.rpc import error_details_pb2 # type: ignore -import google.auth +import grpc +from grpc.experimental import aio +import mock +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + +from google.cloud.bigquery_migration_v2alpha.services.migration_service import ( + MigrationServiceAsyncClient, + MigrationServiceClient, + pagers, + transports, +) +from google.cloud.bigquery_migration_v2alpha.types import ( + assessment_task, + migration_entities, + migration_error_details, + migration_metrics, + migration_service, + translation_task, +) def client_cert_source_callback(): @@ -101,24 +95,26 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - MigrationServiceClient, - MigrationServiceAsyncClient, + (MigrationServiceClient, "grpc"), + (MigrationServiceAsyncClient, "grpc_asyncio"), ], ) -def test_migration_service_client_from_service_account_info(client_class): +def test_migration_service_client_from_service_account_info( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "bigquerymigration.googleapis.com:443" + assert client.transport._host == ("bigquerymigration.googleapis.com:443") @pytest.mark.parametrize( @@ -147,27 +143,33 @@ def test_migration_service_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - MigrationServiceClient, - MigrationServiceAsyncClient, + (MigrationServiceClient, "grpc"), + (MigrationServiceAsyncClient, "grpc_asyncio"), ], ) -def test_migration_service_client_from_service_account_file(client_class): +def test_migration_service_client_from_service_account_file( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "bigquerymigration.googleapis.com:443" + assert client.transport._host == ("bigquerymigration.googleapis.com:443") def test_migration_service_client_get_transport_class(): @@ -780,7 +782,7 @@ def test_create_migration_workflow_field_headers(): # a field header. Set these to a non-empty value. request = migration_service.CreateMigrationWorkflowRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -798,7 +800,7 @@ def test_create_migration_workflow_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -812,7 +814,7 @@ async def test_create_migration_workflow_field_headers_async(): # a field header. Set these to a non-empty value. request = migration_service.CreateMigrationWorkflowRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -832,7 +834,7 @@ async def test_create_migration_workflow_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1045,7 +1047,7 @@ def test_get_migration_workflow_field_headers(): # a field header. Set these to a non-empty value. request = migration_service.GetMigrationWorkflowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1063,7 +1065,7 @@ def test_get_migration_workflow_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1077,7 +1079,7 @@ async def test_get_migration_workflow_field_headers_async(): # a field header. Set these to a non-empty value. request = migration_service.GetMigrationWorkflowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1097,7 +1099,7 @@ async def test_get_migration_workflow_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1292,7 +1294,7 @@ def test_list_migration_workflows_field_headers(): # a field header. Set these to a non-empty value. request = migration_service.ListMigrationWorkflowsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1310,7 +1312,7 @@ def test_list_migration_workflows_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1324,7 +1326,7 @@ async def test_list_migration_workflows_field_headers_async(): # a field header. Set these to a non-empty value. request = migration_service.ListMigrationWorkflowsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1344,7 +1346,7 @@ async def test_list_migration_workflows_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1481,7 +1483,7 @@ def test_list_migration_workflows_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, migration_entities.MigrationWorkflow) for i in results) @@ -1574,7 +1576,7 @@ async def test_list_migration_workflows_async_pager(): ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1624,7 +1626,9 @@ async def test_list_migration_workflows_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_migration_workflows(request={})).pages: + async for page_ in ( + await client.list_migration_workflows(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -1727,7 +1731,7 @@ def test_delete_migration_workflow_field_headers(): # a field header. Set these to a non-empty value. request = migration_service.DeleteMigrationWorkflowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1745,7 +1749,7 @@ def test_delete_migration_workflow_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1759,7 +1763,7 @@ async def test_delete_migration_workflow_field_headers_async(): # a field header. Set these to a non-empty value. request = migration_service.DeleteMigrationWorkflowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1777,7 +1781,7 @@ async def test_delete_migration_workflow_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1962,7 +1966,7 @@ def test_start_migration_workflow_field_headers(): # a field header. Set these to a non-empty value. request = migration_service.StartMigrationWorkflowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1980,7 +1984,7 @@ def test_start_migration_workflow_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1994,7 +1998,7 @@ async def test_start_migration_workflow_field_headers_async(): # a field header. Set these to a non-empty value. request = migration_service.StartMigrationWorkflowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2012,7 +2016,7 @@ async def test_start_migration_workflow_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2221,7 +2225,7 @@ def test_get_migration_subtask_field_headers(): # a field header. Set these to a non-empty value. request = migration_service.GetMigrationSubtaskRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2239,7 +2243,7 @@ def test_get_migration_subtask_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2253,7 +2257,7 @@ async def test_get_migration_subtask_field_headers_async(): # a field header. Set these to a non-empty value. request = migration_service.GetMigrationSubtaskRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2273,7 +2277,7 @@ async def test_get_migration_subtask_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2468,7 +2472,7 @@ def test_list_migration_subtasks_field_headers(): # a field header. Set these to a non-empty value. request = migration_service.ListMigrationSubtasksRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2486,7 +2490,7 @@ def test_list_migration_subtasks_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -2500,7 +2504,7 @@ async def test_list_migration_subtasks_field_headers_async(): # a field header. Set these to a non-empty value. request = migration_service.ListMigrationSubtasksRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2520,7 +2524,7 @@ async def test_list_migration_subtasks_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -2657,7 +2661,7 @@ def test_list_migration_subtasks_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, migration_entities.MigrationSubtask) for i in results) @@ -2750,7 +2754,7 @@ async def test_list_migration_subtasks_async_pager(): ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -2800,7 +2804,9 @@ async def test_list_migration_subtasks_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_migration_subtasks(request={})).pages: + async for page_ in ( + await client.list_migration_subtasks(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -2897,6 +2903,19 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = MigrationServiceClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = MigrationServiceClient( @@ -2945,6 +2964,14 @@ def test_migration_service_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_migration_service_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -3090,24 +3117,40 @@ def test_migration_service_grpc_transport_client_cert_source_for_mtls(transport_ ) -def test_migration_service_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_migration_service_host_no_port(transport_name): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="bigquerymigration.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "bigquerymigration.googleapis.com:443" + assert client.transport._host == ("bigquerymigration.googleapis.com:443") -def test_migration_service_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_migration_service_host_with_port(transport_name): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="bigquerymigration.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "bigquerymigration.googleapis.com:8000" + assert client.transport._host == ("bigquerymigration.googleapis.com:8000") def test_migration_service_grpc_transport_channel():