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..6ffcb2c 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,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -403,7 +403,7 @@ def sample_get_migration_workflow(): maximum=10.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, + core_exceptions.GoogleAPICallError, ), deadline=60.0, ), @@ -511,7 +511,7 @@ def sample_list_migration_workflows(): maximum=10.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, + core_exceptions.GoogleAPICallError, ), deadline=60.0, ), @@ -644,7 +644,6 @@ 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 @@ -705,7 +704,7 @@ def sample_start_migration_workflow(): maximum=10.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, + core_exceptions.GoogleAPICallError, ), deadline=60.0, ), 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..3bd0177 100644 --- a/google/cloud/bigquery_migration_v2/services/migration_service/client.py +++ b/google/cloud/bigquery_migration_v2/services/migration_service/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -870,7 +870,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/transports/base.py b/google/cloud/bigquery_migration_v2/services/migration_service/transports/base.py index 4c2a173..f827313 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 @@ -82,6 +82,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" @@ -134,7 +135,7 @@ def _prep_wrapped_messages(self, client_info): maximum=10.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, + core_exceptions.GoogleAPICallError, ), deadline=60.0, ), @@ -148,7 +149,7 @@ def _prep_wrapped_messages(self, client_info): maximum=10.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, + core_exceptions.GoogleAPICallError, ), deadline=60.0, ), @@ -167,7 +168,7 @@ def _prep_wrapped_messages(self, client_info): maximum=10.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, + core_exceptions.GoogleAPICallError, ), deadline=60.0, ), @@ -273,5 +274,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..9a5352f 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 @@ -433,5 +433,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/types/migration_entities.py b/google/cloud/bigquery_migration_v2/types/migration_entities.py index 9225a7e..d54203b 100644 --- a/google/cloud/bigquery_migration_v2/types/migration_entities.py +++ b/google/cloud/bigquery_migration_v2/types/migration_entities.py @@ -46,7 +46,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_v2alpha/services/migration_service/async_client.py b/google/cloud/bigquery_migration_v2alpha/services/migration_service/async_client.py index c7dc00a..9b5d37a 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,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -403,7 +403,7 @@ def sample_get_migration_workflow(): maximum=10.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, + core_exceptions.GoogleAPICallError, ), deadline=120.0, ), @@ -511,7 +511,7 @@ def sample_list_migration_workflows(): maximum=10.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, + core_exceptions.GoogleAPICallError, ), deadline=120.0, ), @@ -644,7 +644,6 @@ 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 @@ -705,7 +704,7 @@ def sample_start_migration_workflow(): maximum=10.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, + core_exceptions.GoogleAPICallError, ), deadline=120.0, ), @@ -811,7 +810,7 @@ def sample_get_migration_subtask(): maximum=10.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, + core_exceptions.GoogleAPICallError, ), deadline=120.0, ), @@ -918,7 +917,7 @@ def sample_list_migration_subtasks(): maximum=10.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, + core_exceptions.GoogleAPICallError, ), deadline=120.0, ), 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..f2420fd 100644 --- a/google/cloud/bigquery_migration_v2alpha/services/migration_service/client.py +++ b/google/cloud/bigquery_migration_v2alpha/services/migration_service/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -870,7 +870,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/transports/base.py b/google/cloud/bigquery_migration_v2alpha/services/migration_service/transports/base.py index 984bd13..a8c90cb 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 @@ -82,6 +82,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" @@ -134,7 +135,7 @@ def _prep_wrapped_messages(self, client_info): maximum=10.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, + core_exceptions.GoogleAPICallError, ), deadline=120.0, ), @@ -148,7 +149,7 @@ def _prep_wrapped_messages(self, client_info): maximum=10.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, + core_exceptions.GoogleAPICallError, ), deadline=120.0, ), @@ -167,7 +168,7 @@ def _prep_wrapped_messages(self, client_info): maximum=10.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, + core_exceptions.GoogleAPICallError, ), deadline=120.0, ), @@ -181,7 +182,7 @@ def _prep_wrapped_messages(self, client_info): maximum=10.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, + core_exceptions.GoogleAPICallError, ), deadline=120.0, ), @@ -195,7 +196,7 @@ def _prep_wrapped_messages(self, client_info): maximum=10.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, + core_exceptions.GoogleAPICallError, ), deadline=120.0, ), @@ -291,5 +292,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..ede98c0 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 @@ -433,5 +433,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/types/migration_entities.py b/google/cloud/bigquery_migration_v2alpha/types/migration_entities.py index be880f7..47b1a85 100644 --- a/google/cloud/bigquery_migration_v2alpha/types/migration_entities.py +++ b/google/cloud/bigquery_migration_v2alpha/types/migration_entities.py @@ -49,7 +49,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/translation_task.py b/google/cloud/bigquery_migration_v2alpha/types/translation_task.py index 5c76b7b..7bf6810 100644 --- a/google/cloud/bigquery_migration_v2alpha/types/translation_task.py +++ b/google/cloud/bigquery_migration_v2alpha/types/translation_task.py @@ -91,7 +91,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 +259,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/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_v2alpha.json b/samples/generated_samples/snippet_metadata_bigquery migration_v2alpha.json new file mode 100644 index 0000000..17dae71 --- /dev/null +++ b/samples/generated_samples/snippet_metadata_bigquery migration_v2alpha.json @@ -0,0 +1,619 @@ +{ + "snippets": [ + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "MigrationService" + }, + "shortName": "CreateMigrationWorkflow" + } + }, + "file": "bigquerymigration_v2alpha_generated_migration_service_create_migration_workflow_async.py", + "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" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "MigrationService" + }, + "shortName": "CreateMigrationWorkflow" + } + }, + "file": "bigquerymigration_v2alpha_generated_migration_service_create_migration_workflow_sync.py", + "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" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "MigrationService" + }, + "shortName": "DeleteMigrationWorkflow" + } + }, + "file": "bigquerymigration_v2alpha_generated_migration_service_delete_migration_workflow_async.py", + "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" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "MigrationService" + }, + "shortName": "DeleteMigrationWorkflow" + } + }, + "file": "bigquerymigration_v2alpha_generated_migration_service_delete_migration_workflow_sync.py", + "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" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "MigrationService" + }, + "shortName": "GetMigrationSubtask" + } + }, + "file": "bigquerymigration_v2alpha_generated_migration_service_get_migration_subtask_async.py", + "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" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "MigrationService" + }, + "shortName": "GetMigrationSubtask" + } + }, + "file": "bigquerymigration_v2alpha_generated_migration_service_get_migration_subtask_sync.py", + "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" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "MigrationService" + }, + "shortName": "GetMigrationWorkflow" + } + }, + "file": "bigquerymigration_v2alpha_generated_migration_service_get_migration_workflow_async.py", + "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" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "MigrationService" + }, + "shortName": "GetMigrationWorkflow" + } + }, + "file": "bigquerymigration_v2alpha_generated_migration_service_get_migration_workflow_sync.py", + "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" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "MigrationService" + }, + "shortName": "ListMigrationSubtasks" + } + }, + "file": "bigquerymigration_v2alpha_generated_migration_service_list_migration_subtasks_async.py", + "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" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "MigrationService" + }, + "shortName": "ListMigrationSubtasks" + } + }, + "file": "bigquerymigration_v2alpha_generated_migration_service_list_migration_subtasks_sync.py", + "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" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "MigrationService" + }, + "shortName": "ListMigrationWorkflows" + } + }, + "file": "bigquerymigration_v2alpha_generated_migration_service_list_migration_workflows_async.py", + "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" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "MigrationService" + }, + "shortName": "ListMigrationWorkflows" + } + }, + "file": "bigquerymigration_v2alpha_generated_migration_service_list_migration_workflows_sync.py", + "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" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "MigrationService" + }, + "shortName": "StartMigrationWorkflow" + } + }, + "file": "bigquerymigration_v2alpha_generated_migration_service_start_migration_workflow_async.py", + "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" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "MigrationService" + }, + "shortName": "StartMigrationWorkflow" + } + }, + "file": "bigquerymigration_v2alpha_generated_migration_service_start_migration_workflow_sync.py", + "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" + } + ] + } + ] +} 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..aa2fe5f 100644 --- a/tests/unit/gapic/bigquery_migration_v2/test_migration_service.py +++ b/tests/unit/gapic/bigquery_migration_v2/test_migration_service.py @@ -97,24 +97,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 +145,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(): @@ -1570,7 +1578,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 +1628,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 @@ -2746,7 +2756,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 +2806,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 +2905,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 +2966,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 +3119,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..6d26b71 100644 --- a/tests/unit/gapic/bigquery_migration_v2alpha/test_migration_service.py +++ b/tests/unit/gapic/bigquery_migration_v2alpha/test_migration_service.py @@ -101,24 +101,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 +149,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(): @@ -1574,7 +1582,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 +1632,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 @@ -2750,7 +2760,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 +2810,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 +2909,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 +2970,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 +3123,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():