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

Commit

Permalink
Browse files Browse the repository at this point in the history
chore: use gapic-generator-python 0.53.4 (#58)
- [ ] 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 0d2bfc0 commit c369810
Show file tree
Hide file tree
Showing 10 changed files with 126 additions and 194 deletions.

Large diffs are not rendered by default.

36 changes: 19 additions & 17 deletions google/cloud/clouddms_v1/services/data_migration_service/client.py
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.api_core import operation # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.clouddms_v1.services.data_migration_service import pagers
Expand Down Expand Up @@ -380,7 +382,7 @@ def list_migration_jobs(
request: Union[clouddms.ListMigrationJobsRequest, 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.ListMigrationJobsPager:
Expand Down Expand Up @@ -460,7 +462,7 @@ def get_migration_job(
request: Union[clouddms.GetMigrationJobRequest, 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]] = (),
) -> clouddms_resources.MigrationJob:
Expand Down Expand Up @@ -533,7 +535,7 @@ def create_migration_job(
parent: str = None,
migration_job: clouddms_resources.MigrationJob = None,
migration_job_id: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -638,7 +640,7 @@ def update_migration_job(
*,
migration_job: clouddms_resources.MigrationJob = None,
update_mask: field_mask_pb2.FieldMask = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -734,7 +736,7 @@ def delete_migration_job(
request: Union[clouddms.DeleteMigrationJobRequest, 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]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -825,7 +827,7 @@ def start_migration_job(
self,
request: Union[clouddms.StartMigrationJobRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -887,7 +889,7 @@ def stop_migration_job(
self,
request: Union[clouddms.StopMigrationJobRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -949,7 +951,7 @@ def resume_migration_job(
self,
request: Union[clouddms.ResumeMigrationJobRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -1012,7 +1014,7 @@ def promote_migration_job(
self,
request: Union[clouddms.PromoteMigrationJobRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -1076,7 +1078,7 @@ def verify_migration_job(
self,
request: Union[clouddms.VerifyMigrationJobRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -1140,7 +1142,7 @@ def restart_migration_job(
self,
request: Union[clouddms.RestartMigrationJobRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -1204,7 +1206,7 @@ def generate_ssh_script(
self,
request: Union[clouddms.GenerateSshScriptRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> clouddms.SshScript:
Expand Down Expand Up @@ -1258,7 +1260,7 @@ def list_connection_profiles(
request: Union[clouddms.ListConnectionProfilesRequest, 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.ListConnectionProfilesPager:
Expand Down Expand Up @@ -1339,7 +1341,7 @@ def get_connection_profile(
request: Union[clouddms.GetConnectionProfileRequest, 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]] = (),
) -> clouddms_resources.ConnectionProfile:
Expand Down Expand Up @@ -1410,7 +1412,7 @@ def create_connection_profile(
parent: str = None,
connection_profile: clouddms_resources.ConnectionProfile = None,
connection_profile_id: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -1514,7 +1516,7 @@ def update_connection_profile(
*,
connection_profile: clouddms_resources.ConnectionProfile = None,
update_mask: field_mask_pb2.FieldMask = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -1612,7 +1614,7 @@ def delete_connection_profile(
request: Union[clouddms.DeleteConnectionProfileRequest, 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]] = (),
) -> operation.Operation:
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 @@ -38,15 +37,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 DataMigrationServiceTransport(abc.ABC):
"""Abstract transport class for DataMigrationService."""
Expand Down Expand Up @@ -96,7 +86,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 @@ -129,29 +119,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 @@ -242,7 +209,7 @@ def close(self):
raise NotImplementedError()

@property
def operations_client(self) -> operations_v1.OperationsClient:
def operations_client(self):
"""Return the client designed to process long-running operations."""
raise NotImplementedError()

Expand Down
Expand Up @@ -113,7 +113,7 @@ def __init__(
self._grpc_channel = None
self._ssl_channel_credentials = ssl_channel_credentials
self._stubs: Dict[str, Callable] = {}
self._operations_client = None
self._operations_client: Optional[operations_v1.OperationsClient] = None

if api_mtls_endpoint:
warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
Expand Down
Expand Up @@ -21,7 +21,6 @@
from google.api_core import operations_v1 # 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 Expand Up @@ -160,7 +159,7 @@ def __init__(
self._grpc_channel = None
self._ssl_channel_credentials = ssl_channel_credentials
self._stubs: Dict[str, Callable] = {}
self._operations_client = None
self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None

if api_mtls_endpoint:
warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
Expand Down
9 changes: 9 additions & 0 deletions google/cloud/clouddms_v1/types/clouddms.py
Expand Up @@ -301,6 +301,13 @@ class RestartMigrationJobRequest(proto.Message):
class GenerateSshScriptRequest(proto.Message):
r"""Request message for 'GenerateSshScript' request.
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:
migration_job (str):
Name of the migration job resource to
Expand All @@ -310,8 +317,10 @@ class GenerateSshScriptRequest(proto.Message):
to create.
vm_creation_config (google.cloud.clouddms_v1.types.VmCreationConfig):
The VM creation configuration
This field is a member of `oneof`_ ``vm_config``.
vm_selection_config (google.cloud.clouddms_v1.types.VmSelectionConfig):
The VM selection configuration
This field is a member of `oneof`_ ``vm_config``.
vm_port (int):
The port that will be open on the bastion
host
Expand Down
29 changes: 29 additions & 0 deletions google/cloud/clouddms_v1/types/clouddms_resources.py
Expand Up @@ -212,6 +212,13 @@ class CloudSqlConnectionProfile(proto.Message):
class SqlAclEntry(proto.Message):
r"""An entry for an Access Control list.
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:
value (str):
The allowlisted value for the access control
Expand All @@ -220,9 +227,11 @@ class SqlAclEntry(proto.Message):
The time when this access control entry expires in `RFC
3339 <https://tools.ietf.org/html/rfc3339>`__ format, for
example: ``2012-11-15T16:19:00.094Z``.
This field is a member of `oneof`_ ``expiration``.
ttl (google.protobuf.duration_pb2.Duration):
Input only. The time-to-leave of this access
control entry.
This field is a member of `oneof`_ ``expiration``.
label (str):
A label to identify this entry.
"""
Expand Down Expand Up @@ -464,6 +473,13 @@ class DatabaseType(proto.Message):
class MigrationJob(proto.Message):
r"""Represents a Database Migration Service migration job object.
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:
name (str):
The name (URI) of this migration job
Expand Down Expand Up @@ -507,12 +523,15 @@ class MigrationJob(proto.Message):
reverse_ssh_connectivity (google.cloud.clouddms_v1.types.ReverseSshConnectivity):
The details needed to communicate to the
source over Reverse SSH tunnel connectivity.
This field is a member of `oneof`_ ``connectivity``.
vpc_peering_connectivity (google.cloud.clouddms_v1.types.VpcPeeringConnectivity):
The details of the VPC network that the
source database is located in.
This field is a member of `oneof`_ ``connectivity``.
static_ip_connectivity (google.cloud.clouddms_v1.types.StaticIpConnectivity):
static ip connectivity data (default, no
additional details needed).
This field is a member of `oneof`_ ``connectivity``.
duration (google.protobuf.duration_pb2.Duration):
Output only. The duration of the migration
job (in seconds). A duration in seconds with up
Expand Down Expand Up @@ -604,6 +623,13 @@ class Type(proto.Enum):
class ConnectionProfile(proto.Message):
r"""A connection profile definition.
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:
name (str):
The name of this connection profile resource
Expand Down Expand Up @@ -634,10 +660,13 @@ class ConnectionProfile(proto.Message):
The connection profile display name.
mysql (google.cloud.clouddms_v1.types.MySqlConnectionProfile):
A MySQL database connection profile.
This field is a member of `oneof`_ ``connection_profile``.
postgresql (google.cloud.clouddms_v1.types.PostgreSqlConnectionProfile):
A PostgreSQL database connection profile.
This field is a member of `oneof`_ ``connection_profile``.
cloudsql (google.cloud.clouddms_v1.types.CloudSqlConnectionProfile):
A CloudSQL database connection profile.
This field is a member of `oneof`_ ``connection_profile``.
error (google.rpc.status_pb2.Status):
Output only. The error details in case of
state FAILED.
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Expand Up @@ -29,9 +29,8 @@
# NOTE: Maintainers, please do not require google-api-core>=2.x.x
# Until this issue is closed
# https://github.com/googleapis/google-cloud-python/issues/10566
"google-api-core[grpc] >= 1.26.0, <3.0.0dev",
"google-api-core[grpc] >= 1.28.0, <3.0.0dev",
"proto-plus >= 1.15.0",
"packaging >= 14.3",
]

package_root = os.path.abspath(os.path.dirname(__file__))
Expand Down
4 changes: 1 addition & 3 deletions testing/constraints-3.6.txt
Expand Up @@ -4,7 +4,5 @@
# Pin the version to the lower bound.
# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev",
# Then this file should have google-cloud-foo==1.14.0
google-api-core==1.26.0
google-api-core==1.28.0
proto-plus==1.15.0
packaging==14.3
google-auth==1.24.0 # TODO: remove when google-auth>=1.25.0 si transitively required through google-api-core

0 comments on commit c369810

Please sign in to comment.