diff --git a/google/cloud/dataproc_v1/services/autoscaling_policy_service/async_client.py b/google/cloud/dataproc_v1/services/autoscaling_policy_service/async_client.py index e1eeca2f..6f3af782 100644 --- a/google/cloud/dataproc_v1/services/autoscaling_policy_service/async_client.py +++ b/google/cloud/dataproc_v1/services/autoscaling_policy_service/async_client.py @@ -31,7 +31,7 @@ from google.cloud.dataproc_v1.services.autoscaling_policy_service import pagers from google.cloud.dataproc_v1.types import autoscaling_policies -from .transports.base import AutoscalingPolicyServiceTransport +from .transports.base import AutoscalingPolicyServiceTransport, DEFAULT_CLIENT_INFO from .transports.grpc_asyncio import AutoscalingPolicyServiceGrpcAsyncIOTransport from .client import AutoscalingPolicyServiceClient @@ -64,6 +64,7 @@ def __init__( credentials: credentials.Credentials = None, transport: Union[str, AutoscalingPolicyServiceTransport] = "grpc_asyncio", client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the autoscaling policy service client. @@ -96,7 +97,10 @@ def __init__( """ self._client = AutoscalingPolicyServiceClient( - credentials=credentials, transport=transport, client_options=client_options, + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, ) async def create_autoscaling_policy( @@ -175,7 +179,7 @@ async def create_autoscaling_policy( rpc = gapic_v1.method_async.wrap_method( self._client._transport.create_autoscaling_policy, default_timeout=600.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -257,7 +261,7 @@ async def update_autoscaling_policy( ), ), default_timeout=600.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -348,7 +352,7 @@ async def get_autoscaling_policy( ), ), default_timeout=600.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -440,7 +444,7 @@ async def list_autoscaling_policies( ), ), default_timeout=600.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -527,7 +531,7 @@ async def delete_autoscaling_policy( rpc = gapic_v1.method_async.wrap_method( self._client._transport.delete_autoscaling_policy, default_timeout=600.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -543,11 +547,11 @@ async def delete_autoscaling_policy( try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-cloud-dataproc",).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() __all__ = ("AutoscalingPolicyServiceAsyncClient",) diff --git a/google/cloud/dataproc_v1/services/autoscaling_policy_service/client.py b/google/cloud/dataproc_v1/services/autoscaling_policy_service/client.py index 8bf745b2..7f1a8050 100644 --- a/google/cloud/dataproc_v1/services/autoscaling_policy_service/client.py +++ b/google/cloud/dataproc_v1/services/autoscaling_policy_service/client.py @@ -33,7 +33,7 @@ from google.cloud.dataproc_v1.services.autoscaling_policy_service import pagers from google.cloud.dataproc_v1.types import autoscaling_policies -from .transports.base import AutoscalingPolicyServiceTransport +from .transports.base import AutoscalingPolicyServiceTransport, DEFAULT_CLIENT_INFO from .transports.grpc import AutoscalingPolicyServiceGrpcTransport from .transports.grpc_asyncio import AutoscalingPolicyServiceGrpcAsyncIOTransport @@ -156,6 +156,7 @@ def __init__( credentials: credentials.Credentials = None, transport: Union[str, AutoscalingPolicyServiceTransport] = None, client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the autoscaling policy service client. @@ -181,6 +182,11 @@ def __init__( (2) The ``client_cert_source`` property is used to provide client SSL credentials for mutual TLS transport. If not provided, the default SSL credentials will be used if present. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport @@ -238,6 +244,7 @@ def __init__( api_mtls_endpoint=client_options.api_endpoint, client_cert_source=client_options.client_cert_source, quota_project_id=client_options.quota_project_id, + client_info=client_info, ) def create_autoscaling_policy( @@ -678,11 +685,11 @@ def delete_autoscaling_policy( try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-cloud-dataproc",).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() __all__ = ("AutoscalingPolicyServiceClient",) diff --git a/google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/base.py b/google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/base.py index 0c609a8b..4ffb038a 100644 --- a/google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/base.py +++ b/google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/base.py @@ -19,7 +19,7 @@ import typing import pkg_resources -from google import auth +from google import auth # type: ignore from google.api_core import exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore @@ -30,11 +30,11 @@ try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-cloud-dataproc",).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() class AutoscalingPolicyServiceTransport(abc.ABC): @@ -50,6 +50,7 @@ def __init__( credentials_file: typing.Optional[str] = None, scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, **kwargs, ) -> None: """Instantiate the transport. @@ -67,6 +68,11 @@ def __init__( scope (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -94,15 +100,15 @@ def __init__( self._credentials = credentials # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages() + self._prep_wrapped_messages(client_info) - def _prep_wrapped_messages(self): + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.create_autoscaling_policy: gapic_v1.method.wrap_method( self.create_autoscaling_policy, default_timeout=600.0, - client_info=_client_info, + client_info=client_info, ), self.update_autoscaling_policy: gapic_v1.method.wrap_method( self.update_autoscaling_policy, @@ -115,7 +121,7 @@ def _prep_wrapped_messages(self): ), ), default_timeout=600.0, - client_info=_client_info, + client_info=client_info, ), self.get_autoscaling_policy: gapic_v1.method.wrap_method( self.get_autoscaling_policy, @@ -128,7 +134,7 @@ def _prep_wrapped_messages(self): ), ), default_timeout=600.0, - client_info=_client_info, + client_info=client_info, ), self.list_autoscaling_policies: gapic_v1.method.wrap_method( self.list_autoscaling_policies, @@ -141,12 +147,12 @@ def _prep_wrapped_messages(self): ), ), default_timeout=600.0, - client_info=_client_info, + client_info=client_info, ), self.delete_autoscaling_policy: gapic_v1.method.wrap_method( self.delete_autoscaling_policy, default_timeout=600.0, - client_info=_client_info, + client_info=client_info, ), } diff --git a/google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/grpc.py b/google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/grpc.py index d4fbfe1b..a6b6b6f1 100644 --- a/google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/grpc.py +++ b/google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/grpc.py @@ -18,6 +18,7 @@ from typing import Callable, Dict, Optional, Sequence, Tuple from google.api_core import grpc_helpers # type: ignore +from google.api_core import gapic_v1 # type: ignore from google import auth # type: ignore from google.auth import credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore @@ -28,7 +29,7 @@ from google.cloud.dataproc_v1.types import autoscaling_policies from google.protobuf import empty_pb2 as empty # type: ignore -from .base import AutoscalingPolicyServiceTransport +from .base import AutoscalingPolicyServiceTransport, DEFAULT_CLIENT_INFO class AutoscalingPolicyServiceGrpcTransport(AutoscalingPolicyServiceTransport): @@ -57,7 +58,8 @@ def __init__( channel: grpc.Channel = None, api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id: Optional[str] = None + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the transport. @@ -86,6 +88,11 @@ def __init__( is None. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport @@ -141,6 +148,7 @@ def __init__( credentials_file=credentials_file, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, + client_info=client_info, ) @classmethod @@ -151,7 +159,7 @@ def create_channel( credentials_file: str = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, - **kwargs + **kwargs, ) -> grpc.Channel: """Create and return a gRPC channel object. Args: @@ -185,7 +193,7 @@ def create_channel( credentials_file=credentials_file, scopes=scopes, quota_project_id=quota_project_id, - **kwargs + **kwargs, ) @property diff --git a/google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/grpc_asyncio.py b/google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/grpc_asyncio.py index 1eb47af4..e1c38d14 100644 --- a/google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/grpc_asyncio.py +++ b/google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/grpc_asyncio.py @@ -17,6 +17,7 @@ from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple +from google.api_core import gapic_v1 # type: ignore from google.api_core import grpc_helpers_async # type: ignore from google.auth import credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore @@ -27,7 +28,7 @@ from google.cloud.dataproc_v1.types import autoscaling_policies from google.protobuf import empty_pb2 as empty # type: ignore -from .base import AutoscalingPolicyServiceTransport +from .base import AutoscalingPolicyServiceTransport, DEFAULT_CLIENT_INFO from .grpc import AutoscalingPolicyServiceGrpcTransport @@ -100,6 +101,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the transport. @@ -129,6 +131,11 @@ def __init__( is None. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport @@ -177,6 +184,7 @@ def __init__( credentials_file=credentials_file, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, + client_info=client_info, ) self._stubs = {} diff --git a/google/cloud/dataproc_v1/services/cluster_controller/async_client.py b/google/cloud/dataproc_v1/services/cluster_controller/async_client.py index 1ea1637c..91be2f70 100644 --- a/google/cloud/dataproc_v1/services/cluster_controller/async_client.py +++ b/google/cloud/dataproc_v1/services/cluster_controller/async_client.py @@ -36,7 +36,7 @@ from google.protobuf import empty_pb2 as empty # type: ignore from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from .transports.base import ClusterControllerTransport +from .transports.base import ClusterControllerTransport, DEFAULT_CLIENT_INFO from .transports.grpc_asyncio import ClusterControllerGrpcAsyncIOTransport from .client import ClusterControllerClient @@ -64,6 +64,7 @@ def __init__( credentials: credentials.Credentials = None, transport: Union[str, ClusterControllerTransport] = "grpc_asyncio", client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the cluster controller client. @@ -96,7 +97,10 @@ def __init__( """ self._client = ClusterControllerClient( - credentials=credentials, transport=transport, client_options=client_options, + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, ) async def create_cluster( @@ -185,7 +189,7 @@ async def create_cluster( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=300.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -366,7 +370,7 @@ async def update_cluster( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=300.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -480,7 +484,7 @@ async def delete_cluster( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=300.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -577,13 +581,13 @@ async def get_cluster( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.InternalServerError, - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.InternalServerError, ), ), default_timeout=300.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -696,13 +700,13 @@ async def list_clusters( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.InternalServerError, - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.InternalServerError, ), ), default_timeout=300.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -807,7 +811,7 @@ async def diagnose_cluster( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=300.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -826,11 +830,11 @@ async def diagnose_cluster( try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-cloud-dataproc",).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() __all__ = ("ClusterControllerAsyncClient",) diff --git a/google/cloud/dataproc_v1/services/cluster_controller/client.py b/google/cloud/dataproc_v1/services/cluster_controller/client.py index 7f895f39..2fa3511a 100644 --- a/google/cloud/dataproc_v1/services/cluster_controller/client.py +++ b/google/cloud/dataproc_v1/services/cluster_controller/client.py @@ -38,7 +38,7 @@ from google.protobuf import empty_pb2 as empty # type: ignore from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from .transports.base import ClusterControllerTransport +from .transports.base import ClusterControllerTransport, DEFAULT_CLIENT_INFO from .transports.grpc import ClusterControllerGrpcTransport from .transports.grpc_asyncio import ClusterControllerGrpcAsyncIOTransport @@ -143,6 +143,7 @@ def __init__( credentials: credentials.Credentials = None, transport: Union[str, ClusterControllerTransport] = None, client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the cluster controller client. @@ -168,6 +169,11 @@ def __init__( (2) The ``client_cert_source`` property is used to provide client SSL credentials for mutual TLS transport. If not provided, the default SSL credentials will be used if present. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport @@ -225,6 +231,7 @@ def __init__( api_mtls_endpoint=client_options.api_endpoint, client_cert_source=client_options.client_cert_source, quota_project_id=client_options.quota_project_id, + client_info=client_info, ) def create_cluster( @@ -922,11 +929,11 @@ def diagnose_cluster( try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-cloud-dataproc",).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() __all__ = ("ClusterControllerClient",) diff --git a/google/cloud/dataproc_v1/services/cluster_controller/transports/base.py b/google/cloud/dataproc_v1/services/cluster_controller/transports/base.py index 993de639..f5871311 100644 --- a/google/cloud/dataproc_v1/services/cluster_controller/transports/base.py +++ b/google/cloud/dataproc_v1/services/cluster_controller/transports/base.py @@ -19,7 +19,7 @@ import typing import pkg_resources -from google import auth +from google import auth # type: ignore from google.api_core import exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore @@ -31,11 +31,11 @@ try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-cloud-dataproc",).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() class ClusterControllerTransport(abc.ABC): @@ -51,6 +51,7 @@ def __init__( credentials_file: typing.Optional[str] = None, scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, **kwargs, ) -> None: """Instantiate the transport. @@ -68,6 +69,11 @@ def __init__( scope (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -95,9 +101,9 @@ def __init__( self._credentials = credentials # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages() + self._prep_wrapped_messages(client_info) - def _prep_wrapped_messages(self): + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.create_cluster: gapic_v1.method.wrap_method( @@ -109,7 +115,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=300.0, - client_info=_client_info, + client_info=client_info, ), self.update_cluster: gapic_v1.method.wrap_method( self.update_cluster, @@ -120,7 +126,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=300.0, - client_info=_client_info, + client_info=client_info, ), self.delete_cluster: gapic_v1.method.wrap_method( self.delete_cluster, @@ -131,7 +137,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=300.0, - client_info=_client_info, + client_info=client_info, ), self.get_cluster: gapic_v1.method.wrap_method( self.get_cluster, @@ -140,13 +146,13 @@ def _prep_wrapped_messages(self): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.InternalServerError, - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.InternalServerError, ), ), default_timeout=300.0, - client_info=_client_info, + client_info=client_info, ), self.list_clusters: gapic_v1.method.wrap_method( self.list_clusters, @@ -155,13 +161,13 @@ def _prep_wrapped_messages(self): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.InternalServerError, - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.InternalServerError, ), ), default_timeout=300.0, - client_info=_client_info, + client_info=client_info, ), self.diagnose_cluster: gapic_v1.method.wrap_method( self.diagnose_cluster, @@ -172,7 +178,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=300.0, - client_info=_client_info, + client_info=client_info, ), } diff --git a/google/cloud/dataproc_v1/services/cluster_controller/transports/grpc.py b/google/cloud/dataproc_v1/services/cluster_controller/transports/grpc.py index 46f0b416..0699c219 100644 --- a/google/cloud/dataproc_v1/services/cluster_controller/transports/grpc.py +++ b/google/cloud/dataproc_v1/services/cluster_controller/transports/grpc.py @@ -19,6 +19,7 @@ from google.api_core import grpc_helpers # type: ignore from google.api_core import operations_v1 # type: ignore +from google.api_core import gapic_v1 # type: ignore from google import auth # type: ignore from google.auth import credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore @@ -29,7 +30,7 @@ from google.cloud.dataproc_v1.types import clusters from google.longrunning import operations_pb2 as operations # type: ignore -from .base import ClusterControllerTransport +from .base import ClusterControllerTransport, DEFAULT_CLIENT_INFO class ClusterControllerGrpcTransport(ClusterControllerTransport): @@ -58,7 +59,8 @@ def __init__( channel: grpc.Channel = None, api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id: Optional[str] = None + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the transport. @@ -87,6 +89,11 @@ def __init__( is None. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport @@ -142,6 +149,7 @@ def __init__( credentials_file=credentials_file, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, + client_info=client_info, ) @classmethod @@ -152,7 +160,7 @@ def create_channel( credentials_file: str = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, - **kwargs + **kwargs, ) -> grpc.Channel: """Create and return a gRPC channel object. Args: @@ -186,7 +194,7 @@ def create_channel( credentials_file=credentials_file, scopes=scopes, quota_project_id=quota_project_id, - **kwargs + **kwargs, ) @property diff --git a/google/cloud/dataproc_v1/services/cluster_controller/transports/grpc_asyncio.py b/google/cloud/dataproc_v1/services/cluster_controller/transports/grpc_asyncio.py index e8e49b6e..648b2322 100644 --- a/google/cloud/dataproc_v1/services/cluster_controller/transports/grpc_asyncio.py +++ b/google/cloud/dataproc_v1/services/cluster_controller/transports/grpc_asyncio.py @@ -17,6 +17,7 @@ from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple +from google.api_core import gapic_v1 # type: ignore from google.api_core import grpc_helpers_async # type: ignore from google.api_core import operations_v1 # type: ignore from google.auth import credentials # type: ignore @@ -28,7 +29,7 @@ from google.cloud.dataproc_v1.types import clusters from google.longrunning import operations_pb2 as operations # type: ignore -from .base import ClusterControllerTransport +from .base import ClusterControllerTransport, DEFAULT_CLIENT_INFO from .grpc import ClusterControllerGrpcTransport @@ -101,6 +102,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the transport. @@ -130,6 +132,11 @@ def __init__( is None. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport @@ -178,6 +185,7 @@ def __init__( credentials_file=credentials_file, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, + client_info=client_info, ) self._stubs = {} diff --git a/google/cloud/dataproc_v1/services/job_controller/async_client.py b/google/cloud/dataproc_v1/services/job_controller/async_client.py index ed4b2e02..203f4296 100644 --- a/google/cloud/dataproc_v1/services/job_controller/async_client.py +++ b/google/cloud/dataproc_v1/services/job_controller/async_client.py @@ -33,7 +33,7 @@ from google.cloud.dataproc_v1.services.job_controller import pagers from google.cloud.dataproc_v1.types import jobs -from .transports.base import JobControllerTransport +from .transports.base import JobControllerTransport, DEFAULT_CLIENT_INFO from .transports.grpc_asyncio import JobControllerGrpcAsyncIOTransport from .client import JobControllerClient @@ -59,6 +59,7 @@ def __init__( credentials: credentials.Credentials = None, transport: Union[str, JobControllerTransport] = "grpc_asyncio", client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the job controller client. @@ -91,7 +92,10 @@ def __init__( """ self._client = JobControllerClient( - credentials=credentials, transport=transport, client_options=client_options, + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, ) async def submit_job( @@ -171,7 +175,7 @@ async def submit_job( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=900.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -261,7 +265,7 @@ async def submit_job_as_operation( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=900.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -355,13 +359,13 @@ async def get_job( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.InternalServerError, - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.InternalServerError, ), ), default_timeout=900.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -465,13 +469,13 @@ async def list_jobs( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.InternalServerError, - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.InternalServerError, ), ), default_timeout=900.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -525,7 +529,7 @@ async def update_job( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=900.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -613,13 +617,13 @@ async def cancel_job( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.InternalServerError, - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.InternalServerError, ), ), default_timeout=900.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -702,7 +706,7 @@ async def delete_job( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=900.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -712,11 +716,11 @@ async def delete_job( try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-cloud-dataproc",).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() __all__ = ("JobControllerAsyncClient",) diff --git a/google/cloud/dataproc_v1/services/job_controller/client.py b/google/cloud/dataproc_v1/services/job_controller/client.py index 157d913e..59b89e2f 100644 --- a/google/cloud/dataproc_v1/services/job_controller/client.py +++ b/google/cloud/dataproc_v1/services/job_controller/client.py @@ -35,7 +35,7 @@ from google.cloud.dataproc_v1.services.job_controller import pagers from google.cloud.dataproc_v1.types import jobs -from .transports.base import JobControllerTransport +from .transports.base import JobControllerTransport, DEFAULT_CLIENT_INFO from .transports.grpc import JobControllerGrpcTransport from .transports.grpc_asyncio import JobControllerGrpcAsyncIOTransport @@ -134,6 +134,7 @@ def __init__( credentials: credentials.Credentials = None, transport: Union[str, JobControllerTransport] = None, client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the job controller client. @@ -159,6 +160,11 @@ def __init__( (2) The ``client_cert_source`` property is used to provide client SSL credentials for mutual TLS transport. If not provided, the default SSL credentials will be used if present. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport @@ -216,6 +222,7 @@ def __init__( api_mtls_endpoint=client_options.api_endpoint, client_cert_source=client_options.client_cert_source, quota_project_id=client_options.quota_project_id, + client_info=client_info, ) def submit_job( @@ -795,11 +802,11 @@ def delete_job( try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-cloud-dataproc",).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() __all__ = ("JobControllerClient",) diff --git a/google/cloud/dataproc_v1/services/job_controller/transports/base.py b/google/cloud/dataproc_v1/services/job_controller/transports/base.py index d4200ffd..58784b71 100644 --- a/google/cloud/dataproc_v1/services/job_controller/transports/base.py +++ b/google/cloud/dataproc_v1/services/job_controller/transports/base.py @@ -19,7 +19,7 @@ import typing import pkg_resources -from google import auth +from google import auth # type: ignore from google.api_core import exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore @@ -32,11 +32,11 @@ try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-cloud-dataproc",).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() class JobControllerTransport(abc.ABC): @@ -52,6 +52,7 @@ def __init__( credentials_file: typing.Optional[str] = None, scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, **kwargs, ) -> None: """Instantiate the transport. @@ -69,6 +70,11 @@ def __init__( scope (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -96,9 +102,9 @@ def __init__( self._credentials = credentials # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages() + self._prep_wrapped_messages(client_info) - def _prep_wrapped_messages(self): + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.submit_job: gapic_v1.method.wrap_method( @@ -110,7 +116,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=900.0, - client_info=_client_info, + client_info=client_info, ), self.submit_job_as_operation: gapic_v1.method.wrap_method( self.submit_job_as_operation, @@ -121,7 +127,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=900.0, - client_info=_client_info, + client_info=client_info, ), self.get_job: gapic_v1.method.wrap_method( self.get_job, @@ -130,13 +136,13 @@ def _prep_wrapped_messages(self): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.InternalServerError, - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.InternalServerError, ), ), default_timeout=900.0, - client_info=_client_info, + client_info=client_info, ), self.list_jobs: gapic_v1.method.wrap_method( self.list_jobs, @@ -145,13 +151,13 @@ def _prep_wrapped_messages(self): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.InternalServerError, - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.InternalServerError, ), ), default_timeout=900.0, - client_info=_client_info, + client_info=client_info, ), self.update_job: gapic_v1.method.wrap_method( self.update_job, @@ -162,7 +168,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=900.0, - client_info=_client_info, + client_info=client_info, ), self.cancel_job: gapic_v1.method.wrap_method( self.cancel_job, @@ -171,13 +177,13 @@ def _prep_wrapped_messages(self): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.InternalServerError, - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.InternalServerError, ), ), default_timeout=900.0, - client_info=_client_info, + client_info=client_info, ), self.delete_job: gapic_v1.method.wrap_method( self.delete_job, @@ -188,7 +194,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=900.0, - client_info=_client_info, + client_info=client_info, ), } diff --git a/google/cloud/dataproc_v1/services/job_controller/transports/grpc.py b/google/cloud/dataproc_v1/services/job_controller/transports/grpc.py index 6174c16b..11ec38d8 100644 --- a/google/cloud/dataproc_v1/services/job_controller/transports/grpc.py +++ b/google/cloud/dataproc_v1/services/job_controller/transports/grpc.py @@ -19,6 +19,7 @@ from google.api_core import grpc_helpers # type: ignore from google.api_core import operations_v1 # type: ignore +from google.api_core import gapic_v1 # type: ignore from google import auth # type: ignore from google.auth import credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore @@ -30,7 +31,7 @@ from google.longrunning import operations_pb2 as operations # type: ignore from google.protobuf import empty_pb2 as empty # type: ignore -from .base import JobControllerTransport +from .base import JobControllerTransport, DEFAULT_CLIENT_INFO class JobControllerGrpcTransport(JobControllerTransport): @@ -58,7 +59,8 @@ def __init__( channel: grpc.Channel = None, api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id: Optional[str] = None + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the transport. @@ -87,6 +89,11 @@ def __init__( is None. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport @@ -142,6 +149,7 @@ def __init__( credentials_file=credentials_file, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, + client_info=client_info, ) @classmethod @@ -152,7 +160,7 @@ def create_channel( credentials_file: str = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, - **kwargs + **kwargs, ) -> grpc.Channel: """Create and return a gRPC channel object. Args: @@ -186,7 +194,7 @@ def create_channel( credentials_file=credentials_file, scopes=scopes, quota_project_id=quota_project_id, - **kwargs + **kwargs, ) @property diff --git a/google/cloud/dataproc_v1/services/job_controller/transports/grpc_asyncio.py b/google/cloud/dataproc_v1/services/job_controller/transports/grpc_asyncio.py index 999141bf..383fe30b 100644 --- a/google/cloud/dataproc_v1/services/job_controller/transports/grpc_asyncio.py +++ b/google/cloud/dataproc_v1/services/job_controller/transports/grpc_asyncio.py @@ -17,6 +17,7 @@ from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple +from google.api_core import gapic_v1 # type: ignore from google.api_core import grpc_helpers_async # type: ignore from google.api_core import operations_v1 # type: ignore from google.auth import credentials # type: ignore @@ -29,7 +30,7 @@ from google.longrunning import operations_pb2 as operations # type: ignore from google.protobuf import empty_pb2 as empty # type: ignore -from .base import JobControllerTransport +from .base import JobControllerTransport, DEFAULT_CLIENT_INFO from .grpc import JobControllerGrpcTransport @@ -101,6 +102,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the transport. @@ -130,6 +132,11 @@ def __init__( is None. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport @@ -178,6 +185,7 @@ def __init__( credentials_file=credentials_file, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, + client_info=client_info, ) self._stubs = {} diff --git a/google/cloud/dataproc_v1/services/workflow_template_service/async_client.py b/google/cloud/dataproc_v1/services/workflow_template_service/async_client.py index dc5c0f22..1e39ec3a 100644 --- a/google/cloud/dataproc_v1/services/workflow_template_service/async_client.py +++ b/google/cloud/dataproc_v1/services/workflow_template_service/async_client.py @@ -35,7 +35,7 @@ from google.protobuf import empty_pb2 as empty # type: ignore from google.protobuf import timestamp_pb2 as timestamp # type: ignore -from .transports.base import WorkflowTemplateServiceTransport +from .transports.base import WorkflowTemplateServiceTransport, DEFAULT_CLIENT_INFO from .transports.grpc_asyncio import WorkflowTemplateServiceGrpcAsyncIOTransport from .client import WorkflowTemplateServiceClient @@ -68,6 +68,7 @@ def __init__( credentials: credentials.Credentials = None, transport: Union[str, WorkflowTemplateServiceTransport] = "grpc_asyncio", client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the workflow template service client. @@ -100,7 +101,10 @@ def __init__( """ self._client = WorkflowTemplateServiceClient( - credentials=credentials, transport=transport, client_options=client_options, + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, ) async def create_workflow_template( @@ -184,7 +188,7 @@ async def create_workflow_template( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=600.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -272,13 +276,13 @@ async def get_workflow_template( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.InternalServerError, - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.InternalServerError, ), ), default_timeout=600.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -416,7 +420,7 @@ async def instantiate_workflow_template( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=600.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -562,7 +566,7 @@ async def instantiate_inline_workflow_template( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=600.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -651,7 +655,7 @@ async def update_workflow_template( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=600.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -742,13 +746,13 @@ async def list_workflow_templates( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.InternalServerError, - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.InternalServerError, ), ), default_timeout=600.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -839,7 +843,7 @@ async def delete_workflow_template( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=600.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -855,11 +859,11 @@ async def delete_workflow_template( try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-cloud-dataproc",).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() __all__ = ("WorkflowTemplateServiceAsyncClient",) diff --git a/google/cloud/dataproc_v1/services/workflow_template_service/client.py b/google/cloud/dataproc_v1/services/workflow_template_service/client.py index 9b380a9a..c44d4c50 100644 --- a/google/cloud/dataproc_v1/services/workflow_template_service/client.py +++ b/google/cloud/dataproc_v1/services/workflow_template_service/client.py @@ -37,7 +37,7 @@ from google.protobuf import empty_pb2 as empty # type: ignore from google.protobuf import timestamp_pb2 as timestamp # type: ignore -from .transports.base import WorkflowTemplateServiceTransport +from .transports.base import WorkflowTemplateServiceTransport, DEFAULT_CLIENT_INFO from .transports.grpc import WorkflowTemplateServiceGrpcTransport from .transports.grpc_asyncio import WorkflowTemplateServiceGrpcAsyncIOTransport @@ -160,6 +160,7 @@ def __init__( credentials: credentials.Credentials = None, transport: Union[str, WorkflowTemplateServiceTransport] = None, client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the workflow template service client. @@ -185,6 +186,11 @@ def __init__( (2) The ``client_cert_source`` property is used to provide client SSL credentials for mutual TLS transport. If not provided, the default SSL credentials will be used if present. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport @@ -242,6 +248,7 @@ def __init__( api_mtls_endpoint=client_options.api_endpoint, client_cert_source=client_options.client_cert_source, quota_project_id=client_options.quota_project_id, + client_info=client_info, ) def create_workflow_template( @@ -970,11 +977,11 @@ def delete_workflow_template( try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-cloud-dataproc",).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() __all__ = ("WorkflowTemplateServiceClient",) diff --git a/google/cloud/dataproc_v1/services/workflow_template_service/transports/base.py b/google/cloud/dataproc_v1/services/workflow_template_service/transports/base.py index a1bc72b0..2c8d20ac 100644 --- a/google/cloud/dataproc_v1/services/workflow_template_service/transports/base.py +++ b/google/cloud/dataproc_v1/services/workflow_template_service/transports/base.py @@ -19,7 +19,7 @@ import typing import pkg_resources -from google import auth +from google import auth # type: ignore from google.api_core import exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore @@ -32,11 +32,11 @@ try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-cloud-dataproc",).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() class WorkflowTemplateServiceTransport(abc.ABC): @@ -52,6 +52,7 @@ def __init__( credentials_file: typing.Optional[str] = None, scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, **kwargs, ) -> None: """Instantiate the transport. @@ -69,6 +70,11 @@ def __init__( scope (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -96,9 +102,9 @@ def __init__( self._credentials = credentials # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages() + self._prep_wrapped_messages(client_info) - def _prep_wrapped_messages(self): + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.create_workflow_template: gapic_v1.method.wrap_method( @@ -110,7 +116,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=600.0, - client_info=_client_info, + client_info=client_info, ), self.get_workflow_template: gapic_v1.method.wrap_method( self.get_workflow_template, @@ -119,13 +125,13 @@ def _prep_wrapped_messages(self): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.InternalServerError, - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.InternalServerError, ), ), default_timeout=600.0, - client_info=_client_info, + client_info=client_info, ), self.instantiate_workflow_template: gapic_v1.method.wrap_method( self.instantiate_workflow_template, @@ -136,7 +142,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=600.0, - client_info=_client_info, + client_info=client_info, ), self.instantiate_inline_workflow_template: gapic_v1.method.wrap_method( self.instantiate_inline_workflow_template, @@ -147,7 +153,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=600.0, - client_info=_client_info, + client_info=client_info, ), self.update_workflow_template: gapic_v1.method.wrap_method( self.update_workflow_template, @@ -158,7 +164,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=600.0, - client_info=_client_info, + client_info=client_info, ), self.list_workflow_templates: gapic_v1.method.wrap_method( self.list_workflow_templates, @@ -167,13 +173,13 @@ def _prep_wrapped_messages(self): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.InternalServerError, - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.InternalServerError, ), ), default_timeout=600.0, - client_info=_client_info, + client_info=client_info, ), self.delete_workflow_template: gapic_v1.method.wrap_method( self.delete_workflow_template, @@ -184,7 +190,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=600.0, - client_info=_client_info, + client_info=client_info, ), } diff --git a/google/cloud/dataproc_v1/services/workflow_template_service/transports/grpc.py b/google/cloud/dataproc_v1/services/workflow_template_service/transports/grpc.py index 5a9e8b61..33d8504b 100644 --- a/google/cloud/dataproc_v1/services/workflow_template_service/transports/grpc.py +++ b/google/cloud/dataproc_v1/services/workflow_template_service/transports/grpc.py @@ -19,6 +19,7 @@ from google.api_core import grpc_helpers # type: ignore from google.api_core import operations_v1 # type: ignore +from google.api_core import gapic_v1 # type: ignore from google import auth # type: ignore from google.auth import credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore @@ -30,7 +31,7 @@ from google.longrunning import operations_pb2 as operations # type: ignore from google.protobuf import empty_pb2 as empty # type: ignore -from .base import WorkflowTemplateServiceTransport +from .base import WorkflowTemplateServiceTransport, DEFAULT_CLIENT_INFO class WorkflowTemplateServiceGrpcTransport(WorkflowTemplateServiceTransport): @@ -59,7 +60,8 @@ def __init__( channel: grpc.Channel = None, api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id: Optional[str] = None + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the transport. @@ -88,6 +90,11 @@ def __init__( is None. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport @@ -143,6 +150,7 @@ def __init__( credentials_file=credentials_file, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, + client_info=client_info, ) @classmethod @@ -153,7 +161,7 @@ def create_channel( credentials_file: str = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, - **kwargs + **kwargs, ) -> grpc.Channel: """Create and return a gRPC channel object. Args: @@ -187,7 +195,7 @@ def create_channel( credentials_file=credentials_file, scopes=scopes, quota_project_id=quota_project_id, - **kwargs + **kwargs, ) @property diff --git a/google/cloud/dataproc_v1/services/workflow_template_service/transports/grpc_asyncio.py b/google/cloud/dataproc_v1/services/workflow_template_service/transports/grpc_asyncio.py index 9e3f6355..d001d6f3 100644 --- a/google/cloud/dataproc_v1/services/workflow_template_service/transports/grpc_asyncio.py +++ b/google/cloud/dataproc_v1/services/workflow_template_service/transports/grpc_asyncio.py @@ -17,6 +17,7 @@ from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple +from google.api_core import gapic_v1 # type: ignore from google.api_core import grpc_helpers_async # type: ignore from google.api_core import operations_v1 # type: ignore from google.auth import credentials # type: ignore @@ -29,7 +30,7 @@ from google.longrunning import operations_pb2 as operations # type: ignore from google.protobuf import empty_pb2 as empty # type: ignore -from .base import WorkflowTemplateServiceTransport +from .base import WorkflowTemplateServiceTransport, DEFAULT_CLIENT_INFO from .grpc import WorkflowTemplateServiceGrpcTransport @@ -102,6 +103,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the transport. @@ -131,6 +133,11 @@ def __init__( is None. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport @@ -179,6 +186,7 @@ def __init__( credentials_file=credentials_file, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, + client_info=client_info, ) self._stubs = {} diff --git a/google/cloud/dataproc_v1beta2/__init__.py b/google/cloud/dataproc_v1beta2/__init__.py index 1a0d3c1a..f7a24164 100644 --- a/google/cloud/dataproc_v1beta2/__init__.py +++ b/google/cloud/dataproc_v1beta2/__init__.py @@ -149,7 +149,6 @@ "InstantiateInlineWorkflowTemplateRequest", "InstantiateWorkflowTemplateRequest", "Job", - "JobControllerClient", "JobMetadata", "JobPlacement", "JobReference", @@ -194,6 +193,7 @@ "WorkflowNode", "WorkflowTemplate", "WorkflowTemplatePlacement", - "YarnApplication", "WorkflowTemplateServiceClient", + "YarnApplication", + "JobControllerClient", ) diff --git a/google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/async_client.py b/google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/async_client.py index 36274045..d3817c17 100644 --- a/google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/async_client.py +++ b/google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/async_client.py @@ -31,7 +31,7 @@ from google.cloud.dataproc_v1beta2.services.autoscaling_policy_service import pagers from google.cloud.dataproc_v1beta2.types import autoscaling_policies -from .transports.base import AutoscalingPolicyServiceTransport +from .transports.base import AutoscalingPolicyServiceTransport, DEFAULT_CLIENT_INFO from .transports.grpc_asyncio import AutoscalingPolicyServiceGrpcAsyncIOTransport from .client import AutoscalingPolicyServiceClient @@ -64,6 +64,7 @@ def __init__( credentials: credentials.Credentials = None, transport: Union[str, AutoscalingPolicyServiceTransport] = "grpc_asyncio", client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the autoscaling policy service client. @@ -96,7 +97,10 @@ def __init__( """ self._client = AutoscalingPolicyServiceClient( - credentials=credentials, transport=transport, client_options=client_options, + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, ) async def create_autoscaling_policy( @@ -174,7 +178,7 @@ async def create_autoscaling_policy( rpc = gapic_v1.method_async.wrap_method( self._client._transport.create_autoscaling_policy, default_timeout=600.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -256,7 +260,7 @@ async def update_autoscaling_policy( ), ), default_timeout=600.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -347,7 +351,7 @@ async def get_autoscaling_policy( ), ), default_timeout=600.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -439,7 +443,7 @@ async def list_autoscaling_policies( ), ), default_timeout=600.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -526,7 +530,7 @@ async def delete_autoscaling_policy( rpc = gapic_v1.method_async.wrap_method( self._client._transport.delete_autoscaling_policy, default_timeout=600.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -542,11 +546,11 @@ async def delete_autoscaling_policy( try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-cloud-dataproc",).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() __all__ = ("AutoscalingPolicyServiceAsyncClient",) diff --git a/google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/client.py b/google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/client.py index 5bbc3b2d..00484693 100644 --- a/google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/client.py +++ b/google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/client.py @@ -33,7 +33,7 @@ from google.cloud.dataproc_v1beta2.services.autoscaling_policy_service import pagers from google.cloud.dataproc_v1beta2.types import autoscaling_policies -from .transports.base import AutoscalingPolicyServiceTransport +from .transports.base import AutoscalingPolicyServiceTransport, DEFAULT_CLIENT_INFO from .transports.grpc import AutoscalingPolicyServiceGrpcTransport from .transports.grpc_asyncio import AutoscalingPolicyServiceGrpcAsyncIOTransport @@ -156,6 +156,7 @@ def __init__( credentials: credentials.Credentials = None, transport: Union[str, AutoscalingPolicyServiceTransport] = None, client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the autoscaling policy service client. @@ -181,6 +182,11 @@ def __init__( (2) The ``client_cert_source`` property is used to provide client SSL credentials for mutual TLS transport. If not provided, the default SSL credentials will be used if present. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport @@ -238,6 +244,7 @@ def __init__( api_mtls_endpoint=client_options.api_endpoint, client_cert_source=client_options.client_cert_source, quota_project_id=client_options.quota_project_id, + client_info=client_info, ) def create_autoscaling_policy( @@ -677,11 +684,11 @@ def delete_autoscaling_policy( try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-cloud-dataproc",).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() __all__ = ("AutoscalingPolicyServiceClient",) diff --git a/google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/transports/base.py b/google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/transports/base.py index f4da8ccb..4bb914c0 100644 --- a/google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/transports/base.py +++ b/google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/transports/base.py @@ -19,7 +19,7 @@ import typing import pkg_resources -from google import auth +from google import auth # type: ignore from google.api_core import exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore @@ -30,11 +30,11 @@ try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-cloud-dataproc",).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() class AutoscalingPolicyServiceTransport(abc.ABC): @@ -50,6 +50,7 @@ def __init__( credentials_file: typing.Optional[str] = None, scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, **kwargs, ) -> None: """Instantiate the transport. @@ -67,6 +68,11 @@ def __init__( scope (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -94,15 +100,15 @@ def __init__( self._credentials = credentials # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages() + self._prep_wrapped_messages(client_info) - def _prep_wrapped_messages(self): + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.create_autoscaling_policy: gapic_v1.method.wrap_method( self.create_autoscaling_policy, default_timeout=600.0, - client_info=_client_info, + client_info=client_info, ), self.update_autoscaling_policy: gapic_v1.method.wrap_method( self.update_autoscaling_policy, @@ -115,7 +121,7 @@ def _prep_wrapped_messages(self): ), ), default_timeout=600.0, - client_info=_client_info, + client_info=client_info, ), self.get_autoscaling_policy: gapic_v1.method.wrap_method( self.get_autoscaling_policy, @@ -128,7 +134,7 @@ def _prep_wrapped_messages(self): ), ), default_timeout=600.0, - client_info=_client_info, + client_info=client_info, ), self.list_autoscaling_policies: gapic_v1.method.wrap_method( self.list_autoscaling_policies, @@ -141,12 +147,12 @@ def _prep_wrapped_messages(self): ), ), default_timeout=600.0, - client_info=_client_info, + client_info=client_info, ), self.delete_autoscaling_policy: gapic_v1.method.wrap_method( self.delete_autoscaling_policy, default_timeout=600.0, - client_info=_client_info, + client_info=client_info, ), } diff --git a/google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/transports/grpc.py b/google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/transports/grpc.py index f1b5b894..a854e675 100644 --- a/google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/transports/grpc.py +++ b/google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/transports/grpc.py @@ -18,6 +18,7 @@ from typing import Callable, Dict, Optional, Sequence, Tuple from google.api_core import grpc_helpers # type: ignore +from google.api_core import gapic_v1 # type: ignore from google import auth # type: ignore from google.auth import credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore @@ -28,7 +29,7 @@ from google.cloud.dataproc_v1beta2.types import autoscaling_policies from google.protobuf import empty_pb2 as empty # type: ignore -from .base import AutoscalingPolicyServiceTransport +from .base import AutoscalingPolicyServiceTransport, DEFAULT_CLIENT_INFO class AutoscalingPolicyServiceGrpcTransport(AutoscalingPolicyServiceTransport): @@ -57,7 +58,8 @@ def __init__( channel: grpc.Channel = None, api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id: Optional[str] = None + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the transport. @@ -86,6 +88,11 @@ def __init__( is None. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport @@ -141,6 +148,7 @@ def __init__( credentials_file=credentials_file, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, + client_info=client_info, ) @classmethod @@ -151,7 +159,7 @@ def create_channel( credentials_file: str = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, - **kwargs + **kwargs, ) -> grpc.Channel: """Create and return a gRPC channel object. Args: @@ -185,7 +193,7 @@ def create_channel( credentials_file=credentials_file, scopes=scopes, quota_project_id=quota_project_id, - **kwargs + **kwargs, ) @property diff --git a/google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/transports/grpc_asyncio.py b/google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/transports/grpc_asyncio.py index fa17bb26..c9af538c 100644 --- a/google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/transports/grpc_asyncio.py +++ b/google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/transports/grpc_asyncio.py @@ -17,6 +17,7 @@ from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple +from google.api_core import gapic_v1 # type: ignore from google.api_core import grpc_helpers_async # type: ignore from google.auth import credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore @@ -27,7 +28,7 @@ from google.cloud.dataproc_v1beta2.types import autoscaling_policies from google.protobuf import empty_pb2 as empty # type: ignore -from .base import AutoscalingPolicyServiceTransport +from .base import AutoscalingPolicyServiceTransport, DEFAULT_CLIENT_INFO from .grpc import AutoscalingPolicyServiceGrpcTransport @@ -100,6 +101,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the transport. @@ -129,6 +131,11 @@ def __init__( is None. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport @@ -177,6 +184,7 @@ def __init__( credentials_file=credentials_file, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, + client_info=client_info, ) self._stubs = {} diff --git a/google/cloud/dataproc_v1beta2/services/cluster_controller/async_client.py b/google/cloud/dataproc_v1beta2/services/cluster_controller/async_client.py index 9a5af0d9..1a758d22 100644 --- a/google/cloud/dataproc_v1beta2/services/cluster_controller/async_client.py +++ b/google/cloud/dataproc_v1beta2/services/cluster_controller/async_client.py @@ -36,7 +36,7 @@ from google.protobuf import empty_pb2 as empty # type: ignore from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from .transports.base import ClusterControllerTransport +from .transports.base import ClusterControllerTransport, DEFAULT_CLIENT_INFO from .transports.grpc_asyncio import ClusterControllerGrpcAsyncIOTransport from .client import ClusterControllerClient @@ -64,6 +64,7 @@ def __init__( credentials: credentials.Credentials = None, transport: Union[str, ClusterControllerTransport] = "grpc_asyncio", client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the cluster controller client. @@ -96,7 +97,10 @@ def __init__( """ self._client = ClusterControllerClient( - credentials=credentials, transport=transport, client_options=client_options, + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, ) async def create_cluster( @@ -185,7 +189,7 @@ async def create_cluster( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=300.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -374,7 +378,7 @@ async def update_cluster( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=300.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -488,7 +492,7 @@ async def delete_cluster( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=300.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -591,7 +595,7 @@ async def get_cluster( ), ), default_timeout=300.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -710,7 +714,7 @@ async def list_clusters( ), ), default_timeout=300.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -826,7 +830,7 @@ async def diagnose_cluster( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=300.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -845,11 +849,11 @@ async def diagnose_cluster( try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-cloud-dataproc",).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() __all__ = ("ClusterControllerAsyncClient",) diff --git a/google/cloud/dataproc_v1beta2/services/cluster_controller/client.py b/google/cloud/dataproc_v1beta2/services/cluster_controller/client.py index 341e9622..b4c42dbd 100644 --- a/google/cloud/dataproc_v1beta2/services/cluster_controller/client.py +++ b/google/cloud/dataproc_v1beta2/services/cluster_controller/client.py @@ -38,7 +38,7 @@ from google.protobuf import empty_pb2 as empty # type: ignore from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from .transports.base import ClusterControllerTransport +from .transports.base import ClusterControllerTransport, DEFAULT_CLIENT_INFO from .transports.grpc import ClusterControllerGrpcTransport from .transports.grpc_asyncio import ClusterControllerGrpcAsyncIOTransport @@ -143,6 +143,7 @@ def __init__( credentials: credentials.Credentials = None, transport: Union[str, ClusterControllerTransport] = None, client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the cluster controller client. @@ -168,6 +169,11 @@ def __init__( (2) The ``client_cert_source`` property is used to provide client SSL credentials for mutual TLS transport. If not provided, the default SSL credentials will be used if present. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport @@ -225,6 +231,7 @@ def __init__( api_mtls_endpoint=client_options.api_endpoint, client_cert_source=client_options.client_cert_source, quota_project_id=client_options.quota_project_id, + client_info=client_info, ) def create_cluster( @@ -941,11 +948,11 @@ def diagnose_cluster( try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-cloud-dataproc",).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() __all__ = ("ClusterControllerClient",) diff --git a/google/cloud/dataproc_v1beta2/services/cluster_controller/transports/base.py b/google/cloud/dataproc_v1beta2/services/cluster_controller/transports/base.py index 864494b6..48420669 100644 --- a/google/cloud/dataproc_v1beta2/services/cluster_controller/transports/base.py +++ b/google/cloud/dataproc_v1beta2/services/cluster_controller/transports/base.py @@ -19,7 +19,7 @@ import typing import pkg_resources -from google import auth +from google import auth # type: ignore from google.api_core import exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore @@ -31,11 +31,11 @@ try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-cloud-dataproc",).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() class ClusterControllerTransport(abc.ABC): @@ -51,6 +51,7 @@ def __init__( credentials_file: typing.Optional[str] = None, scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, **kwargs, ) -> None: """Instantiate the transport. @@ -68,6 +69,11 @@ def __init__( scope (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -95,9 +101,9 @@ def __init__( self._credentials = credentials # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages() + self._prep_wrapped_messages(client_info) - def _prep_wrapped_messages(self): + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.create_cluster: gapic_v1.method.wrap_method( @@ -109,7 +115,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=300.0, - client_info=_client_info, + client_info=client_info, ), self.update_cluster: gapic_v1.method.wrap_method( self.update_cluster, @@ -120,7 +126,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=300.0, - client_info=_client_info, + client_info=client_info, ), self.delete_cluster: gapic_v1.method.wrap_method( self.delete_cluster, @@ -131,7 +137,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=300.0, - client_info=_client_info, + client_info=client_info, ), self.get_cluster: gapic_v1.method.wrap_method( self.get_cluster, @@ -146,7 +152,7 @@ def _prep_wrapped_messages(self): ), ), default_timeout=300.0, - client_info=_client_info, + client_info=client_info, ), self.list_clusters: gapic_v1.method.wrap_method( self.list_clusters, @@ -161,7 +167,7 @@ def _prep_wrapped_messages(self): ), ), default_timeout=300.0, - client_info=_client_info, + client_info=client_info, ), self.diagnose_cluster: gapic_v1.method.wrap_method( self.diagnose_cluster, @@ -172,7 +178,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=300.0, - client_info=_client_info, + client_info=client_info, ), } diff --git a/google/cloud/dataproc_v1beta2/services/cluster_controller/transports/grpc.py b/google/cloud/dataproc_v1beta2/services/cluster_controller/transports/grpc.py index abb5622f..5734afd0 100644 --- a/google/cloud/dataproc_v1beta2/services/cluster_controller/transports/grpc.py +++ b/google/cloud/dataproc_v1beta2/services/cluster_controller/transports/grpc.py @@ -19,6 +19,7 @@ from google.api_core import grpc_helpers # type: ignore from google.api_core import operations_v1 # type: ignore +from google.api_core import gapic_v1 # type: ignore from google import auth # type: ignore from google.auth import credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore @@ -29,7 +30,7 @@ from google.cloud.dataproc_v1beta2.types import clusters from google.longrunning import operations_pb2 as operations # type: ignore -from .base import ClusterControllerTransport +from .base import ClusterControllerTransport, DEFAULT_CLIENT_INFO class ClusterControllerGrpcTransport(ClusterControllerTransport): @@ -58,7 +59,8 @@ def __init__( channel: grpc.Channel = None, api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id: Optional[str] = None + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the transport. @@ -87,6 +89,11 @@ def __init__( is None. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport @@ -142,6 +149,7 @@ def __init__( credentials_file=credentials_file, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, + client_info=client_info, ) @classmethod @@ -152,7 +160,7 @@ def create_channel( credentials_file: str = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, - **kwargs + **kwargs, ) -> grpc.Channel: """Create and return a gRPC channel object. Args: @@ -186,7 +194,7 @@ def create_channel( credentials_file=credentials_file, scopes=scopes, quota_project_id=quota_project_id, - **kwargs + **kwargs, ) @property diff --git a/google/cloud/dataproc_v1beta2/services/cluster_controller/transports/grpc_asyncio.py b/google/cloud/dataproc_v1beta2/services/cluster_controller/transports/grpc_asyncio.py index 4d778267..f1537897 100644 --- a/google/cloud/dataproc_v1beta2/services/cluster_controller/transports/grpc_asyncio.py +++ b/google/cloud/dataproc_v1beta2/services/cluster_controller/transports/grpc_asyncio.py @@ -17,6 +17,7 @@ from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple +from google.api_core import gapic_v1 # type: ignore from google.api_core import grpc_helpers_async # type: ignore from google.api_core import operations_v1 # type: ignore from google.auth import credentials # type: ignore @@ -28,7 +29,7 @@ from google.cloud.dataproc_v1beta2.types import clusters from google.longrunning import operations_pb2 as operations # type: ignore -from .base import ClusterControllerTransport +from .base import ClusterControllerTransport, DEFAULT_CLIENT_INFO from .grpc import ClusterControllerGrpcTransport @@ -101,6 +102,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the transport. @@ -130,6 +132,11 @@ def __init__( is None. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport @@ -178,6 +185,7 @@ def __init__( credentials_file=credentials_file, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, + client_info=client_info, ) self._stubs = {} diff --git a/google/cloud/dataproc_v1beta2/services/job_controller/async_client.py b/google/cloud/dataproc_v1beta2/services/job_controller/async_client.py index b83e2612..b7e1960d 100644 --- a/google/cloud/dataproc_v1beta2/services/job_controller/async_client.py +++ b/google/cloud/dataproc_v1beta2/services/job_controller/async_client.py @@ -33,7 +33,7 @@ from google.cloud.dataproc_v1beta2.services.job_controller import pagers from google.cloud.dataproc_v1beta2.types import jobs -from .transports.base import JobControllerTransport +from .transports.base import JobControllerTransport, DEFAULT_CLIENT_INFO from .transports.grpc_asyncio import JobControllerGrpcAsyncIOTransport from .client import JobControllerClient @@ -59,6 +59,7 @@ def __init__( credentials: credentials.Credentials = None, transport: Union[str, JobControllerTransport] = "grpc_asyncio", client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the job controller client. @@ -91,7 +92,10 @@ def __init__( """ self._client = JobControllerClient( - credentials=credentials, transport=transport, client_options=client_options, + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, ) async def submit_job( @@ -171,7 +175,7 @@ async def submit_job( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=900.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -261,7 +265,7 @@ async def submit_job_as_operation( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=900.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -361,7 +365,7 @@ async def get_job( ), ), default_timeout=900.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -471,7 +475,7 @@ async def list_jobs( ), ), default_timeout=900.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -525,7 +529,7 @@ async def update_job( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=900.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -619,7 +623,7 @@ async def cancel_job( ), ), default_timeout=900.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -702,7 +706,7 @@ async def delete_job( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=900.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -712,11 +716,11 @@ async def delete_job( try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-cloud-dataproc",).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() __all__ = ("JobControllerAsyncClient",) diff --git a/google/cloud/dataproc_v1beta2/services/job_controller/client.py b/google/cloud/dataproc_v1beta2/services/job_controller/client.py index e34798cd..33cd071b 100644 --- a/google/cloud/dataproc_v1beta2/services/job_controller/client.py +++ b/google/cloud/dataproc_v1beta2/services/job_controller/client.py @@ -35,7 +35,7 @@ from google.cloud.dataproc_v1beta2.services.job_controller import pagers from google.cloud.dataproc_v1beta2.types import jobs -from .transports.base import JobControllerTransport +from .transports.base import JobControllerTransport, DEFAULT_CLIENT_INFO from .transports.grpc import JobControllerGrpcTransport from .transports.grpc_asyncio import JobControllerGrpcAsyncIOTransport @@ -134,6 +134,7 @@ def __init__( credentials: credentials.Credentials = None, transport: Union[str, JobControllerTransport] = None, client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the job controller client. @@ -159,6 +160,11 @@ def __init__( (2) The ``client_cert_source`` property is used to provide client SSL credentials for mutual TLS transport. If not provided, the default SSL credentials will be used if present. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport @@ -216,6 +222,7 @@ def __init__( api_mtls_endpoint=client_options.api_endpoint, client_cert_source=client_options.client_cert_source, quota_project_id=client_options.quota_project_id, + client_info=client_info, ) def submit_job( @@ -795,11 +802,11 @@ def delete_job( try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-cloud-dataproc",).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() __all__ = ("JobControllerClient",) diff --git a/google/cloud/dataproc_v1beta2/services/job_controller/transports/base.py b/google/cloud/dataproc_v1beta2/services/job_controller/transports/base.py index 99a86d34..41834e1b 100644 --- a/google/cloud/dataproc_v1beta2/services/job_controller/transports/base.py +++ b/google/cloud/dataproc_v1beta2/services/job_controller/transports/base.py @@ -19,7 +19,7 @@ import typing import pkg_resources -from google import auth +from google import auth # type: ignore from google.api_core import exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore @@ -32,11 +32,11 @@ try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-cloud-dataproc",).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() class JobControllerTransport(abc.ABC): @@ -52,6 +52,7 @@ def __init__( credentials_file: typing.Optional[str] = None, scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, **kwargs, ) -> None: """Instantiate the transport. @@ -69,6 +70,11 @@ def __init__( scope (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -96,9 +102,9 @@ def __init__( self._credentials = credentials # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages() + self._prep_wrapped_messages(client_info) - def _prep_wrapped_messages(self): + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.submit_job: gapic_v1.method.wrap_method( @@ -110,7 +116,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=900.0, - client_info=_client_info, + client_info=client_info, ), self.submit_job_as_operation: gapic_v1.method.wrap_method( self.submit_job_as_operation, @@ -121,7 +127,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=900.0, - client_info=_client_info, + client_info=client_info, ), self.get_job: gapic_v1.method.wrap_method( self.get_job, @@ -136,7 +142,7 @@ def _prep_wrapped_messages(self): ), ), default_timeout=900.0, - client_info=_client_info, + client_info=client_info, ), self.list_jobs: gapic_v1.method.wrap_method( self.list_jobs, @@ -151,7 +157,7 @@ def _prep_wrapped_messages(self): ), ), default_timeout=900.0, - client_info=_client_info, + client_info=client_info, ), self.update_job: gapic_v1.method.wrap_method( self.update_job, @@ -162,7 +168,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=900.0, - client_info=_client_info, + client_info=client_info, ), self.cancel_job: gapic_v1.method.wrap_method( self.cancel_job, @@ -177,7 +183,7 @@ def _prep_wrapped_messages(self): ), ), default_timeout=900.0, - client_info=_client_info, + client_info=client_info, ), self.delete_job: gapic_v1.method.wrap_method( self.delete_job, @@ -188,7 +194,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=900.0, - client_info=_client_info, + client_info=client_info, ), } diff --git a/google/cloud/dataproc_v1beta2/services/job_controller/transports/grpc.py b/google/cloud/dataproc_v1beta2/services/job_controller/transports/grpc.py index 19aa92cc..69de7cef 100644 --- a/google/cloud/dataproc_v1beta2/services/job_controller/transports/grpc.py +++ b/google/cloud/dataproc_v1beta2/services/job_controller/transports/grpc.py @@ -19,6 +19,7 @@ from google.api_core import grpc_helpers # type: ignore from google.api_core import operations_v1 # type: ignore +from google.api_core import gapic_v1 # type: ignore from google import auth # type: ignore from google.auth import credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore @@ -30,7 +31,7 @@ from google.longrunning import operations_pb2 as operations # type: ignore from google.protobuf import empty_pb2 as empty # type: ignore -from .base import JobControllerTransport +from .base import JobControllerTransport, DEFAULT_CLIENT_INFO class JobControllerGrpcTransport(JobControllerTransport): @@ -58,7 +59,8 @@ def __init__( channel: grpc.Channel = None, api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id: Optional[str] = None + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the transport. @@ -87,6 +89,11 @@ def __init__( is None. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport @@ -142,6 +149,7 @@ def __init__( credentials_file=credentials_file, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, + client_info=client_info, ) @classmethod @@ -152,7 +160,7 @@ def create_channel( credentials_file: str = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, - **kwargs + **kwargs, ) -> grpc.Channel: """Create and return a gRPC channel object. Args: @@ -186,7 +194,7 @@ def create_channel( credentials_file=credentials_file, scopes=scopes, quota_project_id=quota_project_id, - **kwargs + **kwargs, ) @property diff --git a/google/cloud/dataproc_v1beta2/services/job_controller/transports/grpc_asyncio.py b/google/cloud/dataproc_v1beta2/services/job_controller/transports/grpc_asyncio.py index fcc056ab..2c51fbf6 100644 --- a/google/cloud/dataproc_v1beta2/services/job_controller/transports/grpc_asyncio.py +++ b/google/cloud/dataproc_v1beta2/services/job_controller/transports/grpc_asyncio.py @@ -17,6 +17,7 @@ from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple +from google.api_core import gapic_v1 # type: ignore from google.api_core import grpc_helpers_async # type: ignore from google.api_core import operations_v1 # type: ignore from google.auth import credentials # type: ignore @@ -29,7 +30,7 @@ from google.longrunning import operations_pb2 as operations # type: ignore from google.protobuf import empty_pb2 as empty # type: ignore -from .base import JobControllerTransport +from .base import JobControllerTransport, DEFAULT_CLIENT_INFO from .grpc import JobControllerGrpcTransport @@ -101,6 +102,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the transport. @@ -130,6 +132,11 @@ def __init__( is None. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport @@ -178,6 +185,7 @@ def __init__( credentials_file=credentials_file, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, + client_info=client_info, ) self._stubs = {} diff --git a/google/cloud/dataproc_v1beta2/services/workflow_template_service/async_client.py b/google/cloud/dataproc_v1beta2/services/workflow_template_service/async_client.py index 94e84da0..4941e17c 100644 --- a/google/cloud/dataproc_v1beta2/services/workflow_template_service/async_client.py +++ b/google/cloud/dataproc_v1beta2/services/workflow_template_service/async_client.py @@ -35,7 +35,7 @@ from google.protobuf import empty_pb2 as empty # type: ignore from google.protobuf import timestamp_pb2 as timestamp # type: ignore -from .transports.base import WorkflowTemplateServiceTransport +from .transports.base import WorkflowTemplateServiceTransport, DEFAULT_CLIENT_INFO from .transports.grpc_asyncio import WorkflowTemplateServiceGrpcAsyncIOTransport from .client import WorkflowTemplateServiceClient @@ -68,6 +68,7 @@ def __init__( credentials: credentials.Credentials = None, transport: Union[str, WorkflowTemplateServiceTransport] = "grpc_asyncio", client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the workflow template service client. @@ -100,7 +101,10 @@ def __init__( """ self._client = WorkflowTemplateServiceClient( - credentials=credentials, transport=transport, client_options=client_options, + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, ) async def create_workflow_template( @@ -184,7 +188,7 @@ async def create_workflow_template( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=600.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -278,7 +282,7 @@ async def get_workflow_template( ), ), default_timeout=600.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -416,7 +420,7 @@ async def instantiate_workflow_template( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=600.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -562,7 +566,7 @@ async def instantiate_inline_workflow_template( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=600.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -651,7 +655,7 @@ async def update_workflow_template( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=600.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -748,7 +752,7 @@ async def list_workflow_templates( ), ), default_timeout=600.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -839,7 +843,7 @@ async def delete_workflow_template( predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=600.0, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -855,11 +859,11 @@ async def delete_workflow_template( try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-cloud-dataproc",).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() __all__ = ("WorkflowTemplateServiceAsyncClient",) diff --git a/google/cloud/dataproc_v1beta2/services/workflow_template_service/client.py b/google/cloud/dataproc_v1beta2/services/workflow_template_service/client.py index 5c529342..01a9c8b8 100644 --- a/google/cloud/dataproc_v1beta2/services/workflow_template_service/client.py +++ b/google/cloud/dataproc_v1beta2/services/workflow_template_service/client.py @@ -37,7 +37,7 @@ from google.protobuf import empty_pb2 as empty # type: ignore from google.protobuf import timestamp_pb2 as timestamp # type: ignore -from .transports.base import WorkflowTemplateServiceTransport +from .transports.base import WorkflowTemplateServiceTransport, DEFAULT_CLIENT_INFO from .transports.grpc import WorkflowTemplateServiceGrpcTransport from .transports.grpc_asyncio import WorkflowTemplateServiceGrpcAsyncIOTransport @@ -160,6 +160,7 @@ def __init__( credentials: credentials.Credentials = None, transport: Union[str, WorkflowTemplateServiceTransport] = None, client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the workflow template service client. @@ -185,6 +186,11 @@ def __init__( (2) The ``client_cert_source`` property is used to provide client SSL credentials for mutual TLS transport. If not provided, the default SSL credentials will be used if present. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport @@ -242,6 +248,7 @@ def __init__( api_mtls_endpoint=client_options.api_endpoint, client_cert_source=client_options.client_cert_source, quota_project_id=client_options.quota_project_id, + client_info=client_info, ) def create_workflow_template( @@ -970,11 +977,11 @@ def delete_workflow_template( try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-cloud-dataproc",).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() __all__ = ("WorkflowTemplateServiceClient",) diff --git a/google/cloud/dataproc_v1beta2/services/workflow_template_service/transports/base.py b/google/cloud/dataproc_v1beta2/services/workflow_template_service/transports/base.py index 3dc6c0ad..6df63c6c 100644 --- a/google/cloud/dataproc_v1beta2/services/workflow_template_service/transports/base.py +++ b/google/cloud/dataproc_v1beta2/services/workflow_template_service/transports/base.py @@ -19,7 +19,7 @@ import typing import pkg_resources -from google import auth +from google import auth # type: ignore from google.api_core import exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore @@ -32,11 +32,11 @@ try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-cloud-dataproc",).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() class WorkflowTemplateServiceTransport(abc.ABC): @@ -52,6 +52,7 @@ def __init__( credentials_file: typing.Optional[str] = None, scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, **kwargs, ) -> None: """Instantiate the transport. @@ -69,6 +70,11 @@ def __init__( scope (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -96,9 +102,9 @@ def __init__( self._credentials = credentials # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages() + self._prep_wrapped_messages(client_info) - def _prep_wrapped_messages(self): + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.create_workflow_template: gapic_v1.method.wrap_method( @@ -110,7 +116,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=600.0, - client_info=_client_info, + client_info=client_info, ), self.get_workflow_template: gapic_v1.method.wrap_method( self.get_workflow_template, @@ -125,7 +131,7 @@ def _prep_wrapped_messages(self): ), ), default_timeout=600.0, - client_info=_client_info, + client_info=client_info, ), self.instantiate_workflow_template: gapic_v1.method.wrap_method( self.instantiate_workflow_template, @@ -136,7 +142,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=600.0, - client_info=_client_info, + client_info=client_info, ), self.instantiate_inline_workflow_template: gapic_v1.method.wrap_method( self.instantiate_inline_workflow_template, @@ -147,7 +153,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=600.0, - client_info=_client_info, + client_info=client_info, ), self.update_workflow_template: gapic_v1.method.wrap_method( self.update_workflow_template, @@ -158,7 +164,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=600.0, - client_info=_client_info, + client_info=client_info, ), self.list_workflow_templates: gapic_v1.method.wrap_method( self.list_workflow_templates, @@ -173,7 +179,7 @@ def _prep_wrapped_messages(self): ), ), default_timeout=600.0, - client_info=_client_info, + client_info=client_info, ), self.delete_workflow_template: gapic_v1.method.wrap_method( self.delete_workflow_template, @@ -184,7 +190,7 @@ def _prep_wrapped_messages(self): predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=600.0, - client_info=_client_info, + client_info=client_info, ), } diff --git a/google/cloud/dataproc_v1beta2/services/workflow_template_service/transports/grpc.py b/google/cloud/dataproc_v1beta2/services/workflow_template_service/transports/grpc.py index 6ab10372..56a777a7 100644 --- a/google/cloud/dataproc_v1beta2/services/workflow_template_service/transports/grpc.py +++ b/google/cloud/dataproc_v1beta2/services/workflow_template_service/transports/grpc.py @@ -19,6 +19,7 @@ from google.api_core import grpc_helpers # type: ignore from google.api_core import operations_v1 # type: ignore +from google.api_core import gapic_v1 # type: ignore from google import auth # type: ignore from google.auth import credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore @@ -30,7 +31,7 @@ from google.longrunning import operations_pb2 as operations # type: ignore from google.protobuf import empty_pb2 as empty # type: ignore -from .base import WorkflowTemplateServiceTransport +from .base import WorkflowTemplateServiceTransport, DEFAULT_CLIENT_INFO class WorkflowTemplateServiceGrpcTransport(WorkflowTemplateServiceTransport): @@ -59,7 +60,8 @@ def __init__( channel: grpc.Channel = None, api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id: Optional[str] = None + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the transport. @@ -88,6 +90,11 @@ def __init__( is None. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport @@ -143,6 +150,7 @@ def __init__( credentials_file=credentials_file, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, + client_info=client_info, ) @classmethod @@ -153,7 +161,7 @@ def create_channel( credentials_file: str = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, - **kwargs + **kwargs, ) -> grpc.Channel: """Create and return a gRPC channel object. Args: @@ -187,7 +195,7 @@ def create_channel( credentials_file=credentials_file, scopes=scopes, quota_project_id=quota_project_id, - **kwargs + **kwargs, ) @property diff --git a/google/cloud/dataproc_v1beta2/services/workflow_template_service/transports/grpc_asyncio.py b/google/cloud/dataproc_v1beta2/services/workflow_template_service/transports/grpc_asyncio.py index d085b7b1..ad62ddd2 100644 --- a/google/cloud/dataproc_v1beta2/services/workflow_template_service/transports/grpc_asyncio.py +++ b/google/cloud/dataproc_v1beta2/services/workflow_template_service/transports/grpc_asyncio.py @@ -17,6 +17,7 @@ from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple +from google.api_core import gapic_v1 # type: ignore from google.api_core import grpc_helpers_async # type: ignore from google.api_core import operations_v1 # type: ignore from google.auth import credentials # type: ignore @@ -29,7 +30,7 @@ from google.longrunning import operations_pb2 as operations # type: ignore from google.protobuf import empty_pb2 as empty # type: ignore -from .base import WorkflowTemplateServiceTransport +from .base import WorkflowTemplateServiceTransport, DEFAULT_CLIENT_INFO from .grpc import WorkflowTemplateServiceGrpcTransport @@ -102,6 +103,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the transport. @@ -131,6 +133,11 @@ def __init__( is None. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport @@ -179,6 +186,7 @@ def __init__( credentials_file=credentials_file, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, + client_info=client_info, ) self._stubs = {} diff --git a/synth.metadata b/synth.metadata index d3160be7..12236719 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,7 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-dataproc.git", - "sha": "31af47932ebc6d0b5df0ba1a0f7a208ab55578ae" + "sha": "66c7af157ca5f740ebfec95abb7267e361d855f6" + } + }, + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "ddaa2026caf2eb00444a14b08500553824a7182a", + "internalRef": "329845759" } }, { @@ -41,5 +49,186 @@ "generator": "bazel" } } + ], + "generatedFiles": [ + ".flake8", + ".github/CONTRIBUTING.md", + ".github/ISSUE_TEMPLATE/bug_report.md", + ".github/ISSUE_TEMPLATE/feature_request.md", + ".github/ISSUE_TEMPLATE/support_request.md", + ".github/PULL_REQUEST_TEMPLATE.md", + ".github/release-please.yml", + ".gitignore", + ".kokoro/build.sh", + ".kokoro/continuous/common.cfg", + ".kokoro/continuous/continuous.cfg", + ".kokoro/docker/docs/Dockerfile", + ".kokoro/docker/docs/fetch_gpg_keys.sh", + ".kokoro/docs/common.cfg", + ".kokoro/docs/docs-presubmit.cfg", + ".kokoro/docs/docs.cfg", + ".kokoro/presubmit/common.cfg", + ".kokoro/presubmit/presubmit.cfg", + ".kokoro/publish-docs.sh", + ".kokoro/release.sh", + ".kokoro/release/common.cfg", + ".kokoro/release/release.cfg", + ".kokoro/samples/lint/common.cfg", + ".kokoro/samples/lint/continuous.cfg", + ".kokoro/samples/lint/periodic.cfg", + ".kokoro/samples/lint/presubmit.cfg", + ".kokoro/samples/python3.6/common.cfg", + ".kokoro/samples/python3.6/continuous.cfg", + ".kokoro/samples/python3.6/periodic.cfg", + ".kokoro/samples/python3.6/presubmit.cfg", + ".kokoro/samples/python3.7/common.cfg", + ".kokoro/samples/python3.7/continuous.cfg", + ".kokoro/samples/python3.7/periodic.cfg", + ".kokoro/samples/python3.7/presubmit.cfg", + ".kokoro/samples/python3.8/common.cfg", + ".kokoro/samples/python3.8/continuous.cfg", + ".kokoro/samples/python3.8/periodic.cfg", + ".kokoro/samples/python3.8/presubmit.cfg", + ".kokoro/test-samples.sh", + ".kokoro/trampoline.sh", + ".kokoro/trampoline_v2.sh", + ".trampolinerc", + "CODE_OF_CONDUCT.md", + "CONTRIBUTING.rst", + "LICENSE", + "MANIFEST.in", + "docs/_static/custom.css", + "docs/_templates/layout.html", + "docs/conf.py", + "docs/dataproc_v1/services.rst", + "docs/dataproc_v1/types.rst", + "docs/dataproc_v1beta2/services.rst", + "docs/dataproc_v1beta2/types.rst", + "docs/multiprocessing.rst", + "google/cloud/dataproc/__init__.py", + "google/cloud/dataproc/py.typed", + "google/cloud/dataproc_v1/__init__.py", + "google/cloud/dataproc_v1/proto/autoscaling_policies.proto", + "google/cloud/dataproc_v1/proto/clusters.proto", + "google/cloud/dataproc_v1/proto/jobs.proto", + "google/cloud/dataproc_v1/proto/operations.proto", + "google/cloud/dataproc_v1/proto/shared.proto", + "google/cloud/dataproc_v1/proto/workflow_templates.proto", + "google/cloud/dataproc_v1/py.typed", + "google/cloud/dataproc_v1/services/__init__.py", + "google/cloud/dataproc_v1/services/autoscaling_policy_service/__init__.py", + "google/cloud/dataproc_v1/services/autoscaling_policy_service/async_client.py", + "google/cloud/dataproc_v1/services/autoscaling_policy_service/client.py", + "google/cloud/dataproc_v1/services/autoscaling_policy_service/pagers.py", + "google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/__init__.py", + "google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/base.py", + "google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/grpc.py", + "google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/grpc_asyncio.py", + "google/cloud/dataproc_v1/services/cluster_controller/__init__.py", + "google/cloud/dataproc_v1/services/cluster_controller/async_client.py", + "google/cloud/dataproc_v1/services/cluster_controller/client.py", + "google/cloud/dataproc_v1/services/cluster_controller/pagers.py", + "google/cloud/dataproc_v1/services/cluster_controller/transports/__init__.py", + "google/cloud/dataproc_v1/services/cluster_controller/transports/base.py", + "google/cloud/dataproc_v1/services/cluster_controller/transports/grpc.py", + "google/cloud/dataproc_v1/services/cluster_controller/transports/grpc_asyncio.py", + "google/cloud/dataproc_v1/services/job_controller/__init__.py", + "google/cloud/dataproc_v1/services/job_controller/async_client.py", + "google/cloud/dataproc_v1/services/job_controller/client.py", + "google/cloud/dataproc_v1/services/job_controller/pagers.py", + "google/cloud/dataproc_v1/services/job_controller/transports/__init__.py", + "google/cloud/dataproc_v1/services/job_controller/transports/base.py", + "google/cloud/dataproc_v1/services/job_controller/transports/grpc.py", + "google/cloud/dataproc_v1/services/job_controller/transports/grpc_asyncio.py", + "google/cloud/dataproc_v1/services/workflow_template_service/__init__.py", + "google/cloud/dataproc_v1/services/workflow_template_service/async_client.py", + "google/cloud/dataproc_v1/services/workflow_template_service/client.py", + "google/cloud/dataproc_v1/services/workflow_template_service/pagers.py", + "google/cloud/dataproc_v1/services/workflow_template_service/transports/__init__.py", + "google/cloud/dataproc_v1/services/workflow_template_service/transports/base.py", + "google/cloud/dataproc_v1/services/workflow_template_service/transports/grpc.py", + "google/cloud/dataproc_v1/services/workflow_template_service/transports/grpc_asyncio.py", + "google/cloud/dataproc_v1/types/__init__.py", + "google/cloud/dataproc_v1/types/autoscaling_policies.py", + "google/cloud/dataproc_v1/types/clusters.py", + "google/cloud/dataproc_v1/types/jobs.py", + "google/cloud/dataproc_v1/types/operations.py", + "google/cloud/dataproc_v1/types/shared.py", + "google/cloud/dataproc_v1/types/workflow_templates.py", + "google/cloud/dataproc_v1beta2/__init__.py", + "google/cloud/dataproc_v1beta2/proto/autoscaling_policies.proto", + "google/cloud/dataproc_v1beta2/proto/clusters.proto", + "google/cloud/dataproc_v1beta2/proto/jobs.proto", + "google/cloud/dataproc_v1beta2/proto/operations.proto", + "google/cloud/dataproc_v1beta2/proto/shared.proto", + "google/cloud/dataproc_v1beta2/proto/workflow_templates.proto", + "google/cloud/dataproc_v1beta2/py.typed", + "google/cloud/dataproc_v1beta2/services/__init__.py", + "google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/__init__.py", + "google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/async_client.py", + "google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/client.py", + "google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/pagers.py", + "google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/transports/__init__.py", + "google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/transports/base.py", + "google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/transports/grpc.py", + "google/cloud/dataproc_v1beta2/services/autoscaling_policy_service/transports/grpc_asyncio.py", + "google/cloud/dataproc_v1beta2/services/cluster_controller/__init__.py", + "google/cloud/dataproc_v1beta2/services/cluster_controller/async_client.py", + "google/cloud/dataproc_v1beta2/services/cluster_controller/client.py", + "google/cloud/dataproc_v1beta2/services/cluster_controller/pagers.py", + "google/cloud/dataproc_v1beta2/services/cluster_controller/transports/__init__.py", + "google/cloud/dataproc_v1beta2/services/cluster_controller/transports/base.py", + "google/cloud/dataproc_v1beta2/services/cluster_controller/transports/grpc.py", + "google/cloud/dataproc_v1beta2/services/cluster_controller/transports/grpc_asyncio.py", + "google/cloud/dataproc_v1beta2/services/job_controller/__init__.py", + "google/cloud/dataproc_v1beta2/services/job_controller/async_client.py", + "google/cloud/dataproc_v1beta2/services/job_controller/client.py", + "google/cloud/dataproc_v1beta2/services/job_controller/pagers.py", + "google/cloud/dataproc_v1beta2/services/job_controller/transports/__init__.py", + "google/cloud/dataproc_v1beta2/services/job_controller/transports/base.py", + "google/cloud/dataproc_v1beta2/services/job_controller/transports/grpc.py", + "google/cloud/dataproc_v1beta2/services/job_controller/transports/grpc_asyncio.py", + "google/cloud/dataproc_v1beta2/services/workflow_template_service/__init__.py", + "google/cloud/dataproc_v1beta2/services/workflow_template_service/async_client.py", + "google/cloud/dataproc_v1beta2/services/workflow_template_service/client.py", + "google/cloud/dataproc_v1beta2/services/workflow_template_service/pagers.py", + "google/cloud/dataproc_v1beta2/services/workflow_template_service/transports/__init__.py", + "google/cloud/dataproc_v1beta2/services/workflow_template_service/transports/base.py", + "google/cloud/dataproc_v1beta2/services/workflow_template_service/transports/grpc.py", + "google/cloud/dataproc_v1beta2/services/workflow_template_service/transports/grpc_asyncio.py", + "google/cloud/dataproc_v1beta2/types/__init__.py", + "google/cloud/dataproc_v1beta2/types/autoscaling_policies.py", + "google/cloud/dataproc_v1beta2/types/clusters.py", + "google/cloud/dataproc_v1beta2/types/jobs.py", + "google/cloud/dataproc_v1beta2/types/operations.py", + "google/cloud/dataproc_v1beta2/types/shared.py", + "google/cloud/dataproc_v1beta2/types/workflow_templates.py", + "mypy.ini", + "noxfile.py", + "renovate.json", + "samples/AUTHORING_GUIDE.md", + "samples/CONTRIBUTING.md", + "samples/snippets/noxfile.py", + "scripts/decrypt-secrets.sh", + "scripts/fixup_dataproc_v1_keywords.py", + "scripts/fixup_dataproc_v1beta2_keywords.py", + "scripts/readme-gen/readme_gen.py", + "scripts/readme-gen/templates/README.tmpl.rst", + "scripts/readme-gen/templates/auth.tmpl.rst", + "scripts/readme-gen/templates/auth_api_key.tmpl.rst", + "scripts/readme-gen/templates/install_deps.tmpl.rst", + "scripts/readme-gen/templates/install_portaudio.tmpl.rst", + "setup.cfg", + "testing/.gitignore", + "tests/unit/gapic/dataproc_v1/__init__.py", + "tests/unit/gapic/dataproc_v1/test_autoscaling_policy_service.py", + "tests/unit/gapic/dataproc_v1/test_cluster_controller.py", + "tests/unit/gapic/dataproc_v1/test_job_controller.py", + "tests/unit/gapic/dataproc_v1/test_workflow_template_service.py", + "tests/unit/gapic/dataproc_v1beta2/__init__.py", + "tests/unit/gapic/dataproc_v1beta2/test_autoscaling_policy_service.py", + "tests/unit/gapic/dataproc_v1beta2/test_cluster_controller.py", + "tests/unit/gapic/dataproc_v1beta2/test_job_controller.py", + "tests/unit/gapic/dataproc_v1beta2/test_workflow_template_service.py" ] } \ No newline at end of file diff --git a/tests/unit/gapic/dataproc_v1/test_autoscaling_policy_service.py b/tests/unit/gapic/dataproc_v1/test_autoscaling_policy_service.py index bf660db4..f64d772c 100644 --- a/tests/unit/gapic/dataproc_v1/test_autoscaling_policy_service.py +++ b/tests/unit/gapic/dataproc_v1/test_autoscaling_policy_service.py @@ -173,6 +173,7 @@ def test_autoscaling_policy_service_client_client_options( api_mtls_endpoint="squid.clam.whelk", client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is @@ -189,6 +190,7 @@ def test_autoscaling_policy_service_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is @@ -205,6 +207,7 @@ def test_autoscaling_policy_service_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -224,6 +227,7 @@ def test_autoscaling_policy_service_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=client_cert_source_callback, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -244,6 +248,7 @@ def test_autoscaling_policy_service_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -264,6 +269,7 @@ def test_autoscaling_policy_service_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS has @@ -285,6 +291,7 @@ def test_autoscaling_policy_service_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id="octopus", + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -319,6 +326,7 @@ def test_autoscaling_policy_service_client_client_options_scopes( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -353,6 +361,7 @@ def test_autoscaling_policy_service_client_client_options_credentials_file( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -372,6 +381,7 @@ def test_autoscaling_policy_service_client_client_options_from_dict(): api_mtls_endpoint="squid.clam.whelk", client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -1354,8 +1364,8 @@ def test_list_autoscaling_policies_pages(): RuntimeError, ) pages = list(client.list_autoscaling_policies(request={}).pages) - for page, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page.raw_page.next_page_token == token + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.asyncio @@ -1445,10 +1455,10 @@ async def test_list_autoscaling_policies_async_pages(): RuntimeError, ) pages = [] - async for page in (await client.list_autoscaling_policies(request={})).pages: - pages.append(page) - for page, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page.raw_page.next_page_token == token + async for page_ in (await client.list_autoscaling_policies(request={})).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token def test_delete_autoscaling_policy( @@ -2013,3 +2023,24 @@ def test_parse_autoscaling_policy_path(): # Check that the path construction is reversible. actual = AutoscalingPolicyServiceClient.parse_autoscaling_policy_path(path) assert expected == actual + + +def test_client_withDEFAULT_CLIENT_INFO(): + client_info = gapic_v1.client_info.ClientInfo() + + with mock.patch.object( + transports.AutoscalingPolicyServiceTransport, "_prep_wrapped_messages" + ) as prep: + client = AutoscalingPolicyServiceClient( + credentials=credentials.AnonymousCredentials(), client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + with mock.patch.object( + transports.AutoscalingPolicyServiceTransport, "_prep_wrapped_messages" + ) as prep: + transport_class = AutoscalingPolicyServiceClient.get_transport_class() + transport = transport_class( + credentials=credentials.AnonymousCredentials(), client_info=client_info, + ) + prep.assert_called_once_with(client_info) diff --git a/tests/unit/gapic/dataproc_v1/test_cluster_controller.py b/tests/unit/gapic/dataproc_v1/test_cluster_controller.py index 072ac8ff..e29c0fb0 100644 --- a/tests/unit/gapic/dataproc_v1/test_cluster_controller.py +++ b/tests/unit/gapic/dataproc_v1/test_cluster_controller.py @@ -171,6 +171,7 @@ def test_cluster_controller_client_client_options( api_mtls_endpoint="squid.clam.whelk", client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is @@ -187,6 +188,7 @@ def test_cluster_controller_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is @@ -203,6 +205,7 @@ def test_cluster_controller_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -222,6 +225,7 @@ def test_cluster_controller_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=client_cert_source_callback, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -242,6 +246,7 @@ def test_cluster_controller_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -262,6 +267,7 @@ def test_cluster_controller_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS has @@ -283,6 +289,7 @@ def test_cluster_controller_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id="octopus", + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -313,6 +320,7 @@ def test_cluster_controller_client_client_options_scopes( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -343,6 +351,7 @@ def test_cluster_controller_client_client_options_credentials_file( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -362,6 +371,7 @@ def test_cluster_controller_client_client_options_from_dict(): api_mtls_endpoint="squid.clam.whelk", client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -1241,8 +1251,8 @@ def test_list_clusters_pages(): RuntimeError, ) pages = list(client.list_clusters(request={}).pages) - for page, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page.raw_page.next_page_token == token + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.asyncio @@ -1306,10 +1316,10 @@ async def test_list_clusters_async_pages(): RuntimeError, ) pages = [] - async for page in (await client.list_clusters(request={})).pages: - pages.append(page) - for page, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page.raw_page.next_page_token == token + async for page_ in (await client.list_clusters(request={})).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token def test_diagnose_cluster( @@ -1839,3 +1849,24 @@ def test_cluster_controller_grpc_lro_async_client(): # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client + + +def test_client_withDEFAULT_CLIENT_INFO(): + client_info = gapic_v1.client_info.ClientInfo() + + with mock.patch.object( + transports.ClusterControllerTransport, "_prep_wrapped_messages" + ) as prep: + client = ClusterControllerClient( + credentials=credentials.AnonymousCredentials(), client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + with mock.patch.object( + transports.ClusterControllerTransport, "_prep_wrapped_messages" + ) as prep: + transport_class = ClusterControllerClient.get_transport_class() + transport = transport_class( + credentials=credentials.AnonymousCredentials(), client_info=client_info, + ) + prep.assert_called_once_with(client_info) diff --git a/tests/unit/gapic/dataproc_v1/test_job_controller.py b/tests/unit/gapic/dataproc_v1/test_job_controller.py index 83403e9f..2e894a13 100644 --- a/tests/unit/gapic/dataproc_v1/test_job_controller.py +++ b/tests/unit/gapic/dataproc_v1/test_job_controller.py @@ -165,6 +165,7 @@ def test_job_controller_client_client_options( api_mtls_endpoint="squid.clam.whelk", client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is @@ -181,6 +182,7 @@ def test_job_controller_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is @@ -197,6 +199,7 @@ def test_job_controller_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -216,6 +219,7 @@ def test_job_controller_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=client_cert_source_callback, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -236,6 +240,7 @@ def test_job_controller_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -256,6 +261,7 @@ def test_job_controller_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS has @@ -277,6 +283,7 @@ def test_job_controller_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id="octopus", + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -307,6 +314,7 @@ def test_job_controller_client_client_options_scopes( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -337,6 +345,7 @@ def test_job_controller_client_client_options_credentials_file( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -356,6 +365,7 @@ def test_job_controller_client_client_options_from_dict(): api_mtls_endpoint="squid.clam.whelk", client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -1067,8 +1077,8 @@ def test_list_jobs_pages(): RuntimeError, ) pages = list(client.list_jobs(request={}).pages) - for page, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page.raw_page.next_page_token == token + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.asyncio @@ -1122,10 +1132,10 @@ async def test_list_jobs_async_pages(): RuntimeError, ) pages = [] - async for page in (await client.list_jobs(request={})).pages: - pages.append(page) - for page, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page.raw_page.next_page_token == token + async for page_ in (await client.list_jobs(request={})).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token def test_update_job(transport: str = "grpc", request_type=jobs.UpdateJobRequest): @@ -1899,3 +1909,24 @@ def test_job_controller_grpc_lro_async_client(): # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client + + +def test_client_withDEFAULT_CLIENT_INFO(): + client_info = gapic_v1.client_info.ClientInfo() + + with mock.patch.object( + transports.JobControllerTransport, "_prep_wrapped_messages" + ) as prep: + client = JobControllerClient( + credentials=credentials.AnonymousCredentials(), client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + with mock.patch.object( + transports.JobControllerTransport, "_prep_wrapped_messages" + ) as prep: + transport_class = JobControllerClient.get_transport_class() + transport = transport_class( + credentials=credentials.AnonymousCredentials(), client_info=client_info, + ) + prep.assert_called_once_with(client_info) diff --git a/tests/unit/gapic/dataproc_v1/test_workflow_template_service.py b/tests/unit/gapic/dataproc_v1/test_workflow_template_service.py index c88ec4ab..fce54199 100644 --- a/tests/unit/gapic/dataproc_v1/test_workflow_template_service.py +++ b/tests/unit/gapic/dataproc_v1/test_workflow_template_service.py @@ -178,6 +178,7 @@ def test_workflow_template_service_client_client_options( api_mtls_endpoint="squid.clam.whelk", client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is @@ -194,6 +195,7 @@ def test_workflow_template_service_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is @@ -210,6 +212,7 @@ def test_workflow_template_service_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -229,6 +232,7 @@ def test_workflow_template_service_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=client_cert_source_callback, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -249,6 +253,7 @@ def test_workflow_template_service_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -269,6 +274,7 @@ def test_workflow_template_service_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS has @@ -290,6 +296,7 @@ def test_workflow_template_service_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id="octopus", + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -324,6 +331,7 @@ def test_workflow_template_service_client_client_options_scopes( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -358,6 +366,7 @@ def test_workflow_template_service_client_client_options_credentials_file( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -377,6 +386,7 @@ def test_workflow_template_service_client_client_options_from_dict(): api_mtls_endpoint="squid.clam.whelk", client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -1794,8 +1804,8 @@ def test_list_workflow_templates_pages(): RuntimeError, ) pages = list(client.list_workflow_templates(request={}).pages) - for page, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page.raw_page.next_page_token == token + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.asyncio @@ -1885,10 +1895,10 @@ async def test_list_workflow_templates_async_pages(): RuntimeError, ) pages = [] - async for page in (await client.list_workflow_templates(request={})).pages: - pages.append(page) - for page, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page.raw_page.next_page_token == token + async for page_ in (await client.list_workflow_templates(request={})).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token def test_delete_workflow_template( @@ -2486,3 +2496,24 @@ def test_parse_workflow_template_path(): # Check that the path construction is reversible. actual = WorkflowTemplateServiceClient.parse_workflow_template_path(path) assert expected == actual + + +def test_client_withDEFAULT_CLIENT_INFO(): + client_info = gapic_v1.client_info.ClientInfo() + + with mock.patch.object( + transports.WorkflowTemplateServiceTransport, "_prep_wrapped_messages" + ) as prep: + client = WorkflowTemplateServiceClient( + credentials=credentials.AnonymousCredentials(), client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + with mock.patch.object( + transports.WorkflowTemplateServiceTransport, "_prep_wrapped_messages" + ) as prep: + transport_class = WorkflowTemplateServiceClient.get_transport_class() + transport = transport_class( + credentials=credentials.AnonymousCredentials(), client_info=client_info, + ) + prep.assert_called_once_with(client_info) diff --git a/tests/unit/gapic/dataproc_v1beta2/test_autoscaling_policy_service.py b/tests/unit/gapic/dataproc_v1beta2/test_autoscaling_policy_service.py index cfe27251..63fd639d 100644 --- a/tests/unit/gapic/dataproc_v1beta2/test_autoscaling_policy_service.py +++ b/tests/unit/gapic/dataproc_v1beta2/test_autoscaling_policy_service.py @@ -173,6 +173,7 @@ def test_autoscaling_policy_service_client_client_options( api_mtls_endpoint="squid.clam.whelk", client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is @@ -189,6 +190,7 @@ def test_autoscaling_policy_service_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is @@ -205,6 +207,7 @@ def test_autoscaling_policy_service_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -224,6 +227,7 @@ def test_autoscaling_policy_service_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=client_cert_source_callback, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -244,6 +248,7 @@ def test_autoscaling_policy_service_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -264,6 +269,7 @@ def test_autoscaling_policy_service_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS has @@ -285,6 +291,7 @@ def test_autoscaling_policy_service_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id="octopus", + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -319,6 +326,7 @@ def test_autoscaling_policy_service_client_client_options_scopes( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -353,6 +361,7 @@ def test_autoscaling_policy_service_client_client_options_credentials_file( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -372,6 +381,7 @@ def test_autoscaling_policy_service_client_client_options_from_dict(): api_mtls_endpoint="squid.clam.whelk", client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -1354,8 +1364,8 @@ def test_list_autoscaling_policies_pages(): RuntimeError, ) pages = list(client.list_autoscaling_policies(request={}).pages) - for page, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page.raw_page.next_page_token == token + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.asyncio @@ -1445,10 +1455,10 @@ async def test_list_autoscaling_policies_async_pages(): RuntimeError, ) pages = [] - async for page in (await client.list_autoscaling_policies(request={})).pages: - pages.append(page) - for page, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page.raw_page.next_page_token == token + async for page_ in (await client.list_autoscaling_policies(request={})).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token def test_delete_autoscaling_policy( @@ -2013,3 +2023,24 @@ def test_parse_autoscaling_policy_path(): # Check that the path construction is reversible. actual = AutoscalingPolicyServiceClient.parse_autoscaling_policy_path(path) assert expected == actual + + +def test_client_withDEFAULT_CLIENT_INFO(): + client_info = gapic_v1.client_info.ClientInfo() + + with mock.patch.object( + transports.AutoscalingPolicyServiceTransport, "_prep_wrapped_messages" + ) as prep: + client = AutoscalingPolicyServiceClient( + credentials=credentials.AnonymousCredentials(), client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + with mock.patch.object( + transports.AutoscalingPolicyServiceTransport, "_prep_wrapped_messages" + ) as prep: + transport_class = AutoscalingPolicyServiceClient.get_transport_class() + transport = transport_class( + credentials=credentials.AnonymousCredentials(), client_info=client_info, + ) + prep.assert_called_once_with(client_info) diff --git a/tests/unit/gapic/dataproc_v1beta2/test_cluster_controller.py b/tests/unit/gapic/dataproc_v1beta2/test_cluster_controller.py index 1dbc1a36..9d436939 100644 --- a/tests/unit/gapic/dataproc_v1beta2/test_cluster_controller.py +++ b/tests/unit/gapic/dataproc_v1beta2/test_cluster_controller.py @@ -173,6 +173,7 @@ def test_cluster_controller_client_client_options( api_mtls_endpoint="squid.clam.whelk", client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is @@ -189,6 +190,7 @@ def test_cluster_controller_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is @@ -205,6 +207,7 @@ def test_cluster_controller_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -224,6 +227,7 @@ def test_cluster_controller_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=client_cert_source_callback, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -244,6 +248,7 @@ def test_cluster_controller_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -264,6 +269,7 @@ def test_cluster_controller_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS has @@ -285,6 +291,7 @@ def test_cluster_controller_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id="octopus", + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -315,6 +322,7 @@ def test_cluster_controller_client_client_options_scopes( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -345,6 +353,7 @@ def test_cluster_controller_client_client_options_credentials_file( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -364,6 +373,7 @@ def test_cluster_controller_client_client_options_from_dict(): api_mtls_endpoint="squid.clam.whelk", client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -1243,8 +1253,8 @@ def test_list_clusters_pages(): RuntimeError, ) pages = list(client.list_clusters(request={}).pages) - for page, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page.raw_page.next_page_token == token + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.asyncio @@ -1308,10 +1318,10 @@ async def test_list_clusters_async_pages(): RuntimeError, ) pages = [] - async for page in (await client.list_clusters(request={})).pages: - pages.append(page) - for page, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page.raw_page.next_page_token == token + async for page_ in (await client.list_clusters(request={})).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token def test_diagnose_cluster( @@ -1841,3 +1851,24 @@ def test_cluster_controller_grpc_lro_async_client(): # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client + + +def test_client_withDEFAULT_CLIENT_INFO(): + client_info = gapic_v1.client_info.ClientInfo() + + with mock.patch.object( + transports.ClusterControllerTransport, "_prep_wrapped_messages" + ) as prep: + client = ClusterControllerClient( + credentials=credentials.AnonymousCredentials(), client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + with mock.patch.object( + transports.ClusterControllerTransport, "_prep_wrapped_messages" + ) as prep: + transport_class = ClusterControllerClient.get_transport_class() + transport = transport_class( + credentials=credentials.AnonymousCredentials(), client_info=client_info, + ) + prep.assert_called_once_with(client_info) diff --git a/tests/unit/gapic/dataproc_v1beta2/test_job_controller.py b/tests/unit/gapic/dataproc_v1beta2/test_job_controller.py index 89e093e6..5d106a8f 100644 --- a/tests/unit/gapic/dataproc_v1beta2/test_job_controller.py +++ b/tests/unit/gapic/dataproc_v1beta2/test_job_controller.py @@ -167,6 +167,7 @@ def test_job_controller_client_client_options( api_mtls_endpoint="squid.clam.whelk", client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is @@ -183,6 +184,7 @@ def test_job_controller_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is @@ -199,6 +201,7 @@ def test_job_controller_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -218,6 +221,7 @@ def test_job_controller_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=client_cert_source_callback, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -238,6 +242,7 @@ def test_job_controller_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -258,6 +263,7 @@ def test_job_controller_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS has @@ -279,6 +285,7 @@ def test_job_controller_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id="octopus", + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -309,6 +316,7 @@ def test_job_controller_client_client_options_scopes( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -339,6 +347,7 @@ def test_job_controller_client_client_options_credentials_file( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -358,6 +367,7 @@ def test_job_controller_client_client_options_from_dict(): api_mtls_endpoint="squid.clam.whelk", client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -1081,8 +1091,8 @@ def test_list_jobs_pages(): RuntimeError, ) pages = list(client.list_jobs(request={}).pages) - for page, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page.raw_page.next_page_token == token + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.asyncio @@ -1136,10 +1146,10 @@ async def test_list_jobs_async_pages(): RuntimeError, ) pages = [] - async for page in (await client.list_jobs(request={})).pages: - pages.append(page) - for page, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page.raw_page.next_page_token == token + async for page_ in (await client.list_jobs(request={})).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token def test_update_job(transport: str = "grpc", request_type=jobs.UpdateJobRequest): @@ -1925,3 +1935,24 @@ def test_job_controller_grpc_lro_async_client(): # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client + + +def test_client_withDEFAULT_CLIENT_INFO(): + client_info = gapic_v1.client_info.ClientInfo() + + with mock.patch.object( + transports.JobControllerTransport, "_prep_wrapped_messages" + ) as prep: + client = JobControllerClient( + credentials=credentials.AnonymousCredentials(), client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + with mock.patch.object( + transports.JobControllerTransport, "_prep_wrapped_messages" + ) as prep: + transport_class = JobControllerClient.get_transport_class() + transport = transport_class( + credentials=credentials.AnonymousCredentials(), client_info=client_info, + ) + prep.assert_called_once_with(client_info) diff --git a/tests/unit/gapic/dataproc_v1beta2/test_workflow_template_service.py b/tests/unit/gapic/dataproc_v1beta2/test_workflow_template_service.py index 07ea3560..b97d1976 100644 --- a/tests/unit/gapic/dataproc_v1beta2/test_workflow_template_service.py +++ b/tests/unit/gapic/dataproc_v1beta2/test_workflow_template_service.py @@ -178,6 +178,7 @@ def test_workflow_template_service_client_client_options( api_mtls_endpoint="squid.clam.whelk", client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is @@ -194,6 +195,7 @@ def test_workflow_template_service_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is @@ -210,6 +212,7 @@ def test_workflow_template_service_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -229,6 +232,7 @@ def test_workflow_template_service_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=client_cert_source_callback, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -249,6 +253,7 @@ def test_workflow_template_service_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -269,6 +274,7 @@ def test_workflow_template_service_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS has @@ -290,6 +296,7 @@ def test_workflow_template_service_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id="octopus", + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -324,6 +331,7 @@ def test_workflow_template_service_client_client_options_scopes( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -358,6 +366,7 @@ def test_workflow_template_service_client_client_options_credentials_file( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -377,6 +386,7 @@ def test_workflow_template_service_client_client_options_from_dict(): api_mtls_endpoint="squid.clam.whelk", client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -1794,8 +1804,8 @@ def test_list_workflow_templates_pages(): RuntimeError, ) pages = list(client.list_workflow_templates(request={}).pages) - for page, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page.raw_page.next_page_token == token + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.asyncio @@ -1885,10 +1895,10 @@ async def test_list_workflow_templates_async_pages(): RuntimeError, ) pages = [] - async for page in (await client.list_workflow_templates(request={})).pages: - pages.append(page) - for page, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page.raw_page.next_page_token == token + async for page_ in (await client.list_workflow_templates(request={})).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token def test_delete_workflow_template( @@ -2486,3 +2496,24 @@ def test_parse_workflow_template_path(): # Check that the path construction is reversible. actual = WorkflowTemplateServiceClient.parse_workflow_template_path(path) assert expected == actual + + +def test_client_withDEFAULT_CLIENT_INFO(): + client_info = gapic_v1.client_info.ClientInfo() + + with mock.patch.object( + transports.WorkflowTemplateServiceTransport, "_prep_wrapped_messages" + ) as prep: + client = WorkflowTemplateServiceClient( + credentials=credentials.AnonymousCredentials(), client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + with mock.patch.object( + transports.WorkflowTemplateServiceTransport, "_prep_wrapped_messages" + ) as prep: + transport_class = WorkflowTemplateServiceClient.get_transport_class() + transport = transport_class( + credentials=credentials.AnonymousCredentials(), client_info=client_info, + ) + prep.assert_called_once_with(client_info)