Skip to content
This repository has been archived by the owner on Oct 16, 2023. It is now read-only.

Commit

Permalink
chore: use gapic-generator-python 0.53.4 (#13)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

docs: list oneofs in docstring
fix(deps): require google-api-core >= 1.28.0
fix(deps): drop packaging dependency

committer: busunkim96@
PiperOrigin-RevId: 406468269

Source-Link: googleapis/googleapis@83d81b0

Source-Link: googleapis/googleapis-gen@2ff001f
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZmMDAxZmJhY2I5ZTc3ZTcxZDczNGRlNWY5NTVjMDVmZGFlODUyNiJ9
  • Loading branch information
gcf-owl-bot[bot] committed Nov 1, 2021
1 parent e81f728 commit 70ec0c5
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 151 deletions.
Expand Up @@ -19,13 +19,15 @@
from typing import Dict, Sequence, Tuple, Type, Union
import pkg_resources

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

OptionalRetry = Union[retries.Retry, object]

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
Expand Down Expand Up @@ -176,18 +178,18 @@ def __init__(

async def create_migration_workflow(
self,
request: migration_service.CreateMigrationWorkflowRequest = None,
request: Union[migration_service.CreateMigrationWorkflowRequest, dict] = None,
*,
parent: str = None,
migration_workflow: migration_entities.MigrationWorkflow = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> migration_entities.MigrationWorkflow:
r"""Creates a migration workflow.
Args:
request (:class:`google.cloud.bigquery_migration_v2alpha.types.CreateMigrationWorkflowRequest`):
request (Union[google.cloud.bigquery_migration_v2alpha.types.CreateMigrationWorkflowRequest, dict]):
The request object. Request to create a migration
workflow resource.
parent (:class:`str`):
Expand Down Expand Up @@ -259,17 +261,17 @@ async def create_migration_workflow(

async def get_migration_workflow(
self,
request: migration_service.GetMigrationWorkflowRequest = None,
request: Union[migration_service.GetMigrationWorkflowRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> migration_entities.MigrationWorkflow:
r"""Gets a previously created migration workflow.
Args:
request (:class:`google.cloud.bigquery_migration_v2alpha.types.GetMigrationWorkflowRequest`):
request (Union[google.cloud.bigquery_migration_v2alpha.types.GetMigrationWorkflowRequest, dict]):
The request object. A request to get a previously
created migration workflow.
name (:class:`str`):
Expand Down Expand Up @@ -341,17 +343,17 @@ async def get_migration_workflow(

async def list_migration_workflows(
self,
request: migration_service.ListMigrationWorkflowsRequest = None,
request: Union[migration_service.ListMigrationWorkflowsRequest, dict] = None,
*,
parent: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListMigrationWorkflowsAsyncPager:
r"""Lists previously created migration workflow.
Args:
request (:class:`google.cloud.bigquery_migration_v2alpha.types.ListMigrationWorkflowsRequest`):
request (Union[google.cloud.bigquery_migration_v2alpha.types.ListMigrationWorkflowsRequest, dict]):
The request object. A request to list previously created
migration workflows.
parent (:class:`str`):
Expand Down Expand Up @@ -430,17 +432,17 @@ async def list_migration_workflows(

async def delete_migration_workflow(
self,
request: migration_service.DeleteMigrationWorkflowRequest = None,
request: Union[migration_service.DeleteMigrationWorkflowRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
r"""Deletes a migration workflow by name.
Args:
request (:class:`google.cloud.bigquery_migration_v2alpha.types.DeleteMigrationWorkflowRequest`):
request (Union[google.cloud.bigquery_migration_v2alpha.types.DeleteMigrationWorkflowRequest, dict]):
The request object. A request to delete a previously
created migration workflow.
name (:class:`str`):
Expand Down Expand Up @@ -495,10 +497,10 @@ async def delete_migration_workflow(

async def start_migration_workflow(
self,
request: migration_service.StartMigrationWorkflowRequest = None,
request: Union[migration_service.StartMigrationWorkflowRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
Expand All @@ -509,7 +511,7 @@ async def start_migration_workflow(
RUNNING.
Args:
request (:class:`google.cloud.bigquery_migration_v2alpha.types.StartMigrationWorkflowRequest`):
request (Union[google.cloud.bigquery_migration_v2alpha.types.StartMigrationWorkflowRequest, dict]):
The request object. A request to start a previously
created migration workflow.
name (:class:`str`):
Expand Down Expand Up @@ -573,17 +575,17 @@ async def start_migration_workflow(

async def get_migration_subtask(
self,
request: migration_service.GetMigrationSubtaskRequest = None,
request: Union[migration_service.GetMigrationSubtaskRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> migration_entities.MigrationSubtask:
r"""Gets a previously created migration subtask.
Args:
request (:class:`google.cloud.bigquery_migration_v2alpha.types.GetMigrationSubtaskRequest`):
request (Union[google.cloud.bigquery_migration_v2alpha.types.GetMigrationSubtaskRequest, dict]):
The request object. A request to get a previously
created migration subtasks.
name (:class:`str`):
Expand Down Expand Up @@ -658,17 +660,17 @@ async def get_migration_subtask(

async def list_migration_subtasks(
self,
request: migration_service.ListMigrationSubtasksRequest = None,
request: Union[migration_service.ListMigrationSubtasksRequest, dict] = None,
*,
parent: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListMigrationSubtasksAsyncPager:
r"""Lists previously created migration subtasks.
Args:
request (:class:`google.cloud.bigquery_migration_v2alpha.types.ListMigrationSubtasksRequest`):
request (Union[google.cloud.bigquery_migration_v2alpha.types.ListMigrationSubtasksRequest, dict]):
The request object. A request to list previously created
migration subtasks.
parent (:class:`str`):
Expand Down
Expand Up @@ -30,6 +30,8 @@
from google.auth.exceptions import MutualTLSChannelError # type: ignore
from google.oauth2 import service_account # type: ignore

OptionalRetry = Union[retries.Retry, object]

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
Expand Down Expand Up @@ -376,7 +378,7 @@ def create_migration_workflow(
*,
parent: str = None,
migration_workflow: migration_entities.MigrationWorkflow = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> migration_entities.MigrationWorkflow:
Expand Down Expand Up @@ -460,7 +462,7 @@ def get_migration_workflow(
request: Union[migration_service.GetMigrationWorkflowRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> migration_entities.MigrationWorkflow:
Expand Down Expand Up @@ -533,7 +535,7 @@ def list_migration_workflows(
request: Union[migration_service.ListMigrationWorkflowsRequest, dict] = None,
*,
parent: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListMigrationWorkflowsPager:
Expand Down Expand Up @@ -613,7 +615,7 @@ def delete_migration_workflow(
request: Union[migration_service.DeleteMigrationWorkflowRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
Expand Down Expand Up @@ -680,7 +682,7 @@ def start_migration_workflow(
request: Union[migration_service.StartMigrationWorkflowRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
Expand Down Expand Up @@ -749,7 +751,7 @@ def get_migration_subtask(
request: Union[migration_service.GetMigrationSubtaskRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> migration_entities.MigrationSubtask:
Expand Down Expand Up @@ -825,7 +827,7 @@ def list_migration_subtasks(
request: Union[migration_service.ListMigrationSubtasksRequest, dict] = None,
*,
parent: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListMigrationSubtasksPager:
Expand Down
Expand Up @@ -15,7 +15,6 @@
#
import abc
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
import packaging.version
import pkg_resources

import google.auth # type: ignore
Expand All @@ -39,15 +38,6 @@
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()

try:
# google.auth.__version__ was added in 1.26.0
_GOOGLE_AUTH_VERSION = google.auth.__version__
except AttributeError:
try: # try pkg_resources if it is available
_GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version
except pkg_resources.DistributionNotFound: # pragma: NO COVER
_GOOGLE_AUTH_VERSION = None


class MigrationServiceTransport(abc.ABC):
"""Abstract transport class for MigrationService."""
Expand Down Expand Up @@ -97,7 +87,7 @@ def __init__(
host += ":443"
self._host = host

scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}

# Save the scopes.
self._scopes = scopes
Expand Down Expand Up @@ -130,29 +120,6 @@ def __init__(
# Save the credentials.
self._credentials = credentials

# TODO(busunkim): This method is in the base transport
# to avoid duplicating code across the transport classes. These functions
# should be deleted once the minimum required versions of google-auth is increased.

# TODO: Remove this function once google-auth >= 1.25.0 is required
@classmethod
def _get_scopes_kwargs(
cls, host: str, scopes: Optional[Sequence[str]]
) -> Dict[str, Optional[Sequence[str]]]:
"""Returns scopes kwargs to pass to google-auth methods depending on the google-auth version"""

scopes_kwargs = {}

if _GOOGLE_AUTH_VERSION and (
packaging.version.parse(_GOOGLE_AUTH_VERSION)
>= packaging.version.parse("1.25.0")
):
scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES}
else:
scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES}

return scopes_kwargs

def _prep_wrapped_messages(self, client_info):
# Precompute the wrapped methods.
self._wrapped_methods = {
Expand Down
Expand Up @@ -20,7 +20,6 @@
from google.api_core import grpc_helpers_async # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
import packaging.version

import grpc # type: ignore
from grpc.experimental import aio # type: ignore
Expand Down
12 changes: 12 additions & 0 deletions google/cloud/bigquery_migration_v2alpha/types/migration_metrics.py
Expand Up @@ -112,21 +112,33 @@ class TimeInterval(proto.Message):
class TypedValue(proto.Message):
r"""A single strongly-typed value.
This message has `oneof`_ fields (mutually exclusive fields).
For each oneof, at most one member field can be set at the same time.
Setting any member of the oneof automatically clears all other
members.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
bool_value (bool):
A Boolean value: ``true`` or ``false``.
This field is a member of `oneof`_ ``value``.
int64_value (int):
A 64-bit integer. Its range is approximately
+/-9.2x10^18.
This field is a member of `oneof`_ ``value``.
double_value (float):
A 64-bit double-precision floating-point
number. Its magnitude is approximately
+/-10^(+/-300) and it has 16 significant digits
of precision.
This field is a member of `oneof`_ ``value``.
string_value (str):
A variable-length string value.
This field is a member of `oneof`_ ``value``.
distribution_value (google.api.distribution_pb2.Distribution):
A distribution value.
This field is a member of `oneof`_ ``value``.
"""

bool_value = proto.Field(proto.BOOL, number=1, oneof="value",)
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Expand Up @@ -38,10 +38,9 @@
platforms="Posix; MacOS X; Windows",
include_package_data=True,
install_requires=(
"google-api-core[grpc] >= 1.27.0, < 3.0.0dev",
"google-api-core[grpc] >= 1.28.0, < 3.0.0dev",
"libcst >= 0.2.5",
"proto-plus >= 1.15.0",
"packaging >= 14.3",
),
python_requires=">=3.6",
classifiers=[
Expand Down
4 changes: 1 addition & 3 deletions testing/constraints-3.6.txt
Expand Up @@ -5,8 +5,6 @@
#
# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev",
# Then this file should have foo==1.14.0
google-api-core==1.27.0
google-auth==1.24.0 # TODO: remove when google-auth >= 1.25.0 is required transitively through google-api-core
google-api-core==1.28.0
proto-plus==1.15.0
libcst==0.2.5
packaging==14.3

0 comments on commit 70ec0c5

Please sign in to comment.