diff --git a/.flake8 b/.flake8 index 29227d4..2e43874 100644 --- a/.flake8 +++ b/.flake8 @@ -16,7 +16,7 @@ # Generated by synthtool. DO NOT EDIT! [flake8] -ignore = E203, E266, E501, W503 +ignore = E203, E231, E266, E501, W503 exclude = # Exclude generated code. **/proto/** diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 44c78f7..757c9dc 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 + digest: sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32 +# created: 2022-05-05T22:08:23.383410683Z diff --git a/.github/auto-approve.yml b/.github/auto-approve.yml new file mode 100644 index 0000000..311ebbb --- /dev/null +++ b/.github/auto-approve.yml @@ -0,0 +1,3 @@ +# https://github.com/googleapis/repo-automation-bots/tree/main/packages/auto-approve +processes: + - "OwlBotTemplateChanges" diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml new file mode 100644 index 0000000..41bff0b --- /dev/null +++ b/.github/auto-label.yaml @@ -0,0 +1,15 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +requestsize: + enabled: true diff --git a/.github/release-please.yml b/.github/release-please.yml index 466597e..6def37a 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,2 +1,8 @@ releaseType: python handleGHRelease: true +# NOTE: this section is generated by synthtool.languages.python +# See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py +branches: +- branch: v0 + handleGHRelease: true + releaseType: python diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index 4e1b1fb..238b87b 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ubuntu:20.04 +from ubuntu:22.04 ENV DEBIAN_FRONTEND noninteractive @@ -60,8 +60,24 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* \ && rm -f /var/cache/apt/archives/*.deb +###################### Install python 3.8.11 + +# Download python 3.8.11 +RUN wget https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tgz + +# Extract files +RUN tar -xvf Python-3.8.11.tgz + +# Install python 3.8.11 +RUN ./Python-3.8.11/configure --enable-optimizations +RUN make altinstall + +###################### Install pip RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && python3.8 /tmp/get-pip.py \ + && python3 /tmp/get-pip.py \ && rm /tmp/get-pip.py +# Test pip +RUN python3 -m pip + CMD ["python3.8"] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 62eb5a7..46d2371 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: - id: end-of-file-fixer - id: check-yaml - repo: https://github.com/psf/black - rev: 19.10b0 + rev: 22.3.0 hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f4b5c1..e79f8ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.0.1](https://github.com/googleapis/python-datastream/compare/v1.0.0...v1.0.1) (2022-05-06) + + +### Documentation + +* fix type in docstring for map fields ([cb7249d](https://github.com/googleapis/python-datastream/commit/cb7249d165c28d6c4005313759282ce4f78966c8)) + ## [1.0.0](https://github.com/googleapis/python-datastream/compare/v0.4.2...v1.0.0) (2022-03-15) diff --git a/docs/conf.py b/docs/conf.py index 17393f0..2255f44 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,9 +24,9 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys import os import shlex +import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -361,7 +361,10 @@ intersphinx_mapping = { "python": ("https://python.readthedocs.org/en/latest/", None), "google-auth": ("https://googleapis.dev/python/google-auth/latest/", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,), + "google.api_core": ( + "https://googleapis.dev/python/google-api-core/latest/", + None, + ), "grpc": ("https://grpc.github.io/grpc/python/", None), "proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None), "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), diff --git a/google/cloud/datastream/__init__.py b/google/cloud/datastream/__init__.py index 8c5ff0b..2127eed 100644 --- a/google/cloud/datastream/__init__.py +++ b/google/cloud/datastream/__init__.py @@ -14,86 +14,83 @@ # limitations under the License. # -from google.cloud.datastream_v1.services.datastream.client import DatastreamClient from google.cloud.datastream_v1.services.datastream.async_client import ( DatastreamAsyncClient, ) - -from google.cloud.datastream_v1.types.datastream import CreateConnectionProfileRequest -from google.cloud.datastream_v1.types.datastream import CreatePrivateConnectionRequest -from google.cloud.datastream_v1.types.datastream import CreateRouteRequest -from google.cloud.datastream_v1.types.datastream import CreateStreamRequest -from google.cloud.datastream_v1.types.datastream import DeleteConnectionProfileRequest -from google.cloud.datastream_v1.types.datastream import DeletePrivateConnectionRequest -from google.cloud.datastream_v1.types.datastream import DeleteRouteRequest -from google.cloud.datastream_v1.types.datastream import DeleteStreamRequest -from google.cloud.datastream_v1.types.datastream import DiscoverConnectionProfileRequest +from google.cloud.datastream_v1.services.datastream.client import DatastreamClient from google.cloud.datastream_v1.types.datastream import ( + CreateConnectionProfileRequest, + CreatePrivateConnectionRequest, + CreateRouteRequest, + CreateStreamRequest, + DeleteConnectionProfileRequest, + DeletePrivateConnectionRequest, + DeleteRouteRequest, + DeleteStreamRequest, + DiscoverConnectionProfileRequest, DiscoverConnectionProfileResponse, + FetchStaticIpsRequest, + FetchStaticIpsResponse, + GetConnectionProfileRequest, + GetPrivateConnectionRequest, + GetRouteRequest, + GetStreamObjectRequest, + GetStreamRequest, + ListConnectionProfilesRequest, + ListConnectionProfilesResponse, + ListPrivateConnectionsRequest, + ListPrivateConnectionsResponse, + ListRoutesRequest, + ListRoutesResponse, + ListStreamObjectsRequest, + ListStreamObjectsResponse, + ListStreamsRequest, + ListStreamsResponse, + LookupStreamObjectRequest, + OperationMetadata, + StartBackfillJobRequest, + StartBackfillJobResponse, + StopBackfillJobRequest, + StopBackfillJobResponse, + UpdateConnectionProfileRequest, + UpdateStreamRequest, ) -from google.cloud.datastream_v1.types.datastream import FetchStaticIpsRequest -from google.cloud.datastream_v1.types.datastream import FetchStaticIpsResponse -from google.cloud.datastream_v1.types.datastream import GetConnectionProfileRequest -from google.cloud.datastream_v1.types.datastream import GetPrivateConnectionRequest -from google.cloud.datastream_v1.types.datastream import GetRouteRequest -from google.cloud.datastream_v1.types.datastream import GetStreamObjectRequest -from google.cloud.datastream_v1.types.datastream import GetStreamRequest -from google.cloud.datastream_v1.types.datastream import ListConnectionProfilesRequest -from google.cloud.datastream_v1.types.datastream import ListConnectionProfilesResponse -from google.cloud.datastream_v1.types.datastream import ListPrivateConnectionsRequest -from google.cloud.datastream_v1.types.datastream import ListPrivateConnectionsResponse -from google.cloud.datastream_v1.types.datastream import ListRoutesRequest -from google.cloud.datastream_v1.types.datastream import ListRoutesResponse -from google.cloud.datastream_v1.types.datastream import ListStreamObjectsRequest -from google.cloud.datastream_v1.types.datastream import ListStreamObjectsResponse -from google.cloud.datastream_v1.types.datastream import ListStreamsRequest -from google.cloud.datastream_v1.types.datastream import ListStreamsResponse -from google.cloud.datastream_v1.types.datastream import LookupStreamObjectRequest -from google.cloud.datastream_v1.types.datastream import OperationMetadata -from google.cloud.datastream_v1.types.datastream import StartBackfillJobRequest -from google.cloud.datastream_v1.types.datastream import StartBackfillJobResponse -from google.cloud.datastream_v1.types.datastream import StopBackfillJobRequest -from google.cloud.datastream_v1.types.datastream import StopBackfillJobResponse -from google.cloud.datastream_v1.types.datastream import UpdateConnectionProfileRequest -from google.cloud.datastream_v1.types.datastream import UpdateStreamRequest -from google.cloud.datastream_v1.types.datastream_resources import AvroFileFormat -from google.cloud.datastream_v1.types.datastream_resources import BackfillJob -from google.cloud.datastream_v1.types.datastream_resources import ConnectionProfile -from google.cloud.datastream_v1.types.datastream_resources import DestinationConfig -from google.cloud.datastream_v1.types.datastream_resources import Error from google.cloud.datastream_v1.types.datastream_resources import ( + AvroFileFormat, + BackfillJob, + ConnectionProfile, + DestinationConfig, + Error, ForwardSshTunnelConnectivity, -) -from google.cloud.datastream_v1.types.datastream_resources import GcsDestinationConfig -from google.cloud.datastream_v1.types.datastream_resources import GcsProfile -from google.cloud.datastream_v1.types.datastream_resources import JsonFileFormat -from google.cloud.datastream_v1.types.datastream_resources import MysqlColumn -from google.cloud.datastream_v1.types.datastream_resources import MysqlDatabase -from google.cloud.datastream_v1.types.datastream_resources import MysqlProfile -from google.cloud.datastream_v1.types.datastream_resources import MysqlRdbms -from google.cloud.datastream_v1.types.datastream_resources import MysqlSourceConfig -from google.cloud.datastream_v1.types.datastream_resources import MysqlSslConfig -from google.cloud.datastream_v1.types.datastream_resources import MysqlTable -from google.cloud.datastream_v1.types.datastream_resources import OracleColumn -from google.cloud.datastream_v1.types.datastream_resources import OracleProfile -from google.cloud.datastream_v1.types.datastream_resources import OracleRdbms -from google.cloud.datastream_v1.types.datastream_resources import OracleSchema -from google.cloud.datastream_v1.types.datastream_resources import OracleSourceConfig -from google.cloud.datastream_v1.types.datastream_resources import OracleTable -from google.cloud.datastream_v1.types.datastream_resources import PrivateConnection -from google.cloud.datastream_v1.types.datastream_resources import PrivateConnectivity -from google.cloud.datastream_v1.types.datastream_resources import Route -from google.cloud.datastream_v1.types.datastream_resources import SourceConfig -from google.cloud.datastream_v1.types.datastream_resources import SourceObjectIdentifier -from google.cloud.datastream_v1.types.datastream_resources import ( + GcsDestinationConfig, + GcsProfile, + JsonFileFormat, + MysqlColumn, + MysqlDatabase, + MysqlProfile, + MysqlRdbms, + MysqlSourceConfig, + MysqlSslConfig, + MysqlTable, + OracleColumn, + OracleProfile, + OracleRdbms, + OracleSchema, + OracleSourceConfig, + OracleTable, + PrivateConnection, + PrivateConnectivity, + Route, + SourceConfig, + SourceObjectIdentifier, StaticServiceIpConnectivity, + Stream, + StreamObject, + Validation, + ValidationMessage, + ValidationResult, + VpcPeeringConfig, ) -from google.cloud.datastream_v1.types.datastream_resources import Stream -from google.cloud.datastream_v1.types.datastream_resources import StreamObject -from google.cloud.datastream_v1.types.datastream_resources import Validation -from google.cloud.datastream_v1.types.datastream_resources import ValidationMessage -from google.cloud.datastream_v1.types.datastream_resources import ValidationResult -from google.cloud.datastream_v1.types.datastream_resources import VpcPeeringConfig __all__ = ( "DatastreamClient", diff --git a/google/cloud/datastream_v1/__init__.py b/google/cloud/datastream_v1/__init__.py index be9f50e..4f92d57 100644 --- a/google/cloud/datastream_v1/__init__.py +++ b/google/cloud/datastream_v1/__init__.py @@ -14,78 +14,80 @@ # limitations under the License. # -from .services.datastream import DatastreamClient -from .services.datastream import DatastreamAsyncClient - -from .types.datastream import CreateConnectionProfileRequest -from .types.datastream import CreatePrivateConnectionRequest -from .types.datastream import CreateRouteRequest -from .types.datastream import CreateStreamRequest -from .types.datastream import DeleteConnectionProfileRequest -from .types.datastream import DeletePrivateConnectionRequest -from .types.datastream import DeleteRouteRequest -from .types.datastream import DeleteStreamRequest -from .types.datastream import DiscoverConnectionProfileRequest -from .types.datastream import DiscoverConnectionProfileResponse -from .types.datastream import FetchStaticIpsRequest -from .types.datastream import FetchStaticIpsResponse -from .types.datastream import GetConnectionProfileRequest -from .types.datastream import GetPrivateConnectionRequest -from .types.datastream import GetRouteRequest -from .types.datastream import GetStreamObjectRequest -from .types.datastream import GetStreamRequest -from .types.datastream import ListConnectionProfilesRequest -from .types.datastream import ListConnectionProfilesResponse -from .types.datastream import ListPrivateConnectionsRequest -from .types.datastream import ListPrivateConnectionsResponse -from .types.datastream import ListRoutesRequest -from .types.datastream import ListRoutesResponse -from .types.datastream import ListStreamObjectsRequest -from .types.datastream import ListStreamObjectsResponse -from .types.datastream import ListStreamsRequest -from .types.datastream import ListStreamsResponse -from .types.datastream import LookupStreamObjectRequest -from .types.datastream import OperationMetadata -from .types.datastream import StartBackfillJobRequest -from .types.datastream import StartBackfillJobResponse -from .types.datastream import StopBackfillJobRequest -from .types.datastream import StopBackfillJobResponse -from .types.datastream import UpdateConnectionProfileRequest -from .types.datastream import UpdateStreamRequest -from .types.datastream_resources import AvroFileFormat -from .types.datastream_resources import BackfillJob -from .types.datastream_resources import ConnectionProfile -from .types.datastream_resources import DestinationConfig -from .types.datastream_resources import Error -from .types.datastream_resources import ForwardSshTunnelConnectivity -from .types.datastream_resources import GcsDestinationConfig -from .types.datastream_resources import GcsProfile -from .types.datastream_resources import JsonFileFormat -from .types.datastream_resources import MysqlColumn -from .types.datastream_resources import MysqlDatabase -from .types.datastream_resources import MysqlProfile -from .types.datastream_resources import MysqlRdbms -from .types.datastream_resources import MysqlSourceConfig -from .types.datastream_resources import MysqlSslConfig -from .types.datastream_resources import MysqlTable -from .types.datastream_resources import OracleColumn -from .types.datastream_resources import OracleProfile -from .types.datastream_resources import OracleRdbms -from .types.datastream_resources import OracleSchema -from .types.datastream_resources import OracleSourceConfig -from .types.datastream_resources import OracleTable -from .types.datastream_resources import PrivateConnection -from .types.datastream_resources import PrivateConnectivity -from .types.datastream_resources import Route -from .types.datastream_resources import SourceConfig -from .types.datastream_resources import SourceObjectIdentifier -from .types.datastream_resources import StaticServiceIpConnectivity -from .types.datastream_resources import Stream -from .types.datastream_resources import StreamObject -from .types.datastream_resources import Validation -from .types.datastream_resources import ValidationMessage -from .types.datastream_resources import ValidationResult -from .types.datastream_resources import VpcPeeringConfig +from .services.datastream import DatastreamAsyncClient, DatastreamClient +from .types.datastream import ( + CreateConnectionProfileRequest, + CreatePrivateConnectionRequest, + CreateRouteRequest, + CreateStreamRequest, + DeleteConnectionProfileRequest, + DeletePrivateConnectionRequest, + DeleteRouteRequest, + DeleteStreamRequest, + DiscoverConnectionProfileRequest, + DiscoverConnectionProfileResponse, + FetchStaticIpsRequest, + FetchStaticIpsResponse, + GetConnectionProfileRequest, + GetPrivateConnectionRequest, + GetRouteRequest, + GetStreamObjectRequest, + GetStreamRequest, + ListConnectionProfilesRequest, + ListConnectionProfilesResponse, + ListPrivateConnectionsRequest, + ListPrivateConnectionsResponse, + ListRoutesRequest, + ListRoutesResponse, + ListStreamObjectsRequest, + ListStreamObjectsResponse, + ListStreamsRequest, + ListStreamsResponse, + LookupStreamObjectRequest, + OperationMetadata, + StartBackfillJobRequest, + StartBackfillJobResponse, + StopBackfillJobRequest, + StopBackfillJobResponse, + UpdateConnectionProfileRequest, + UpdateStreamRequest, +) +from .types.datastream_resources import ( + AvroFileFormat, + BackfillJob, + ConnectionProfile, + DestinationConfig, + Error, + ForwardSshTunnelConnectivity, + GcsDestinationConfig, + GcsProfile, + JsonFileFormat, + MysqlColumn, + MysqlDatabase, + MysqlProfile, + MysqlRdbms, + MysqlSourceConfig, + MysqlSslConfig, + MysqlTable, + OracleColumn, + OracleProfile, + OracleRdbms, + OracleSchema, + OracleSourceConfig, + OracleTable, + PrivateConnection, + PrivateConnectivity, + Route, + SourceConfig, + SourceObjectIdentifier, + StaticServiceIpConnectivity, + Stream, + StreamObject, + Validation, + ValidationMessage, + ValidationResult, + VpcPeeringConfig, +) __all__ = ( "DatastreamAsyncClient", diff --git a/google/cloud/datastream_v1/services/datastream/__init__.py b/google/cloud/datastream_v1/services/datastream/__init__.py index 0e6c29f..2636cbc 100644 --- a/google/cloud/datastream_v1/services/datastream/__init__.py +++ b/google/cloud/datastream_v1/services/datastream/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import DatastreamClient from .async_client import DatastreamAsyncClient +from .client import DatastreamClient __all__ = ( "DatastreamClient", diff --git a/google/cloud/datastream_v1/services/datastream/async_client.py b/google/cloud/datastream_v1/services/datastream/async_client.py index c098b9b..f8ffe07 100644 --- a/google/cloud/datastream_v1/services/datastream/async_client.py +++ b/google/cloud/datastream_v1/services/datastream/async_client.py @@ -16,15 +16,15 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -33,15 +33,16 @@ from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore -from google.cloud.datastream_v1.services.datastream import pagers -from google.cloud.datastream_v1.types import datastream -from google.cloud.datastream_v1.types import datastream_resources from google.protobuf import empty_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import DatastreamTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import DatastreamGrpcAsyncIOTransport + +from google.cloud.datastream_v1.services.datastream import pagers +from google.cloud.datastream_v1.types import datastream, datastream_resources + from .client import DatastreamClient +from .transports.base import DEFAULT_CLIENT_INFO, DatastreamTransport +from .transports.grpc_asyncio import DatastreamGrpcAsyncIOTransport class DatastreamAsyncClient: @@ -228,14 +229,13 @@ async def list_connection_profiles( r"""Use this method to list connection profiles created in a project and location. - .. code-block:: python from google.cloud import datastream_v1 - def sample_list_connection_profiles(): + async def sample_list_connection_profiles(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1.ListConnectionProfilesRequest( @@ -246,7 +246,7 @@ def sample_list_connection_profiles(): page_result = client.list_connection_profiles(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -307,12 +307,20 @@ def sample_list_connection_profiles(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListConnectionProfilesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -330,14 +338,13 @@ async def get_connection_profile( r"""Use this method to get details about a connection profile. - .. code-block:: python from google.cloud import datastream_v1 - def sample_get_connection_profile(): + async def sample_get_connection_profile(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1.GetConnectionProfileRequest( @@ -345,7 +352,7 @@ def sample_get_connection_profile(): ) # Make the request - response = client.get_connection_profile(request=request) + response = await client.get_connection_profile(request=request) # Handle the response print(response) @@ -406,7 +413,12 @@ def sample_get_connection_profile(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -425,14 +437,13 @@ async def create_connection_profile( r"""Use this method to create a connection profile in a project and location. - .. code-block:: python from google.cloud import datastream_v1 - def sample_create_connection_profile(): + async def sample_create_connection_profile(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) connection_profile = datastream_v1.ConnectionProfile() @@ -453,7 +464,7 @@ def sample_create_connection_profile(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -533,7 +544,12 @@ def sample_create_connection_profile(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -559,14 +575,13 @@ async def update_connection_profile( r"""Use this method to update the parameters of a connection profile. - .. code-block:: python from google.cloud import datastream_v1 - def sample_update_connection_profile(): + async def sample_update_connection_profile(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) connection_profile = datastream_v1.ConnectionProfile() @@ -585,7 +600,7 @@ def sample_update_connection_profile(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -662,7 +677,12 @@ def sample_update_connection_profile(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -690,9 +710,9 @@ async def delete_connection_profile( from google.cloud import datastream_v1 - def sample_delete_connection_profile(): + async def sample_delete_connection_profile(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1.DeleteConnectionProfileRequest( @@ -704,7 +724,7 @@ def sample_delete_connection_profile(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -777,7 +797,12 @@ def sample_delete_connection_profile(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -804,14 +829,13 @@ async def discover_connection_profile( returns children data objects of a parent data object that's optionally supplied in the request. - .. code-block:: python from google.cloud import datastream_v1 - def sample_discover_connection_profile(): + async def sample_discover_connection_profile(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) connection_profile = datastream_v1.ConnectionProfile() @@ -828,7 +852,7 @@ def sample_discover_connection_profile(): ) # Make the request - response = client.discover_connection_profile(request=request) + response = await client.discover_connection_profile(request=request) # Handle the response print(response) @@ -865,7 +889,12 @@ def sample_discover_connection_profile(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -882,14 +911,13 @@ async def list_streams( r"""Use this method to list streams in a project and location. - .. code-block:: python from google.cloud import datastream_v1 - def sample_list_streams(): + async def sample_list_streams(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1.ListStreamsRequest( @@ -900,7 +928,7 @@ def sample_list_streams(): page_result = client.list_streams(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -959,12 +987,20 @@ def sample_list_streams(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListStreamsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -985,9 +1021,9 @@ async def get_stream( from google.cloud import datastream_v1 - def sample_get_stream(): + async def sample_get_stream(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1.GetStreamRequest( @@ -995,7 +1031,7 @@ def sample_get_stream(): ) # Make the request - response = client.get_stream(request=request) + response = await client.get_stream(request=request) # Handle the response print(response) @@ -1055,7 +1091,12 @@ def sample_get_stream(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1077,9 +1118,9 @@ async def create_stream( from google.cloud import datastream_v1 - def sample_create_stream(): + async def sample_create_stream(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) stream = datastream_v1.Stream() @@ -1098,7 +1139,7 @@ def sample_create_stream(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1178,7 +1219,12 @@ def sample_create_stream(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1204,14 +1250,13 @@ async def update_stream( r"""Use this method to update the configuration of a stream. - .. code-block:: python from google.cloud import datastream_v1 - def sample_update_stream(): + async def sample_update_stream(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) stream = datastream_v1.Stream() @@ -1228,7 +1273,7 @@ def sample_update_stream(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1307,7 +1352,12 @@ def sample_update_stream(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1335,9 +1385,9 @@ async def delete_stream( from google.cloud import datastream_v1 - def sample_delete_stream(): + async def sample_delete_stream(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1.DeleteStreamRequest( @@ -1349,7 +1399,7 @@ def sample_delete_stream(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1422,7 +1472,12 @@ def sample_delete_stream(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1450,9 +1505,9 @@ async def get_stream_object( from google.cloud import datastream_v1 - def sample_get_stream_object(): + async def sample_get_stream_object(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1.GetStreamObjectRequest( @@ -1460,7 +1515,7 @@ def sample_get_stream_object(): ) # Make the request - response = client.get_stream_object(request=request) + response = await client.get_stream_object(request=request) # Handle the response print(response) @@ -1520,7 +1575,12 @@ def sample_get_stream_object(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1536,14 +1596,13 @@ async def lookup_stream_object( r"""Use this method to look up a stream object by its source object identifier. - .. code-block:: python from google.cloud import datastream_v1 - def sample_lookup_stream_object(): + async def sample_lookup_stream_object(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) source_object_identifier = datastream_v1.SourceObjectIdentifier() @@ -1556,7 +1615,7 @@ def sample_lookup_stream_object(): ) # Make the request - response = client.lookup_stream_object(request=request) + response = await client.lookup_stream_object(request=request) # Handle the response print(response) @@ -1595,7 +1654,12 @@ def sample_lookup_stream_object(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1612,14 +1676,13 @@ async def list_stream_objects( r"""Use this method to list the objects of a specific stream. - .. code-block:: python from google.cloud import datastream_v1 - def sample_list_stream_objects(): + async def sample_list_stream_objects(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1.ListStreamObjectsRequest( @@ -1630,7 +1693,7 @@ def sample_list_stream_objects(): page_result = client.list_stream_objects(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -1691,12 +1754,20 @@ def sample_list_stream_objects(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListStreamObjectsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1714,14 +1785,13 @@ async def start_backfill_job( r"""Use this method to start a backfill job for the specified stream object. - .. code-block:: python from google.cloud import datastream_v1 - def sample_start_backfill_job(): + async def sample_start_backfill_job(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1.StartBackfillJobRequest( @@ -1729,7 +1799,7 @@ def sample_start_backfill_job(): ) # Make the request - response = client.start_backfill_job(request=request) + response = await client.start_backfill_job(request=request) # Handle the response print(response) @@ -1791,7 +1861,12 @@ def sample_start_backfill_job(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1808,14 +1883,13 @@ async def stop_backfill_job( r"""Use this method to stop a backfill job for the specified stream object. - .. code-block:: python from google.cloud import datastream_v1 - def sample_stop_backfill_job(): + async def sample_stop_backfill_job(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1.StopBackfillJobRequest( @@ -1823,7 +1897,7 @@ def sample_stop_backfill_job(): ) # Make the request - response = client.stop_backfill_job(request=request) + response = await client.stop_backfill_job(request=request) # Handle the response print(response) @@ -1884,7 +1958,12 @@ def sample_stop_backfill_job(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1901,14 +1980,13 @@ async def fetch_static_ips( r"""The FetchStaticIps API call exposes the static IP addresses used by Datastream. - .. code-block:: python from google.cloud import datastream_v1 - def sample_fetch_static_ips(): + async def sample_fetch_static_ips(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1.FetchStaticIpsRequest( @@ -1919,7 +1997,7 @@ def sample_fetch_static_ips(): page_result = client.fetch_static_ips(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -1981,12 +2059,20 @@ def sample_fetch_static_ips(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.FetchStaticIpsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -2006,14 +2092,13 @@ async def create_private_connection( r"""Use this method to create a private connectivity configuration. - .. code-block:: python from google.cloud import datastream_v1 - def sample_create_private_connection(): + async def sample_create_private_connection(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) private_connection = datastream_v1.PrivateConnection() @@ -2030,7 +2115,7 @@ def sample_create_private_connection(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -2110,7 +2195,12 @@ def sample_create_private_connection(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -2135,14 +2225,13 @@ async def get_private_connection( r"""Use this method to get details about a private connectivity configuration. - .. code-block:: python from google.cloud import datastream_v1 - def sample_get_private_connection(): + async def sample_get_private_connection(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1.GetPrivateConnectionRequest( @@ -2150,7 +2239,7 @@ def sample_get_private_connection(): ) # Make the request - response = client.get_private_connection(request=request) + response = await client.get_private_connection(request=request) # Handle the response print(response) @@ -2212,7 +2301,12 @@ def sample_get_private_connection(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2229,14 +2323,13 @@ async def list_private_connections( r"""Use this method to list private connectivity configurations in a project and location. - .. code-block:: python from google.cloud import datastream_v1 - def sample_list_private_connections(): + async def sample_list_private_connections(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1.ListPrivateConnectionsRequest( @@ -2247,7 +2340,7 @@ def sample_list_private_connections(): page_result = client.list_private_connections(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -2309,12 +2402,20 @@ def sample_list_private_connections(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListPrivateConnectionsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -2332,14 +2433,13 @@ async def delete_private_connection( r"""Use this method to delete a private connectivity configuration. - .. code-block:: python from google.cloud import datastream_v1 - def sample_delete_private_connection(): + async def sample_delete_private_connection(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1.DeletePrivateConnectionRequest( @@ -2351,7 +2451,7 @@ def sample_delete_private_connection(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -2424,7 +2524,12 @@ def sample_delete_private_connection(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -2451,14 +2556,13 @@ async def create_route( r"""Use this method to create a route for a private connectivity configuration in a project and location. - .. code-block:: python from google.cloud import datastream_v1 - def sample_create_route(): + async def sample_create_route(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) route = datastream_v1.Route() @@ -2476,7 +2580,7 @@ def sample_create_route(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -2553,7 +2657,12 @@ def sample_create_route(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -2581,9 +2690,9 @@ async def get_route( from google.cloud import datastream_v1 - def sample_get_route(): + async def sample_get_route(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1.GetRouteRequest( @@ -2591,7 +2700,7 @@ def sample_get_route(): ) # Make the request - response = client.get_route(request=request) + response = await client.get_route(request=request) # Handle the response print(response) @@ -2652,7 +2761,12 @@ def sample_get_route(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2669,14 +2783,13 @@ async def list_routes( r"""Use this method to list routes created for a private connectivity configuration in a project and location. - .. code-block:: python from google.cloud import datastream_v1 - def sample_list_routes(): + async def sample_list_routes(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1.ListRoutesRequest( @@ -2687,7 +2800,7 @@ def sample_list_routes(): page_result = client.list_routes(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -2746,12 +2859,20 @@ def sample_list_routes(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListRoutesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -2772,9 +2893,9 @@ async def delete_route( from google.cloud import datastream_v1 - def sample_delete_route(): + async def sample_delete_route(): # Create a client - client = datastream_v1.DatastreamClient() + client = datastream_v1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1.DeleteRouteRequest( @@ -2786,7 +2907,7 @@ def sample_delete_route(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -2858,7 +2979,12 @@ def sample_delete_route(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( diff --git a/google/cloud/datastream_v1/services/datastream/client.py b/google/cloud/datastream_v1/services/datastream/client.py index 3ab4e19..4711c98 100644 --- a/google/cloud/datastream_v1/services/datastream/client.py +++ b/google/cloud/datastream_v1/services/datastream/client.py @@ -16,18 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -36,13 +36,14 @@ from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore -from google.cloud.datastream_v1.services.datastream import pagers -from google.cloud.datastream_v1.types import datastream -from google.cloud.datastream_v1.types import datastream_resources from google.protobuf import empty_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import DatastreamTransport, DEFAULT_CLIENT_INFO + +from google.cloud.datastream_v1.services.datastream import pagers +from google.cloud.datastream_v1.types import datastream, datastream_resources + +from .transports.base import DEFAULT_CLIENT_INFO, DatastreamTransport from .transports.grpc import DatastreamGrpcTransport from .transports.grpc_asyncio import DatastreamGrpcAsyncIOTransport @@ -59,7 +60,10 @@ class DatastreamClientMeta(type): _transport_registry["grpc"] = DatastreamGrpcTransport _transport_registry["grpc_asyncio"] = DatastreamGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[DatastreamTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[DatastreamTransport]: """Returns an appropriate transport class. Args: @@ -165,11 +169,15 @@ def transport(self) -> DatastreamTransport: @staticmethod def connection_profile_path( - project: str, location: str, connection_profile: str, + project: str, + location: str, + connection_profile: str, ) -> str: """Returns a fully-qualified connection_profile string.""" return "projects/{project}/locations/{location}/connectionProfiles/{connection_profile}".format( - project=project, location=location, connection_profile=connection_profile, + project=project, + location=location, + connection_profile=connection_profile, ) @staticmethod @@ -182,10 +190,14 @@ def parse_connection_profile_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def networks_path(project: str, network: str,) -> str: + def networks_path( + project: str, + network: str, + ) -> str: """Returns a fully-qualified networks string.""" return "projects/{project}/global/networks/{network}".format( - project=project, network=network, + project=project, + network=network, ) @staticmethod @@ -198,11 +210,15 @@ def parse_networks_path(path: str) -> Dict[str, str]: @staticmethod def private_connection_path( - project: str, location: str, private_connection: str, + project: str, + location: str, + private_connection: str, ) -> str: """Returns a fully-qualified private_connection string.""" return "projects/{project}/locations/{location}/privateConnections/{private_connection}".format( - project=project, location=location, private_connection=private_connection, + project=project, + location=location, + private_connection=private_connection, ) @staticmethod @@ -216,7 +232,10 @@ def parse_private_connection_path(path: str) -> Dict[str, str]: @staticmethod def route_path( - project: str, location: str, private_connection: str, route: str, + project: str, + location: str, + private_connection: str, + route: str, ) -> str: """Returns a fully-qualified route string.""" return "projects/{project}/locations/{location}/privateConnections/{private_connection}/routes/{route}".format( @@ -236,10 +255,16 @@ def parse_route_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def stream_path(project: str, location: str, stream: str,) -> str: + def stream_path( + project: str, + location: str, + stream: str, + ) -> str: """Returns a fully-qualified stream string.""" return "projects/{project}/locations/{location}/streams/{stream}".format( - project=project, location=location, stream=stream, + project=project, + location=location, + stream=stream, ) @staticmethod @@ -253,11 +278,17 @@ def parse_stream_path(path: str) -> Dict[str, str]: @staticmethod def stream_object_path( - project: str, location: str, stream: str, object: str, + project: str, + location: str, + stream: str, + object: str, ) -> str: """Returns a fully-qualified stream_object string.""" return "projects/{project}/locations/{location}/streams/{stream}/objects/{object}".format( - project=project, location=location, stream=stream, object=object, + project=project, + location=location, + stream=stream, + object=object, ) @staticmethod @@ -270,7 +301,9 @@ def parse_stream_object_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -283,9 +316,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -294,9 +331,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -305,9 +346,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -316,10 +361,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -505,7 +554,6 @@ def list_connection_profiles( r"""Use this method to list connection profiles created in a project and location. - .. code-block:: python from google.cloud import datastream_v1 @@ -584,12 +632,20 @@ def sample_list_connection_profiles(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListConnectionProfilesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -607,7 +663,6 @@ def get_connection_profile( r"""Use this method to get details about a connection profile. - .. code-block:: python from google.cloud import datastream_v1 @@ -683,7 +738,12 @@ def sample_get_connection_profile(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -702,7 +762,6 @@ def create_connection_profile( r"""Use this method to create a connection profile in a project and location. - .. code-block:: python from google.cloud import datastream_v1 @@ -812,7 +871,12 @@ def sample_create_connection_profile(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -838,7 +902,6 @@ def update_connection_profile( r"""Use this method to update the parameters of a connection profile. - .. code-block:: python from google.cloud import datastream_v1 @@ -943,7 +1006,12 @@ def sample_update_connection_profile(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1060,7 +1128,12 @@ def sample_delete_connection_profile(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1087,7 +1160,6 @@ def discover_connection_profile( returns children data objects of a parent data object that's optionally supplied in the request. - .. code-block:: python from google.cloud import datastream_v1 @@ -1151,7 +1223,12 @@ def sample_discover_connection_profile(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1168,7 +1245,6 @@ def list_streams( r"""Use this method to list streams in a project and location. - .. code-block:: python from google.cloud import datastream_v1 @@ -1245,12 +1321,20 @@ def sample_list_streams(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListStreamsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1341,7 +1425,12 @@ def sample_get_stream(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1464,7 +1553,12 @@ def sample_create_stream(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1490,7 +1584,6 @@ def update_stream( r"""Use this method to update the configuration of a stream. - .. code-block:: python from google.cloud import datastream_v1 @@ -1593,7 +1686,12 @@ def sample_update_stream(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1708,7 +1806,12 @@ def sample_delete_stream(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1806,7 +1909,12 @@ def sample_get_stream_object(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1822,7 +1930,6 @@ def lookup_stream_object( r"""Use this method to look up a stream object by its source object identifier. - .. code-block:: python from google.cloud import datastream_v1 @@ -1882,7 +1989,12 @@ def sample_lookup_stream_object(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1899,7 +2011,6 @@ def list_stream_objects( r"""Use this method to list the objects of a specific stream. - .. code-block:: python from google.cloud import datastream_v1 @@ -1978,12 +2089,20 @@ def sample_list_stream_objects(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListStreamObjectsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -2001,7 +2120,6 @@ def start_backfill_job( r"""Use this method to start a backfill job for the specified stream object. - .. code-block:: python from google.cloud import datastream_v1 @@ -2078,7 +2196,12 @@ def sample_start_backfill_job(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2095,7 +2218,6 @@ def stop_backfill_job( r"""Use this method to stop a backfill job for the specified stream object. - .. code-block:: python from google.cloud import datastream_v1 @@ -2171,7 +2293,12 @@ def sample_stop_backfill_job(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2188,7 +2315,6 @@ def fetch_static_ips( r"""The FetchStaticIps API call exposes the static IP addresses used by Datastream. - .. code-block:: python from google.cloud import datastream_v1 @@ -2268,12 +2394,20 @@ def sample_fetch_static_ips(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.FetchStaticIpsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -2293,7 +2427,6 @@ def create_private_connection( r"""Use this method to create a private connectivity configuration. - .. code-block:: python from google.cloud import datastream_v1 @@ -2399,7 +2532,12 @@ def sample_create_private_connection(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -2424,7 +2562,6 @@ def get_private_connection( r"""Use this method to get details about a private connectivity configuration. - .. code-block:: python from google.cloud import datastream_v1 @@ -2501,7 +2638,12 @@ def sample_get_private_connection(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2518,7 +2660,6 @@ def list_private_connections( r"""Use this method to list private connectivity configurations in a project and location. - .. code-block:: python from google.cloud import datastream_v1 @@ -2598,12 +2739,20 @@ def sample_list_private_connections(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPrivateConnectionsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -2621,7 +2770,6 @@ def delete_private_connection( r"""Use this method to delete a private connectivity configuration. - .. code-block:: python from google.cloud import datastream_v1 @@ -2715,7 +2863,12 @@ def sample_delete_private_connection(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -2742,7 +2895,6 @@ def create_route( r"""Use this method to create a route for a private connectivity configuration in a project and location. - .. code-block:: python from google.cloud import datastream_v1 @@ -2844,7 +2996,12 @@ def sample_create_route(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -2943,7 +3100,12 @@ def sample_get_route(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2960,7 +3122,6 @@ def list_routes( r"""Use this method to list routes created for a private connectivity configuration in a project and location. - .. code-block:: python from google.cloud import datastream_v1 @@ -3037,12 +3198,20 @@ def sample_list_routes(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListRoutesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -3149,7 +3318,12 @@ def sample_delete_route(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( diff --git a/google/cloud/datastream_v1/services/datastream/pagers.py b/google/cloud/datastream_v1/services/datastream/pagers.py index 7617d90..1a3f3e1 100644 --- a/google/cloud/datastream_v1/services/datastream/pagers.py +++ b/google/cloud/datastream_v1/services/datastream/pagers.py @@ -18,14 +18,13 @@ AsyncIterator, Awaitable, Callable, + Iterator, + Optional, Sequence, Tuple, - Optional, - Iterator, ) -from google.cloud.datastream_v1.types import datastream -from google.cloud.datastream_v1.types import datastream_resources +from google.cloud.datastream_v1.types import datastream, datastream_resources class ListConnectionProfilesPager: diff --git a/google/cloud/datastream_v1/services/datastream/transports/__init__.py b/google/cloud/datastream_v1/services/datastream/transports/__init__.py index 8684788..064e682 100644 --- a/google/cloud/datastream_v1/services/datastream/transports/__init__.py +++ b/google/cloud/datastream_v1/services/datastream/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import DatastreamGrpcTransport from .grpc_asyncio import DatastreamGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[DatastreamTransport]] _transport_registry["grpc"] = DatastreamGrpcTransport diff --git a/google/cloud/datastream_v1/services/datastream/transports/base.py b/google/cloud/datastream_v1/services/datastream/transports/base.py index 6be6f26..145b55c 100644 --- a/google/cloud/datastream_v1/services/datastream/transports/base.py +++ b/google/cloud/datastream_v1/services/datastream/transports/base.py @@ -15,20 +15,18 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, operations_v1 from google.api_core import retry as retries -from google.api_core import operations_v1 +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore +from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources -from google.cloud.datastream_v1.types import datastream -from google.cloud.datastream_v1.types import datastream_resources -from google.longrunning import operations_pb2 # type: ignore +from google.cloud.datastream_v1.types import datastream, datastream_resources try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -83,6 +81,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -154,22 +153,34 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.list_streams: gapic_v1.method.wrap_method( - self.list_streams, default_timeout=None, client_info=client_info, + self.list_streams, + default_timeout=None, + client_info=client_info, ), self.get_stream: gapic_v1.method.wrap_method( - self.get_stream, default_timeout=None, client_info=client_info, + self.get_stream, + default_timeout=None, + client_info=client_info, ), self.create_stream: gapic_v1.method.wrap_method( - self.create_stream, default_timeout=60.0, client_info=client_info, + self.create_stream, + default_timeout=60.0, + client_info=client_info, ), self.update_stream: gapic_v1.method.wrap_method( - self.update_stream, default_timeout=60.0, client_info=client_info, + self.update_stream, + default_timeout=60.0, + client_info=client_info, ), self.delete_stream: gapic_v1.method.wrap_method( - self.delete_stream, default_timeout=60.0, client_info=client_info, + self.delete_stream, + default_timeout=60.0, + client_info=client_info, ), self.get_stream_object: gapic_v1.method.wrap_method( - self.get_stream_object, default_timeout=None, client_info=client_info, + self.get_stream_object, + default_timeout=None, + client_info=client_info, ), self.lookup_stream_object: gapic_v1.method.wrap_method( self.lookup_stream_object, @@ -177,16 +188,24 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.list_stream_objects: gapic_v1.method.wrap_method( - self.list_stream_objects, default_timeout=None, client_info=client_info, + self.list_stream_objects, + default_timeout=None, + client_info=client_info, ), self.start_backfill_job: gapic_v1.method.wrap_method( - self.start_backfill_job, default_timeout=None, client_info=client_info, + self.start_backfill_job, + default_timeout=None, + client_info=client_info, ), self.stop_backfill_job: gapic_v1.method.wrap_method( - self.stop_backfill_job, default_timeout=None, client_info=client_info, + self.stop_backfill_job, + default_timeout=None, + client_info=client_info, ), self.fetch_static_ips: gapic_v1.method.wrap_method( - self.fetch_static_ips, default_timeout=None, client_info=client_info, + self.fetch_static_ips, + default_timeout=None, + client_info=client_info, ), self.create_private_connection: gapic_v1.method.wrap_method( self.create_private_connection, @@ -209,25 +228,33 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.create_route: gapic_v1.method.wrap_method( - self.create_route, default_timeout=60.0, client_info=client_info, + self.create_route, + default_timeout=60.0, + client_info=client_info, ), self.get_route: gapic_v1.method.wrap_method( - self.get_route, default_timeout=None, client_info=client_info, + self.get_route, + default_timeout=None, + client_info=client_info, ), self.list_routes: gapic_v1.method.wrap_method( - self.list_routes, default_timeout=None, client_info=client_info, + self.list_routes, + default_timeout=None, + client_info=client_info, ), self.delete_route: gapic_v1.method.wrap_method( - self.delete_route, default_timeout=60.0, client_info=client_info, + self.delete_route, + default_timeout=60.0, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -496,5 +523,9 @@ def delete_route( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("DatastreamTransport",) diff --git a/google/cloud/datastream_v1/services/datastream/transports/grpc.py b/google/cloud/datastream_v1/services/datastream/transports/grpc.py index e9b279d..5e850e0 100644 --- a/google/cloud/datastream_v1/services/datastream/transports/grpc.py +++ b/google/cloud/datastream_v1/services/datastream/transports/grpc.py @@ -13,22 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import operations_v1 -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers, operations_v1 import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.longrunning import operations_pb2 # type: ignore import grpc # type: ignore -from google.cloud.datastream_v1.types import datastream -from google.cloud.datastream_v1.types import datastream_resources -from google.longrunning import operations_pb2 # type: ignore -from .base import DatastreamTransport, DEFAULT_CLIENT_INFO +from google.cloud.datastream_v1.types import datastream, datastream_resources + +from .base import DEFAULT_CLIENT_INFO, DatastreamTransport class DatastreamGrpcTransport(DatastreamTransport): @@ -228,8 +225,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -955,5 +951,9 @@ def delete_route( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("DatastreamGrpcTransport",) diff --git a/google/cloud/datastream_v1/services/datastream/transports/grpc_asyncio.py b/google/cloud/datastream_v1/services/datastream/transports/grpc_asyncio.py index 0e9c610..0cf950c 100644 --- a/google/cloud/datastream_v1/services/datastream/transports/grpc_asyncio.py +++ b/google/cloud/datastream_v1/services/datastream/transports/grpc_asyncio.py @@ -13,22 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async -from google.api_core import operations_v1 +from google.api_core import gapic_v1, grpc_helpers_async, operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.longrunning import operations_pb2 # type: ignore import grpc # type: ignore from grpc.experimental import aio # type: ignore -from google.cloud.datastream_v1.types import datastream -from google.cloud.datastream_v1.types import datastream_resources -from google.longrunning import operations_pb2 # type: ignore -from .base import DatastreamTransport, DEFAULT_CLIENT_INFO +from google.cloud.datastream_v1.types import datastream, datastream_resources + +from .base import DEFAULT_CLIENT_INFO, DatastreamTransport from .grpc import DatastreamGrpcTransport diff --git a/google/cloud/datastream_v1/types/datastream.py b/google/cloud/datastream_v1/types/datastream.py index 1e57cc0..d1136aa 100644 --- a/google/cloud/datastream_v1/types/datastream.py +++ b/google/cloud/datastream_v1/types/datastream.py @@ -13,12 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - -from google.cloud.datastream_v1.types import datastream_resources from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore +import proto # type: ignore +from google.cloud.datastream_v1.types import datastream_resources __protobuf__ = proto.module( package="google.cloud.datastream.v1", @@ -108,16 +107,31 @@ class DiscoverConnectionProfileRequest(proto.Message): This field is a member of `oneof`_ ``data_object``. """ - parent = proto.Field(proto.STRING, number=1,) + parent = proto.Field( + proto.STRING, + number=1, + ) connection_profile = proto.Field( proto.MESSAGE, number=200, oneof="target", message=datastream_resources.ConnectionProfile, ) - connection_profile_name = proto.Field(proto.STRING, number=201, oneof="target",) - full_hierarchy = proto.Field(proto.BOOL, number=3, oneof="hierarchy",) - hierarchy_depth = proto.Field(proto.INT32, number=4, oneof="hierarchy",) + connection_profile_name = proto.Field( + proto.STRING, + number=201, + oneof="target", + ) + full_hierarchy = proto.Field( + proto.BOOL, + number=3, + oneof="hierarchy", + ) + hierarchy_depth = proto.Field( + proto.INT32, + number=4, + oneof="hierarchy", + ) oracle_rdbms = proto.Field( proto.MESSAGE, number=100, @@ -183,9 +197,18 @@ class FetchStaticIpsRequest(proto.Message): call. will likely not be specified. """ - name = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class FetchStaticIpsResponse(proto.Message): @@ -204,8 +227,14 @@ class FetchStaticIpsResponse(proto.Message): def raw_page(self): return self - static_ips = proto.RepeatedField(proto.STRING, number=1,) - next_page_token = proto.Field(proto.STRING, number=2,) + static_ips = proto.RepeatedField( + proto.STRING, + number=1, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class ListConnectionProfilesRequest(proto.Message): @@ -234,11 +263,26 @@ class ListConnectionProfilesRequest(proto.Message): Order by fields for the result. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - filter = proto.Field(proto.STRING, number=4,) - order_by = proto.Field(proto.STRING, number=5,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + order_by = proto.Field( + proto.STRING, + number=5, + ) class ListConnectionProfilesResponse(proto.Message): @@ -260,10 +304,18 @@ def raw_page(self): return self connection_profiles = proto.RepeatedField( - proto.MESSAGE, number=1, message=datastream_resources.ConnectionProfile, + proto.MESSAGE, + number=1, + message=datastream_resources.ConnectionProfile, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + unreachable = proto.RepeatedField( + proto.STRING, + number=3, ) - next_page_token = proto.Field(proto.STRING, number=2,) - unreachable = proto.RepeatedField(proto.STRING, number=3,) class GetConnectionProfileRequest(proto.Message): @@ -275,7 +327,10 @@ class GetConnectionProfileRequest(proto.Message): resource to get. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateConnectionProfileRequest(proto.Message): @@ -317,14 +372,31 @@ class CreateConnectionProfileRequest(proto.Message): without validating it. """ - parent = proto.Field(proto.STRING, number=1,) - connection_profile_id = proto.Field(proto.STRING, number=2,) + parent = proto.Field( + proto.STRING, + number=1, + ) + connection_profile_id = proto.Field( + proto.STRING, + number=2, + ) connection_profile = proto.Field( - proto.MESSAGE, number=3, message=datastream_resources.ConnectionProfile, + proto.MESSAGE, + number=3, + message=datastream_resources.ConnectionProfile, + ) + request_id = proto.Field( + proto.STRING, + number=4, + ) + validate_only = proto.Field( + proto.BOOL, + number=5, + ) + force = proto.Field( + proto.BOOL, + number=6, ) - request_id = proto.Field(proto.STRING, number=4,) - validate_only = proto.Field(proto.BOOL, number=5,) - force = proto.Field(proto.BOOL, number=6,) class UpdateConnectionProfileRequest(proto.Message): @@ -368,14 +440,27 @@ class UpdateConnectionProfileRequest(proto.Message): """ update_mask = proto.Field( - proto.MESSAGE, number=1, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=1, + message=field_mask_pb2.FieldMask, ) connection_profile = proto.Field( - proto.MESSAGE, number=2, message=datastream_resources.ConnectionProfile, + proto.MESSAGE, + number=2, + message=datastream_resources.ConnectionProfile, + ) + request_id = proto.Field( + proto.STRING, + number=3, + ) + validate_only = proto.Field( + proto.BOOL, + number=4, + ) + force = proto.Field( + proto.BOOL, + number=5, ) - request_id = proto.Field(proto.STRING, number=3,) - validate_only = proto.Field(proto.BOOL, number=4,) - force = proto.Field(proto.BOOL, number=5,) class DeleteConnectionProfileRequest(proto.Message): @@ -405,8 +490,14 @@ class DeleteConnectionProfileRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1,) - request_id = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + request_id = proto.Field( + proto.STRING, + number=2, + ) class ListStreamsRequest(proto.Message): @@ -434,11 +525,26 @@ class ListStreamsRequest(proto.Message): Order by fields for the result. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - filter = proto.Field(proto.STRING, number=4,) - order_by = proto.Field(proto.STRING, number=5,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + order_by = proto.Field( + proto.STRING, + number=5, + ) class ListStreamsResponse(proto.Message): @@ -460,10 +566,18 @@ def raw_page(self): return self streams = proto.RepeatedField( - proto.MESSAGE, number=1, message=datastream_resources.Stream, + proto.MESSAGE, + number=1, + message=datastream_resources.Stream, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + unreachable = proto.RepeatedField( + proto.STRING, + number=3, ) - next_page_token = proto.Field(proto.STRING, number=2,) - unreachable = proto.RepeatedField(proto.STRING, number=3,) class GetStreamRequest(proto.Message): @@ -475,7 +589,10 @@ class GetStreamRequest(proto.Message): get. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateStreamRequest(proto.Message): @@ -515,12 +632,31 @@ class CreateStreamRequest(proto.Message): validating it. """ - parent = proto.Field(proto.STRING, number=1,) - stream_id = proto.Field(proto.STRING, number=2,) - stream = proto.Field(proto.MESSAGE, number=3, message=datastream_resources.Stream,) - request_id = proto.Field(proto.STRING, number=4,) - validate_only = proto.Field(proto.BOOL, number=5,) - force = proto.Field(proto.BOOL, number=6,) + parent = proto.Field( + proto.STRING, + number=1, + ) + stream_id = proto.Field( + proto.STRING, + number=2, + ) + stream = proto.Field( + proto.MESSAGE, + number=3, + message=datastream_resources.Stream, + ) + request_id = proto.Field( + proto.STRING, + number=4, + ) + validate_only = proto.Field( + proto.BOOL, + number=5, + ) + force = proto.Field( + proto.BOOL, + number=6, + ) class UpdateStreamRequest(proto.Message): @@ -564,12 +700,27 @@ class UpdateStreamRequest(proto.Message): """ update_mask = proto.Field( - proto.MESSAGE, number=1, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=1, + message=field_mask_pb2.FieldMask, + ) + stream = proto.Field( + proto.MESSAGE, + number=2, + message=datastream_resources.Stream, + ) + request_id = proto.Field( + proto.STRING, + number=3, + ) + validate_only = proto.Field( + proto.BOOL, + number=4, + ) + force = proto.Field( + proto.BOOL, + number=5, ) - stream = proto.Field(proto.MESSAGE, number=2, message=datastream_resources.Stream,) - request_id = proto.Field(proto.STRING, number=3,) - validate_only = proto.Field(proto.BOOL, number=4,) - force = proto.Field(proto.BOOL, number=5,) class DeleteStreamRequest(proto.Message): @@ -599,8 +750,14 @@ class DeleteStreamRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1,) - request_id = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + request_id = proto.Field( + proto.STRING, + number=2, + ) class GetStreamObjectRequest(proto.Message): @@ -612,7 +769,10 @@ class GetStreamObjectRequest(proto.Message): resource to get. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class LookupStreamObjectRequest(proto.Message): @@ -628,9 +788,14 @@ class LookupStreamObjectRequest(proto.Message): maps to the stream object. """ - parent = proto.Field(proto.STRING, number=1,) + parent = proto.Field( + proto.STRING, + number=1, + ) source_object_identifier = proto.Field( - proto.MESSAGE, number=2, message=datastream_resources.SourceObjectIdentifier, + proto.MESSAGE, + number=2, + message=datastream_resources.SourceObjectIdentifier, ) @@ -644,7 +809,10 @@ class StartBackfillJobRequest(proto.Message): resource to start a backfill job for. """ - object_ = proto.Field(proto.STRING, number=1,) + object_ = proto.Field( + proto.STRING, + number=1, + ) class StartBackfillJobResponse(proto.Message): @@ -658,7 +826,9 @@ class StartBackfillJobResponse(proto.Message): """ object_ = proto.Field( - proto.MESSAGE, number=1, message=datastream_resources.StreamObject, + proto.MESSAGE, + number=1, + message=datastream_resources.StreamObject, ) @@ -672,7 +842,10 @@ class StopBackfillJobRequest(proto.Message): resource to stop the backfill job for. """ - object_ = proto.Field(proto.STRING, number=1,) + object_ = proto.Field( + proto.STRING, + number=1, + ) class StopBackfillJobResponse(proto.Message): @@ -686,7 +859,9 @@ class StopBackfillJobResponse(proto.Message): """ object_ = proto.Field( - proto.MESSAGE, number=1, message=datastream_resources.StreamObject, + proto.MESSAGE, + number=1, + message=datastream_resources.StreamObject, ) @@ -711,9 +886,18 @@ class ListStreamObjectsRequest(proto.Message): provided the page token. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListStreamObjectsResponse(proto.Message): @@ -732,9 +916,14 @@ def raw_page(self): return self stream_objects = proto.RepeatedField( - proto.MESSAGE, number=1, message=datastream_resources.StreamObject, + proto.MESSAGE, + number=1, + message=datastream_resources.StreamObject, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class OperationMetadata(proto.Message): @@ -770,15 +959,40 @@ class OperationMetadata(proto.Message): if there are any. """ - create_time = proto.Field(proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - target = proto.Field(proto.STRING, number=3,) - verb = proto.Field(proto.STRING, number=4,) - status_message = proto.Field(proto.STRING, number=5,) - requested_cancellation = proto.Field(proto.BOOL, number=6,) - api_version = proto.Field(proto.STRING, number=7,) + create_time = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + target = proto.Field( + proto.STRING, + number=3, + ) + verb = proto.Field( + proto.STRING, + number=4, + ) + status_message = proto.Field( + proto.STRING, + number=5, + ) + requested_cancellation = proto.Field( + proto.BOOL, + number=6, + ) + api_version = proto.Field( + proto.STRING, + number=7, + ) validation_result = proto.Field( - proto.MESSAGE, number=8, message=datastream_resources.ValidationResult, + proto.MESSAGE, + number=8, + message=datastream_resources.ValidationResult, ) @@ -815,12 +1029,23 @@ class CreatePrivateConnectionRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - parent = proto.Field(proto.STRING, number=1,) - private_connection_id = proto.Field(proto.STRING, number=2,) + parent = proto.Field( + proto.STRING, + number=1, + ) + private_connection_id = proto.Field( + proto.STRING, + number=2, + ) private_connection = proto.Field( - proto.MESSAGE, number=3, message=datastream_resources.PrivateConnection, + proto.MESSAGE, + number=3, + message=datastream_resources.PrivateConnection, + ) + request_id = proto.Field( + proto.STRING, + number=4, ) - request_id = proto.Field(proto.STRING, number=4,) class ListPrivateConnectionsRequest(proto.Message): @@ -850,11 +1075,26 @@ class ListPrivateConnectionsRequest(proto.Message): Order by fields for the result. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - filter = proto.Field(proto.STRING, number=4,) - order_by = proto.Field(proto.STRING, number=5,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + order_by = proto.Field( + proto.STRING, + number=5, + ) class ListPrivateConnectionsResponse(proto.Message): @@ -877,10 +1117,18 @@ def raw_page(self): return self private_connections = proto.RepeatedField( - proto.MESSAGE, number=1, message=datastream_resources.PrivateConnection, + proto.MESSAGE, + number=1, + message=datastream_resources.PrivateConnection, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + unreachable = proto.RepeatedField( + proto.STRING, + number=3, ) - next_page_token = proto.Field(proto.STRING, number=2,) - unreachable = proto.RepeatedField(proto.STRING, number=3,) class DeletePrivateConnectionRequest(proto.Message): @@ -914,9 +1162,18 @@ class DeletePrivateConnectionRequest(proto.Message): be deleted. """ - name = proto.Field(proto.STRING, number=1,) - request_id = proto.Field(proto.STRING, number=2,) - force = proto.Field(proto.BOOL, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + request_id = proto.Field( + proto.STRING, + number=2, + ) + force = proto.Field( + proto.BOOL, + number=3, + ) class GetPrivateConnectionRequest(proto.Message): @@ -928,7 +1185,10 @@ class GetPrivateConnectionRequest(proto.Message): connectivity configuration to get. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateRouteRequest(proto.Message): @@ -962,10 +1222,23 @@ class CreateRouteRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - parent = proto.Field(proto.STRING, number=1,) - route_id = proto.Field(proto.STRING, number=2,) - route = proto.Field(proto.MESSAGE, number=3, message=datastream_resources.Route,) - request_id = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + route_id = proto.Field( + proto.STRING, + number=2, + ) + route = proto.Field( + proto.MESSAGE, + number=3, + message=datastream_resources.Route, + ) + request_id = proto.Field( + proto.STRING, + number=4, + ) class ListRoutesRequest(proto.Message): @@ -994,11 +1267,26 @@ class ListRoutesRequest(proto.Message): Order by fields for the result. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - filter = proto.Field(proto.STRING, number=4,) - order_by = proto.Field(proto.STRING, number=5,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + order_by = proto.Field( + proto.STRING, + number=5, + ) class ListRoutesResponse(proto.Message): @@ -1020,10 +1308,18 @@ def raw_page(self): return self routes = proto.RepeatedField( - proto.MESSAGE, number=1, message=datastream_resources.Route, + proto.MESSAGE, + number=1, + message=datastream_resources.Route, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + unreachable = proto.RepeatedField( + proto.STRING, + number=3, ) - next_page_token = proto.Field(proto.STRING, number=2,) - unreachable = proto.RepeatedField(proto.STRING, number=3,) class DeleteRouteRequest(proto.Message): @@ -1053,8 +1349,14 @@ class DeleteRouteRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1,) - request_id = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + request_id = proto.Field( + proto.STRING, + number=2, + ) class GetRouteRequest(proto.Message): @@ -1066,7 +1368,10 @@ class GetRouteRequest(proto.Message): get. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/datastream_v1/types/datastream_resources.py b/google/cloud/datastream_v1/types/datastream_resources.py index 71eab25..55e3eef 100644 --- a/google/cloud/datastream_v1/types/datastream_resources.py +++ b/google/cloud/datastream_v1/types/datastream_resources.py @@ -13,11 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.protobuf import duration_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.cloud.datastream.v1", @@ -75,16 +73,35 @@ class OracleProfile(proto.Message): Required. Password for the Oracle connection. database_service (str): Required. Database for the Oracle connection. - connection_attributes (Sequence[google.cloud.datastream_v1.types.OracleProfile.ConnectionAttributesEntry]): + connection_attributes (Mapping[str, str]): Connection string attributes """ - hostname = proto.Field(proto.STRING, number=1,) - port = proto.Field(proto.INT32, number=2,) - username = proto.Field(proto.STRING, number=3,) - password = proto.Field(proto.STRING, number=4,) - database_service = proto.Field(proto.STRING, number=5,) - connection_attributes = proto.MapField(proto.STRING, proto.STRING, number=6,) + hostname = proto.Field( + proto.STRING, + number=1, + ) + port = proto.Field( + proto.INT32, + number=2, + ) + username = proto.Field( + proto.STRING, + number=3, + ) + password = proto.Field( + proto.STRING, + number=4, + ) + database_service = proto.Field( + proto.STRING, + number=5, + ) + connection_attributes = proto.MapField( + proto.STRING, + proto.STRING, + number=6, + ) class MysqlProfile(proto.Message): @@ -105,11 +122,27 @@ class MysqlProfile(proto.Message): SSL configuration for the MySQL connection. """ - hostname = proto.Field(proto.STRING, number=1,) - port = proto.Field(proto.INT32, number=2,) - username = proto.Field(proto.STRING, number=3,) - password = proto.Field(proto.STRING, number=4,) - ssl_config = proto.Field(proto.MESSAGE, number=5, message="MysqlSslConfig",) + hostname = proto.Field( + proto.STRING, + number=1, + ) + port = proto.Field( + proto.INT32, + number=2, + ) + username = proto.Field( + proto.STRING, + number=3, + ) + password = proto.Field( + proto.STRING, + number=4, + ) + ssl_config = proto.Field( + proto.MESSAGE, + number=5, + message="MysqlSslConfig", + ) class GcsProfile(proto.Message): @@ -123,13 +156,18 @@ class GcsProfile(proto.Message): bucket. """ - bucket = proto.Field(proto.STRING, number=1,) - root_path = proto.Field(proto.STRING, number=2,) + bucket = proto.Field( + proto.STRING, + number=1, + ) + root_path = proto.Field( + proto.STRING, + number=2, + ) class StaticServiceIpConnectivity(proto.Message): - r"""Static IP address connectivity. - """ + r"""Static IP address connectivity.""" class ForwardSshTunnelConnectivity(proto.Message): @@ -159,11 +197,28 @@ class ForwardSshTunnelConnectivity(proto.Message): This field is a member of `oneof`_ ``authentication_method``. """ - hostname = proto.Field(proto.STRING, number=1,) - username = proto.Field(proto.STRING, number=2,) - port = proto.Field(proto.INT32, number=3,) - password = proto.Field(proto.STRING, number=100, oneof="authentication_method",) - private_key = proto.Field(proto.STRING, number=101, oneof="authentication_method",) + hostname = proto.Field( + proto.STRING, + number=1, + ) + username = proto.Field( + proto.STRING, + number=2, + ) + port = proto.Field( + proto.INT32, + number=3, + ) + password = proto.Field( + proto.STRING, + number=100, + oneof="authentication_method", + ) + private_key = proto.Field( + proto.STRING, + number=101, + oneof="authentication_method", + ) class VpcPeeringConfig(proto.Message): @@ -180,8 +235,14 @@ class VpcPeeringConfig(proto.Message): /29) """ - vpc = proto.Field(proto.STRING, number=1,) - subnet = proto.Field(proto.STRING, number=2,) + vpc = proto.Field( + proto.STRING, + number=1, + ) + subnet = proto.Field( + proto.STRING, + number=2, + ) class PrivateConnection(proto.Message): @@ -195,7 +256,7 @@ class PrivateConnection(proto.Message): Output only. The create time of the resource. update_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The update time of the resource. - labels (Sequence[google.cloud.datastream_v1.types.PrivateConnection.LabelsEntry]): + labels (Mapping[str, str]): Labels. display_name (str): Required. Display name. @@ -218,15 +279,43 @@ class State(proto.Enum): DELETING = 4 FAILED_TO_DELETE = 5 - name = proto.Field(proto.STRING, number=1,) - create_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - labels = proto.MapField(proto.STRING, proto.STRING, number=4,) - display_name = proto.Field(proto.STRING, number=5,) - state = proto.Field(proto.ENUM, number=6, enum=State,) - error = proto.Field(proto.MESSAGE, number=7, message="Error",) + name = proto.Field( + proto.STRING, + number=1, + ) + create_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + display_name = proto.Field( + proto.STRING, + number=5, + ) + state = proto.Field( + proto.ENUM, + number=6, + enum=State, + ) + error = proto.Field( + proto.MESSAGE, + number=7, + message="Error", + ) vpc_peering_config = proto.Field( - proto.MESSAGE, number=100, message="VpcPeeringConfig", + proto.MESSAGE, + number=100, + message="VpcPeeringConfig", ) @@ -240,7 +329,10 @@ class PrivateConnectivity(proto.Message): ``projects/{project}/locations/{location}/privateConnections/{name}`` """ - private_connection = proto.Field(proto.STRING, number=1,) + private_connection = proto.Field( + proto.STRING, + number=1, + ) class Route(proto.Message): @@ -254,7 +346,7 @@ class Route(proto.Message): Output only. The create time of the resource. update_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The update time of the resource. - labels (Sequence[google.cloud.datastream_v1.types.Route.LabelsEntry]): + labels (Mapping[str, str]): Labels. display_name (str): Required. Display name. @@ -264,13 +356,37 @@ class Route(proto.Message): Destination port for connection """ - name = proto.Field(proto.STRING, number=1,) - create_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - labels = proto.MapField(proto.STRING, proto.STRING, number=4,) - display_name = proto.Field(proto.STRING, number=5,) - destination_address = proto.Field(proto.STRING, number=6,) - destination_port = proto.Field(proto.INT32, number=7,) + name = proto.Field( + proto.STRING, + number=1, + ) + create_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + display_name = proto.Field( + proto.STRING, + number=5, + ) + destination_address = proto.Field( + proto.STRING, + number=6, + ) + destination_port = proto.Field( + proto.INT32, + number=7, + ) class MysqlSslConfig(proto.Message): @@ -301,12 +417,30 @@ class MysqlSslConfig(proto.Message): set. """ - client_key = proto.Field(proto.STRING, number=1,) - client_key_set = proto.Field(proto.BOOL, number=2,) - client_certificate = proto.Field(proto.STRING, number=3,) - client_certificate_set = proto.Field(proto.BOOL, number=4,) - ca_certificate = proto.Field(proto.STRING, number=5,) - ca_certificate_set = proto.Field(proto.BOOL, number=6,) + client_key = proto.Field( + proto.STRING, + number=1, + ) + client_key_set = proto.Field( + proto.BOOL, + number=2, + ) + client_certificate = proto.Field( + proto.STRING, + number=3, + ) + client_certificate_set = proto.Field( + proto.BOOL, + number=4, + ) + ca_certificate = proto.Field( + proto.STRING, + number=5, + ) + ca_certificate_set = proto.Field( + proto.BOOL, + number=6, + ) class ConnectionProfile(proto.Message): @@ -327,7 +461,7 @@ class ConnectionProfile(proto.Message): Output only. The create time of the resource. update_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The update time of the resource. - labels (Sequence[google.cloud.datastream_v1.types.ConnectionProfile.LabelsEntry]): + labels (Mapping[str, str]): Labels. display_name (str): Required. Display name. @@ -358,19 +492,46 @@ class ConnectionProfile(proto.Message): This field is a member of `oneof`_ ``connectivity``. """ - name = proto.Field(proto.STRING, number=1,) - create_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - labels = proto.MapField(proto.STRING, proto.STRING, number=4,) - display_name = proto.Field(proto.STRING, number=5,) + name = proto.Field( + proto.STRING, + number=1, + ) + create_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + display_name = proto.Field( + proto.STRING, + number=5, + ) oracle_profile = proto.Field( - proto.MESSAGE, number=100, oneof="profile", message="OracleProfile", + proto.MESSAGE, + number=100, + oneof="profile", + message="OracleProfile", ) gcs_profile = proto.Field( - proto.MESSAGE, number=101, oneof="profile", message="GcsProfile", + proto.MESSAGE, + number=101, + oneof="profile", + message="GcsProfile", ) mysql_profile = proto.Field( - proto.MESSAGE, number=102, oneof="profile", message="MysqlProfile", + proto.MESSAGE, + number=102, + oneof="profile", + message="MysqlProfile", ) static_service_ip_connectivity = proto.Field( proto.MESSAGE, @@ -385,7 +546,10 @@ class ConnectionProfile(proto.Message): message="ForwardSshTunnelConnectivity", ) private_connectivity = proto.Field( - proto.MESSAGE, number=202, oneof="connectivity", message="PrivateConnectivity", + proto.MESSAGE, + number=202, + oneof="connectivity", + message="PrivateConnectivity", ) @@ -416,15 +580,42 @@ class OracleColumn(proto.Message): table. """ - column = proto.Field(proto.STRING, number=1,) - data_type = proto.Field(proto.STRING, number=2,) - length = proto.Field(proto.INT32, number=3,) - precision = proto.Field(proto.INT32, number=4,) - scale = proto.Field(proto.INT32, number=5,) - encoding = proto.Field(proto.STRING, number=6,) - primary_key = proto.Field(proto.BOOL, number=7,) - nullable = proto.Field(proto.BOOL, number=8,) - ordinal_position = proto.Field(proto.INT32, number=9,) + column = proto.Field( + proto.STRING, + number=1, + ) + data_type = proto.Field( + proto.STRING, + number=2, + ) + length = proto.Field( + proto.INT32, + number=3, + ) + precision = proto.Field( + proto.INT32, + number=4, + ) + scale = proto.Field( + proto.INT32, + number=5, + ) + encoding = proto.Field( + proto.STRING, + number=6, + ) + primary_key = proto.Field( + proto.BOOL, + number=7, + ) + nullable = proto.Field( + proto.BOOL, + number=8, + ) + ordinal_position = proto.Field( + proto.INT32, + number=9, + ) class OracleTable(proto.Message): @@ -439,9 +630,14 @@ class OracleTable(proto.Message): lists, includes/excludes everything. """ - table = proto.Field(proto.STRING, number=1,) + table = proto.Field( + proto.STRING, + number=1, + ) oracle_columns = proto.RepeatedField( - proto.MESSAGE, number=2, message="OracleColumn", + proto.MESSAGE, + number=2, + message="OracleColumn", ) @@ -455,8 +651,15 @@ class OracleSchema(proto.Message): Tables in the schema. """ - schema = proto.Field(proto.STRING, number=1,) - oracle_tables = proto.RepeatedField(proto.MESSAGE, number=2, message="OracleTable",) + schema = proto.Field( + proto.STRING, + number=1, + ) + oracle_tables = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="OracleTable", + ) class OracleRdbms(proto.Message): @@ -469,7 +672,9 @@ class OracleRdbms(proto.Message): """ oracle_schemas = proto.RepeatedField( - proto.MESSAGE, number=1, message="OracleSchema", + proto.MESSAGE, + number=1, + message="OracleSchema", ) @@ -483,8 +688,16 @@ class OracleSourceConfig(proto.Message): Oracle objects to exclude from the stream. """ - include_objects = proto.Field(proto.MESSAGE, number=1, message="OracleRdbms",) - exclude_objects = proto.Field(proto.MESSAGE, number=2, message="OracleRdbms",) + include_objects = proto.Field( + proto.MESSAGE, + number=1, + message="OracleRdbms", + ) + exclude_objects = proto.Field( + proto.MESSAGE, + number=2, + message="OracleRdbms", + ) class MysqlColumn(proto.Message): @@ -512,13 +725,34 @@ class MysqlColumn(proto.Message): table. """ - column = proto.Field(proto.STRING, number=1,) - data_type = proto.Field(proto.STRING, number=2,) - length = proto.Field(proto.INT32, number=3,) - collation = proto.Field(proto.STRING, number=4,) - primary_key = proto.Field(proto.BOOL, number=5,) - nullable = proto.Field(proto.BOOL, number=6,) - ordinal_position = proto.Field(proto.INT32, number=7,) + column = proto.Field( + proto.STRING, + number=1, + ) + data_type = proto.Field( + proto.STRING, + number=2, + ) + length = proto.Field( + proto.INT32, + number=3, + ) + collation = proto.Field( + proto.STRING, + number=4, + ) + primary_key = proto.Field( + proto.BOOL, + number=5, + ) + nullable = proto.Field( + proto.BOOL, + number=6, + ) + ordinal_position = proto.Field( + proto.INT32, + number=7, + ) class MysqlTable(proto.Message): @@ -533,8 +767,15 @@ class MysqlTable(proto.Message): lists, includes/excludes everything. """ - table = proto.Field(proto.STRING, number=1,) - mysql_columns = proto.RepeatedField(proto.MESSAGE, number=2, message="MysqlColumn",) + table = proto.Field( + proto.STRING, + number=1, + ) + mysql_columns = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="MysqlColumn", + ) class MysqlDatabase(proto.Message): @@ -547,8 +788,15 @@ class MysqlDatabase(proto.Message): Tables in the database. """ - database = proto.Field(proto.STRING, number=1,) - mysql_tables = proto.RepeatedField(proto.MESSAGE, number=2, message="MysqlTable",) + database = proto.Field( + proto.STRING, + number=1, + ) + mysql_tables = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="MysqlTable", + ) class MysqlRdbms(proto.Message): @@ -560,7 +808,9 @@ class MysqlRdbms(proto.Message): """ mysql_databases = proto.RepeatedField( - proto.MESSAGE, number=1, message="MysqlDatabase", + proto.MESSAGE, + number=1, + message="MysqlDatabase", ) @@ -574,8 +824,16 @@ class MysqlSourceConfig(proto.Message): MySQL objects to exclude from the stream. """ - include_objects = proto.Field(proto.MESSAGE, number=1, message="MysqlRdbms",) - exclude_objects = proto.Field(proto.MESSAGE, number=2, message="MysqlRdbms",) + include_objects = proto.Field( + proto.MESSAGE, + number=1, + message="MysqlRdbms", + ) + exclude_objects = proto.Field( + proto.MESSAGE, + number=2, + message="MysqlRdbms", + ) class SourceConfig(proto.Message): @@ -602,7 +860,10 @@ class SourceConfig(proto.Message): This field is a member of `oneof`_ ``source_stream_config``. """ - source_connection_profile = proto.Field(proto.STRING, number=1,) + source_connection_profile = proto.Field( + proto.STRING, + number=1, + ) oracle_source_config = proto.Field( proto.MESSAGE, number=100, @@ -618,8 +879,7 @@ class SourceConfig(proto.Message): class AvroFileFormat(proto.Message): - r"""AVRO file format configuration. - """ + r"""AVRO file format configuration.""" class JsonFileFormat(proto.Message): @@ -644,8 +904,16 @@ class JsonCompression(proto.Enum): NO_COMPRESSION = 1 GZIP = 2 - schema_file_format = proto.Field(proto.ENUM, number=1, enum=SchemaFileFormat,) - compression = proto.Field(proto.ENUM, number=2, enum=JsonCompression,) + schema_file_format = proto.Field( + proto.ENUM, + number=1, + enum=SchemaFileFormat, + ) + compression = proto.Field( + proto.ENUM, + number=2, + enum=JsonCompression, + ) class GcsDestinationConfig(proto.Message): @@ -679,16 +947,30 @@ class GcsDestinationConfig(proto.Message): This field is a member of `oneof`_ ``file_format``. """ - path = proto.Field(proto.STRING, number=1,) - file_rotation_mb = proto.Field(proto.INT32, number=2,) + path = proto.Field( + proto.STRING, + number=1, + ) + file_rotation_mb = proto.Field( + proto.INT32, + number=2, + ) file_rotation_interval = proto.Field( - proto.MESSAGE, number=3, message=duration_pb2.Duration, + proto.MESSAGE, + number=3, + message=duration_pb2.Duration, ) avro_file_format = proto.Field( - proto.MESSAGE, number=100, oneof="file_format", message="AvroFileFormat", + proto.MESSAGE, + number=100, + oneof="file_format", + message="AvroFileFormat", ) json_file_format = proto.Field( - proto.MESSAGE, number=101, oneof="file_format", message="JsonFileFormat", + proto.MESSAGE, + number=101, + oneof="file_format", + message="JsonFileFormat", ) @@ -708,7 +990,10 @@ class DestinationConfig(proto.Message): This field is a member of `oneof`_ ``destination_stream_config``. """ - destination_connection_profile = proto.Field(proto.STRING, number=1,) + destination_connection_profile = proto.Field( + proto.STRING, + number=1, + ) gcs_destination_config = proto.Field( proto.MESSAGE, number=100, @@ -736,7 +1021,7 @@ class Stream(proto.Message): update_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The last update time of the stream. - labels (Sequence[google.cloud.datastream_v1.types.Stream.LabelsEntry]): + labels (Mapping[str, str]): Labels. display_name (str): Required. Display name. @@ -807,10 +1092,16 @@ class BackfillAllStrategy(proto.Message): """ oracle_excluded_objects = proto.Field( - proto.MESSAGE, number=1, oneof="excluded_objects", message="OracleRdbms", + proto.MESSAGE, + number=1, + oneof="excluded_objects", + message="OracleRdbms", ) mysql_excluded_objects = proto.Field( - proto.MESSAGE, number=2, oneof="excluded_objects", message="MysqlRdbms", + proto.MESSAGE, + number=2, + oneof="excluded_objects", + message="MysqlRdbms", ) class BackfillNoneStrategy(proto.Message): @@ -819,16 +1110,44 @@ class BackfillNoneStrategy(proto.Message): """ - name = proto.Field(proto.STRING, number=1,) - create_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - labels = proto.MapField(proto.STRING, proto.STRING, number=4,) - display_name = proto.Field(proto.STRING, number=5,) - source_config = proto.Field(proto.MESSAGE, number=6, message="SourceConfig",) + name = proto.Field( + proto.STRING, + number=1, + ) + create_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + display_name = proto.Field( + proto.STRING, + number=5, + ) + source_config = proto.Field( + proto.MESSAGE, + number=6, + message="SourceConfig", + ) destination_config = proto.Field( - proto.MESSAGE, number=7, message="DestinationConfig", + proto.MESSAGE, + number=7, + message="DestinationConfig", + ) + state = proto.Field( + proto.ENUM, + number=8, + enum=State, ) - state = proto.Field(proto.ENUM, number=8, enum=State,) backfill_all = proto.Field( proto.MESSAGE, number=101, @@ -841,9 +1160,15 @@ class BackfillNoneStrategy(proto.Message): oneof="backfill_strategy", message=BackfillNoneStrategy, ) - errors = proto.RepeatedField(proto.MESSAGE, number=9, message="Error",) + errors = proto.RepeatedField( + proto.MESSAGE, + number=9, + message="Error", + ) customer_managed_encryption_key = proto.Field( - proto.STRING, number=10, optional=True, + proto.STRING, + number=10, + optional=True, ) @@ -869,14 +1194,38 @@ class StreamObject(proto.Message): The object identifier in the data source. """ - name = proto.Field(proto.STRING, number=1,) - create_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - display_name = proto.Field(proto.STRING, number=5,) - errors = proto.RepeatedField(proto.MESSAGE, number=6, message="Error",) - backfill_job = proto.Field(proto.MESSAGE, number=7, message="BackfillJob",) + name = proto.Field( + proto.STRING, + number=1, + ) + create_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + display_name = proto.Field( + proto.STRING, + number=5, + ) + errors = proto.RepeatedField( + proto.MESSAGE, + number=6, + message="Error", + ) + backfill_job = proto.Field( + proto.MESSAGE, + number=7, + message="BackfillJob", + ) source_object = proto.Field( - proto.MESSAGE, number=8, message="SourceObjectIdentifier", + proto.MESSAGE, + number=8, + message="SourceObjectIdentifier", ) @@ -911,8 +1260,14 @@ class OracleObjectIdentifier(proto.Message): Required. The table name. """ - schema = proto.Field(proto.STRING, number=1,) - table = proto.Field(proto.STRING, number=2,) + schema = proto.Field( + proto.STRING, + number=1, + ) + table = proto.Field( + proto.STRING, + number=2, + ) class MysqlObjectIdentifier(proto.Message): r"""Mysql data source object identifier. @@ -924,8 +1279,14 @@ class MysqlObjectIdentifier(proto.Message): Required. The table name. """ - database = proto.Field(proto.STRING, number=1,) - table = proto.Field(proto.STRING, number=2,) + database = proto.Field( + proto.STRING, + number=1, + ) + table = proto.Field( + proto.STRING, + number=2, + ) oracle_identifier = proto.Field( proto.MESSAGE, @@ -975,15 +1336,31 @@ class Trigger(proto.Enum): AUTOMATIC = 1 MANUAL = 2 - state = proto.Field(proto.ENUM, number=1, enum=State,) - trigger = proto.Field(proto.ENUM, number=2, enum=Trigger,) + state = proto.Field( + proto.ENUM, + number=1, + enum=State, + ) + trigger = proto.Field( + proto.ENUM, + number=2, + enum=Trigger, + ) last_start_time = proto.Field( - proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, ) last_end_time = proto.Field( - proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) + errors = proto.RepeatedField( + proto.MESSAGE, + number=5, + message="Error", ) - errors = proto.RepeatedField(proto.MESSAGE, number=5, message="Error",) class Error(proto.Message): @@ -1002,15 +1379,32 @@ class Error(proto.Message): the error that occurred. error_time (google.protobuf.timestamp_pb2.Timestamp): The time when the error occurred. - details (Sequence[google.cloud.datastream_v1.types.Error.DetailsEntry]): + details (Mapping[str, str]): Additional information about the error. """ - reason = proto.Field(proto.STRING, number=1,) - error_uuid = proto.Field(proto.STRING, number=2,) - message = proto.Field(proto.STRING, number=3,) - error_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) - details = proto.MapField(proto.STRING, proto.STRING, number=5,) + reason = proto.Field( + proto.STRING, + number=1, + ) + error_uuid = proto.Field( + proto.STRING, + number=2, + ) + message = proto.Field( + proto.STRING, + number=3, + ) + error_time = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) + details = proto.MapField( + proto.STRING, + proto.STRING, + number=5, + ) class ValidationResult(proto.Message): @@ -1022,7 +1416,11 @@ class ValidationResult(proto.Message): as well as not executed validations). """ - validations = proto.RepeatedField(proto.MESSAGE, number=1, message="Validation",) + validations = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Validation", + ) class Validation(proto.Message): @@ -1046,10 +1444,24 @@ class State(proto.Enum): FAILED = 2 PASSED = 3 - description = proto.Field(proto.STRING, number=1,) - state = proto.Field(proto.ENUM, number=2, enum=State,) - message = proto.RepeatedField(proto.MESSAGE, number=3, message="ValidationMessage",) - code = proto.Field(proto.STRING, number=4,) + description = proto.Field( + proto.STRING, + number=1, + ) + state = proto.Field( + proto.ENUM, + number=2, + enum=State, + ) + message = proto.RepeatedField( + proto.MESSAGE, + number=3, + message="ValidationMessage", + ) + code = proto.Field( + proto.STRING, + number=4, + ) class ValidationMessage(proto.Message): @@ -1060,7 +1472,7 @@ class ValidationMessage(proto.Message): The result of the validation. level (google.cloud.datastream_v1.types.ValidationMessage.Level): Message severity level (warning or error). - metadata (Sequence[google.cloud.datastream_v1.types.ValidationMessage.MetadataEntry]): + metadata (Mapping[str, str]): Additional metadata related to the result. code (str): A custom code identifying this specific @@ -1073,10 +1485,24 @@ class Level(proto.Enum): WARNING = 1 ERROR = 2 - message = proto.Field(proto.STRING, number=1,) - level = proto.Field(proto.ENUM, number=2, enum=Level,) - metadata = proto.MapField(proto.STRING, proto.STRING, number=3,) - code = proto.Field(proto.STRING, number=4,) + message = proto.Field( + proto.STRING, + number=1, + ) + level = proto.Field( + proto.ENUM, + number=2, + enum=Level, + ) + metadata = proto.MapField( + proto.STRING, + proto.STRING, + number=3, + ) + code = proto.Field( + proto.STRING, + number=4, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/datastream_v1alpha1/__init__.py b/google/cloud/datastream_v1alpha1/__init__.py index e143d2e..f668c28 100644 --- a/google/cloud/datastream_v1alpha1/__init__.py +++ b/google/cloud/datastream_v1alpha1/__init__.py @@ -14,72 +14,74 @@ # limitations under the License. # -from .services.datastream import DatastreamClient -from .services.datastream import DatastreamAsyncClient - -from .types.datastream import CreateConnectionProfileRequest -from .types.datastream import CreatePrivateConnectionRequest -from .types.datastream import CreateRouteRequest -from .types.datastream import CreateStreamRequest -from .types.datastream import DeleteConnectionProfileRequest -from .types.datastream import DeletePrivateConnectionRequest -from .types.datastream import DeleteRouteRequest -from .types.datastream import DeleteStreamRequest -from .types.datastream import DiscoverConnectionProfileRequest -from .types.datastream import DiscoverConnectionProfileResponse -from .types.datastream import FetchErrorsRequest -from .types.datastream import FetchErrorsResponse -from .types.datastream import FetchStaticIpsRequest -from .types.datastream import FetchStaticIpsResponse -from .types.datastream import GetConnectionProfileRequest -from .types.datastream import GetPrivateConnectionRequest -from .types.datastream import GetRouteRequest -from .types.datastream import GetStreamRequest -from .types.datastream import ListConnectionProfilesRequest -from .types.datastream import ListConnectionProfilesResponse -from .types.datastream import ListPrivateConnectionsRequest -from .types.datastream import ListPrivateConnectionsResponse -from .types.datastream import ListRoutesRequest -from .types.datastream import ListRoutesResponse -from .types.datastream import ListStreamsRequest -from .types.datastream import ListStreamsResponse -from .types.datastream import OperationMetadata -from .types.datastream import UpdateConnectionProfileRequest -from .types.datastream import UpdateStreamRequest -from .types.datastream_resources import AvroFileFormat -from .types.datastream_resources import ConnectionProfile -from .types.datastream_resources import DestinationConfig -from .types.datastream_resources import Error -from .types.datastream_resources import ForwardSshTunnelConnectivity -from .types.datastream_resources import GcsDestinationConfig -from .types.datastream_resources import GcsProfile -from .types.datastream_resources import JsonFileFormat -from .types.datastream_resources import MysqlColumn -from .types.datastream_resources import MysqlDatabase -from .types.datastream_resources import MysqlProfile -from .types.datastream_resources import MysqlRdbms -from .types.datastream_resources import MysqlSourceConfig -from .types.datastream_resources import MysqlSslConfig -from .types.datastream_resources import MysqlTable -from .types.datastream_resources import NoConnectivitySettings -from .types.datastream_resources import OracleColumn -from .types.datastream_resources import OracleProfile -from .types.datastream_resources import OracleRdbms -from .types.datastream_resources import OracleSchema -from .types.datastream_resources import OracleSourceConfig -from .types.datastream_resources import OracleTable -from .types.datastream_resources import PrivateConnection -from .types.datastream_resources import PrivateConnectivity -from .types.datastream_resources import Route -from .types.datastream_resources import SourceConfig -from .types.datastream_resources import StaticServiceIpConnectivity -from .types.datastream_resources import Stream -from .types.datastream_resources import Validation -from .types.datastream_resources import ValidationMessage -from .types.datastream_resources import ValidationResult -from .types.datastream_resources import VpcPeeringConfig -from .types.datastream_resources import GcsFileFormat -from .types.datastream_resources import SchemaFileFormat +from .services.datastream import DatastreamAsyncClient, DatastreamClient +from .types.datastream import ( + CreateConnectionProfileRequest, + CreatePrivateConnectionRequest, + CreateRouteRequest, + CreateStreamRequest, + DeleteConnectionProfileRequest, + DeletePrivateConnectionRequest, + DeleteRouteRequest, + DeleteStreamRequest, + DiscoverConnectionProfileRequest, + DiscoverConnectionProfileResponse, + FetchErrorsRequest, + FetchErrorsResponse, + FetchStaticIpsRequest, + FetchStaticIpsResponse, + GetConnectionProfileRequest, + GetPrivateConnectionRequest, + GetRouteRequest, + GetStreamRequest, + ListConnectionProfilesRequest, + ListConnectionProfilesResponse, + ListPrivateConnectionsRequest, + ListPrivateConnectionsResponse, + ListRoutesRequest, + ListRoutesResponse, + ListStreamsRequest, + ListStreamsResponse, + OperationMetadata, + UpdateConnectionProfileRequest, + UpdateStreamRequest, +) +from .types.datastream_resources import ( + AvroFileFormat, + ConnectionProfile, + DestinationConfig, + Error, + ForwardSshTunnelConnectivity, + GcsDestinationConfig, + GcsFileFormat, + GcsProfile, + JsonFileFormat, + MysqlColumn, + MysqlDatabase, + MysqlProfile, + MysqlRdbms, + MysqlSourceConfig, + MysqlSslConfig, + MysqlTable, + NoConnectivitySettings, + OracleColumn, + OracleProfile, + OracleRdbms, + OracleSchema, + OracleSourceConfig, + OracleTable, + PrivateConnection, + PrivateConnectivity, + Route, + SchemaFileFormat, + SourceConfig, + StaticServiceIpConnectivity, + Stream, + Validation, + ValidationMessage, + ValidationResult, + VpcPeeringConfig, +) __all__ = ( "DatastreamAsyncClient", diff --git a/google/cloud/datastream_v1alpha1/services/datastream/__init__.py b/google/cloud/datastream_v1alpha1/services/datastream/__init__.py index 0e6c29f..2636cbc 100644 --- a/google/cloud/datastream_v1alpha1/services/datastream/__init__.py +++ b/google/cloud/datastream_v1alpha1/services/datastream/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import DatastreamClient from .async_client import DatastreamAsyncClient +from .client import DatastreamClient __all__ = ( "DatastreamClient", diff --git a/google/cloud/datastream_v1alpha1/services/datastream/async_client.py b/google/cloud/datastream_v1alpha1/services/datastream/async_client.py index e9e829c..6a5c270 100644 --- a/google/cloud/datastream_v1alpha1/services/datastream/async_client.py +++ b/google/cloud/datastream_v1alpha1/services/datastream/async_client.py @@ -16,15 +16,15 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -33,15 +33,16 @@ from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore -from google.cloud.datastream_v1alpha1.services.datastream import pagers -from google.cloud.datastream_v1alpha1.types import datastream -from google.cloud.datastream_v1alpha1.types import datastream_resources from google.protobuf import empty_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import DatastreamTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import DatastreamGrpcAsyncIOTransport + +from google.cloud.datastream_v1alpha1.services.datastream import pagers +from google.cloud.datastream_v1alpha1.types import datastream, datastream_resources + from .client import DatastreamClient +from .transports.base import DEFAULT_CLIENT_INFO, DatastreamTransport +from .transports.grpc_asyncio import DatastreamGrpcAsyncIOTransport class DatastreamAsyncClient: @@ -224,14 +225,13 @@ async def list_connection_profiles( r"""Use this method to list connection profiles created in a project and location. - .. code-block:: python from google.cloud import datastream_v1alpha1 - def sample_list_connection_profiles(): + async def sample_list_connection_profiles(): # Create a client - client = datastream_v1alpha1.DatastreamClient() + client = datastream_v1alpha1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1alpha1.ListConnectionProfilesRequest( @@ -242,7 +242,7 @@ def sample_list_connection_profiles(): page_result = client.list_connection_profiles(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -300,12 +300,20 @@ def sample_list_connection_profiles(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListConnectionProfilesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -323,14 +331,13 @@ async def get_connection_profile( r"""Use this method to get details about a connection profile. - .. code-block:: python from google.cloud import datastream_v1alpha1 - def sample_get_connection_profile(): + async def sample_get_connection_profile(): # Create a client - client = datastream_v1alpha1.DatastreamClient() + client = datastream_v1alpha1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1alpha1.GetConnectionProfileRequest( @@ -338,7 +345,7 @@ def sample_get_connection_profile(): ) # Make the request - response = client.get_connection_profile(request=request) + response = await client.get_connection_profile(request=request) # Handle the response print(response) @@ -395,7 +402,12 @@ def sample_get_connection_profile(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -414,14 +426,13 @@ async def create_connection_profile( r"""Use this method to create a connection profile in a project and location. - .. code-block:: python from google.cloud import datastream_v1alpha1 - def sample_create_connection_profile(): + async def sample_create_connection_profile(): # Create a client - client = datastream_v1alpha1.DatastreamClient() + client = datastream_v1alpha1.DatastreamAsyncClient() # Initialize request argument(s) connection_profile = datastream_v1alpha1.ConnectionProfile() @@ -442,7 +453,7 @@ def sample_create_connection_profile(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -521,7 +532,12 @@ def sample_create_connection_profile(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -547,14 +563,13 @@ async def update_connection_profile( r"""Use this method to update the parameters of a connection profile. - .. code-block:: python from google.cloud import datastream_v1alpha1 - def sample_update_connection_profile(): + async def sample_update_connection_profile(): # Create a client - client = datastream_v1alpha1.DatastreamClient() + client = datastream_v1alpha1.DatastreamAsyncClient() # Initialize request argument(s) connection_profile = datastream_v1alpha1.ConnectionProfile() @@ -573,7 +588,7 @@ def sample_update_connection_profile(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -650,7 +665,12 @@ def sample_update_connection_profile(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -678,9 +698,9 @@ async def delete_connection_profile( from google.cloud import datastream_v1alpha1 - def sample_delete_connection_profile(): + async def sample_delete_connection_profile(): # Create a client - client = datastream_v1alpha1.DatastreamClient() + client = datastream_v1alpha1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1alpha1.DeleteConnectionProfileRequest( @@ -692,7 +712,7 @@ def sample_delete_connection_profile(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -764,7 +784,12 @@ def sample_delete_connection_profile(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -791,14 +816,13 @@ async def discover_connection_profile( returns children data objects under a parent data object that's optionally supplied in the request. - .. code-block:: python from google.cloud import datastream_v1alpha1 - def sample_discover_connection_profile(): + async def sample_discover_connection_profile(): # Create a client - client = datastream_v1alpha1.DatastreamClient() + client = datastream_v1alpha1.DatastreamAsyncClient() # Initialize request argument(s) connection_profile = datastream_v1alpha1.ConnectionProfile() @@ -815,7 +839,7 @@ def sample_discover_connection_profile(): ) # Make the request - response = client.discover_connection_profile(request=request) + response = await client.discover_connection_profile(request=request) # Handle the response print(response) @@ -852,7 +876,12 @@ def sample_discover_connection_profile(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -869,14 +898,13 @@ async def list_streams( r"""Use this method to list streams in a project and location. - .. code-block:: python from google.cloud import datastream_v1alpha1 - def sample_list_streams(): + async def sample_list_streams(): # Create a client - client = datastream_v1alpha1.DatastreamClient() + client = datastream_v1alpha1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1alpha1.ListStreamsRequest( @@ -887,7 +915,7 @@ def sample_list_streams(): page_result = client.list_streams(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -945,12 +973,20 @@ def sample_list_streams(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListStreamsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -971,9 +1007,9 @@ async def get_stream( from google.cloud import datastream_v1alpha1 - def sample_get_stream(): + async def sample_get_stream(): # Create a client - client = datastream_v1alpha1.DatastreamClient() + client = datastream_v1alpha1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1alpha1.GetStreamRequest( @@ -981,7 +1017,7 @@ def sample_get_stream(): ) # Make the request - response = client.get_stream(request=request) + response = await client.get_stream(request=request) # Handle the response print(response) @@ -1038,7 +1074,12 @@ def sample_get_stream(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1060,9 +1101,9 @@ async def create_stream( from google.cloud import datastream_v1alpha1 - def sample_create_stream(): + async def sample_create_stream(): # Create a client - client = datastream_v1alpha1.DatastreamClient() + client = datastream_v1alpha1.DatastreamAsyncClient() # Initialize request argument(s) stream = datastream_v1alpha1.Stream() @@ -1081,7 +1122,7 @@ def sample_create_stream(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1158,7 +1199,12 @@ def sample_create_stream(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1184,14 +1230,13 @@ async def update_stream( r"""Use this method to update the configuration of a stream. - .. code-block:: python from google.cloud import datastream_v1alpha1 - def sample_update_stream(): + async def sample_update_stream(): # Create a client - client = datastream_v1alpha1.DatastreamClient() + client = datastream_v1alpha1.DatastreamAsyncClient() # Initialize request argument(s) stream = datastream_v1alpha1.Stream() @@ -1208,7 +1253,7 @@ def sample_update_stream(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1284,7 +1329,12 @@ def sample_update_stream(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1312,9 +1362,9 @@ async def delete_stream( from google.cloud import datastream_v1alpha1 - def sample_delete_stream(): + async def sample_delete_stream(): # Create a client - client = datastream_v1alpha1.DatastreamClient() + client = datastream_v1alpha1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1alpha1.DeleteStreamRequest( @@ -1326,7 +1376,7 @@ def sample_delete_stream(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1398,7 +1448,12 @@ def sample_delete_stream(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1422,14 +1477,13 @@ async def fetch_errors( r"""Use this method to fetch any errors associated with a stream. - .. code-block:: python from google.cloud import datastream_v1alpha1 - def sample_fetch_errors(): + async def sample_fetch_errors(): # Create a client - client = datastream_v1alpha1.DatastreamClient() + client = datastream_v1alpha1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1alpha1.FetchErrorsRequest( @@ -1440,7 +1494,7 @@ def sample_fetch_errors(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1482,7 +1536,12 @@ def sample_fetch_errors(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1509,14 +1568,13 @@ async def fetch_static_ips( children data objects under a parent data object that's optionally supplied in the request. - .. code-block:: python from google.cloud import datastream_v1alpha1 - def sample_fetch_static_ips(): + async def sample_fetch_static_ips(): # Create a client - client = datastream_v1alpha1.DatastreamClient() + client = datastream_v1alpha1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1alpha1.FetchStaticIpsRequest( @@ -1527,7 +1585,7 @@ def sample_fetch_static_ips(): page_result = client.fetch_static_ips(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -1588,12 +1646,20 @@ def sample_fetch_static_ips(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.FetchStaticIpsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1613,14 +1679,13 @@ async def create_private_connection( r"""Use this method to create a private connectivity configuration. - .. code-block:: python from google.cloud import datastream_v1alpha1 - def sample_create_private_connection(): + async def sample_create_private_connection(): # Create a client - client = datastream_v1alpha1.DatastreamClient() + client = datastream_v1alpha1.DatastreamAsyncClient() # Initialize request argument(s) private_connection = datastream_v1alpha1.PrivateConnection() @@ -1637,7 +1702,7 @@ def sample_create_private_connection(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1716,7 +1781,12 @@ def sample_create_private_connection(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1741,14 +1811,13 @@ async def get_private_connection( r"""Use this method to get details about a private connectivity configuration. - .. code-block:: python from google.cloud import datastream_v1alpha1 - def sample_get_private_connection(): + async def sample_get_private_connection(): # Create a client - client = datastream_v1alpha1.DatastreamClient() + client = datastream_v1alpha1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1alpha1.GetPrivateConnectionRequest( @@ -1756,7 +1825,7 @@ def sample_get_private_connection(): ) # Make the request - response = client.get_private_connection(request=request) + response = await client.get_private_connection(request=request) # Handle the response print(response) @@ -1817,7 +1886,12 @@ def sample_get_private_connection(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1834,14 +1908,13 @@ async def list_private_connections( r"""Use this method to list private connectivity configurations in a project and location. - .. code-block:: python from google.cloud import datastream_v1alpha1 - def sample_list_private_connections(): + async def sample_list_private_connections(): # Create a client - client = datastream_v1alpha1.DatastreamClient() + client = datastream_v1alpha1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1alpha1.ListPrivateConnectionsRequest( @@ -1852,7 +1925,7 @@ def sample_list_private_connections(): page_result = client.list_private_connections(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -1911,12 +1984,20 @@ def sample_list_private_connections(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListPrivateConnectionsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1934,14 +2015,13 @@ async def delete_private_connection( r"""Use this method to delete a private connectivity configuration. - .. code-block:: python from google.cloud import datastream_v1alpha1 - def sample_delete_private_connection(): + async def sample_delete_private_connection(): # Create a client - client = datastream_v1alpha1.DatastreamClient() + client = datastream_v1alpha1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1alpha1.DeletePrivateConnectionRequest( @@ -1953,7 +2033,7 @@ def sample_delete_private_connection(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -2025,7 +2105,12 @@ def sample_delete_private_connection(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -2052,14 +2137,13 @@ async def create_route( r"""Use this method to create a route for a private connectivity in a project and location. - .. code-block:: python from google.cloud import datastream_v1alpha1 - def sample_create_route(): + async def sample_create_route(): # Create a client - client = datastream_v1alpha1.DatastreamClient() + client = datastream_v1alpha1.DatastreamAsyncClient() # Initialize request argument(s) route = datastream_v1alpha1.Route() @@ -2077,7 +2161,7 @@ def sample_create_route(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -2155,7 +2239,12 @@ def sample_create_route(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -2183,9 +2272,9 @@ async def get_route( from google.cloud import datastream_v1alpha1 - def sample_get_route(): + async def sample_get_route(): # Create a client - client = datastream_v1alpha1.DatastreamClient() + client = datastream_v1alpha1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1alpha1.GetRouteRequest( @@ -2193,7 +2282,7 @@ def sample_get_route(): ) # Make the request - response = client.get_route(request=request) + response = await client.get_route(request=request) # Handle the response print(response) @@ -2254,7 +2343,12 @@ def sample_get_route(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2271,14 +2365,13 @@ async def list_routes( r"""Use this method to list routes created for a private connectivity in a project and location. - .. code-block:: python from google.cloud import datastream_v1alpha1 - def sample_list_routes(): + async def sample_list_routes(): # Create a client - client = datastream_v1alpha1.DatastreamClient() + client = datastream_v1alpha1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1alpha1.ListRoutesRequest( @@ -2289,7 +2382,7 @@ def sample_list_routes(): page_result = client.list_routes(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -2348,12 +2441,20 @@ def sample_list_routes(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListRoutesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -2374,9 +2475,9 @@ async def delete_route( from google.cloud import datastream_v1alpha1 - def sample_delete_route(): + async def sample_delete_route(): # Create a client - client = datastream_v1alpha1.DatastreamClient() + client = datastream_v1alpha1.DatastreamAsyncClient() # Initialize request argument(s) request = datastream_v1alpha1.DeleteRouteRequest( @@ -2388,7 +2489,7 @@ def sample_delete_route(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -2460,7 +2561,12 @@ def sample_delete_route(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( diff --git a/google/cloud/datastream_v1alpha1/services/datastream/client.py b/google/cloud/datastream_v1alpha1/services/datastream/client.py index 09df963..2ebf79e 100644 --- a/google/cloud/datastream_v1alpha1/services/datastream/client.py +++ b/google/cloud/datastream_v1alpha1/services/datastream/client.py @@ -16,18 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -36,13 +36,14 @@ from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore -from google.cloud.datastream_v1alpha1.services.datastream import pagers -from google.cloud.datastream_v1alpha1.types import datastream -from google.cloud.datastream_v1alpha1.types import datastream_resources from google.protobuf import empty_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import DatastreamTransport, DEFAULT_CLIENT_INFO + +from google.cloud.datastream_v1alpha1.services.datastream import pagers +from google.cloud.datastream_v1alpha1.types import datastream, datastream_resources + +from .transports.base import DEFAULT_CLIENT_INFO, DatastreamTransport from .transports.grpc import DatastreamGrpcTransport from .transports.grpc_asyncio import DatastreamGrpcAsyncIOTransport @@ -59,7 +60,10 @@ class DatastreamClientMeta(type): _transport_registry["grpc"] = DatastreamGrpcTransport _transport_registry["grpc_asyncio"] = DatastreamGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[DatastreamTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[DatastreamTransport]: """Returns an appropriate transport class. Args: @@ -165,11 +169,15 @@ def transport(self) -> DatastreamTransport: @staticmethod def connection_profile_path( - project: str, location: str, connection_profile: str, + project: str, + location: str, + connection_profile: str, ) -> str: """Returns a fully-qualified connection_profile string.""" return "projects/{project}/locations/{location}/connectionProfiles/{connection_profile}".format( - project=project, location=location, connection_profile=connection_profile, + project=project, + location=location, + connection_profile=connection_profile, ) @staticmethod @@ -183,11 +191,15 @@ def parse_connection_profile_path(path: str) -> Dict[str, str]: @staticmethod def private_connection_path( - project: str, location: str, private_connection: str, + project: str, + location: str, + private_connection: str, ) -> str: """Returns a fully-qualified private_connection string.""" return "projects/{project}/locations/{location}/privateConnections/{private_connection}".format( - project=project, location=location, private_connection=private_connection, + project=project, + location=location, + private_connection=private_connection, ) @staticmethod @@ -201,7 +213,10 @@ def parse_private_connection_path(path: str) -> Dict[str, str]: @staticmethod def route_path( - project: str, location: str, private_connection: str, route: str, + project: str, + location: str, + private_connection: str, + route: str, ) -> str: """Returns a fully-qualified route string.""" return "projects/{project}/locations/{location}/privateConnections/{private_connection}/routes/{route}".format( @@ -221,10 +236,16 @@ def parse_route_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def stream_path(project: str, location: str, stream: str,) -> str: + def stream_path( + project: str, + location: str, + stream: str, + ) -> str: """Returns a fully-qualified stream string.""" return "projects/{project}/locations/{location}/streams/{stream}".format( - project=project, location=location, stream=stream, + project=project, + location=location, + stream=stream, ) @staticmethod @@ -237,7 +258,9 @@ def parse_stream_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -250,9 +273,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -261,9 +288,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -272,9 +303,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -283,10 +318,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -472,7 +511,6 @@ def list_connection_profiles( r"""Use this method to list connection profiles created in a project and location. - .. code-block:: python from google.cloud import datastream_v1alpha1 @@ -548,12 +586,20 @@ def sample_list_connection_profiles(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListConnectionProfilesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -571,7 +617,6 @@ def get_connection_profile( r"""Use this method to get details about a connection profile. - .. code-block:: python from google.cloud import datastream_v1alpha1 @@ -643,7 +688,12 @@ def sample_get_connection_profile(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -662,7 +712,6 @@ def create_connection_profile( r"""Use this method to create a connection profile in a project and location. - .. code-block:: python from google.cloud import datastream_v1alpha1 @@ -771,7 +820,12 @@ def sample_create_connection_profile(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -797,7 +851,6 @@ def update_connection_profile( r"""Use this method to update the parameters of a connection profile. - .. code-block:: python from google.cloud import datastream_v1alpha1 @@ -902,7 +955,12 @@ def sample_update_connection_profile(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1018,7 +1076,12 @@ def sample_delete_connection_profile(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1045,7 +1108,6 @@ def discover_connection_profile( returns children data objects under a parent data object that's optionally supplied in the request. - .. code-block:: python from google.cloud import datastream_v1alpha1 @@ -1109,7 +1171,12 @@ def sample_discover_connection_profile(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1126,7 +1193,6 @@ def list_streams( r"""Use this method to list streams in a project and location. - .. code-block:: python from google.cloud import datastream_v1alpha1 @@ -1202,12 +1268,20 @@ def sample_list_streams(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListStreamsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1295,7 +1369,12 @@ def sample_get_stream(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1415,7 +1494,12 @@ def sample_create_stream(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1441,7 +1525,6 @@ def update_stream( r"""Use this method to update the configuration of a stream. - .. code-block:: python from google.cloud import datastream_v1alpha1 @@ -1541,7 +1624,12 @@ def sample_update_stream(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1655,7 +1743,12 @@ def sample_delete_stream(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1679,7 +1772,6 @@ def fetch_errors( r"""Use this method to fetch any errors associated with a stream. - .. code-block:: python from google.cloud import datastream_v1alpha1 @@ -1740,7 +1832,12 @@ def sample_fetch_errors(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1767,7 +1864,6 @@ def fetch_static_ips( children data objects under a parent data object that's optionally supplied in the request. - .. code-block:: python from google.cloud import datastream_v1alpha1 @@ -1846,12 +1942,20 @@ def sample_fetch_static_ips(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.FetchStaticIpsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1871,7 +1975,6 @@ def create_private_connection( r"""Use this method to create a private connectivity configuration. - .. code-block:: python from google.cloud import datastream_v1alpha1 @@ -1976,7 +2079,12 @@ def sample_create_private_connection(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -2001,7 +2109,6 @@ def get_private_connection( r"""Use this method to get details about a private connectivity configuration. - .. code-block:: python from google.cloud import datastream_v1alpha1 @@ -2077,7 +2184,12 @@ def sample_get_private_connection(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2094,7 +2206,6 @@ def list_private_connections( r"""Use this method to list private connectivity configurations in a project and location. - .. code-block:: python from google.cloud import datastream_v1alpha1 @@ -2171,12 +2282,20 @@ def sample_list_private_connections(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPrivateConnectionsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -2194,7 +2313,6 @@ def delete_private_connection( r"""Use this method to delete a private connectivity configuration. - .. code-block:: python from google.cloud import datastream_v1alpha1 @@ -2287,7 +2405,12 @@ def sample_delete_private_connection(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -2314,7 +2437,6 @@ def create_route( r"""Use this method to create a route for a private connectivity in a project and location. - .. code-block:: python from google.cloud import datastream_v1alpha1 @@ -2417,7 +2539,12 @@ def sample_create_route(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -2516,7 +2643,12 @@ def sample_get_route(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2533,7 +2665,6 @@ def list_routes( r"""Use this method to list routes created for a private connectivity in a project and location. - .. code-block:: python from google.cloud import datastream_v1alpha1 @@ -2610,12 +2741,20 @@ def sample_list_routes(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListRoutesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -2722,7 +2861,12 @@ def sample_delete_route(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( diff --git a/google/cloud/datastream_v1alpha1/services/datastream/pagers.py b/google/cloud/datastream_v1alpha1/services/datastream/pagers.py index 68b28f6..4381679 100644 --- a/google/cloud/datastream_v1alpha1/services/datastream/pagers.py +++ b/google/cloud/datastream_v1alpha1/services/datastream/pagers.py @@ -18,14 +18,13 @@ AsyncIterator, Awaitable, Callable, + Iterator, + Optional, Sequence, Tuple, - Optional, - Iterator, ) -from google.cloud.datastream_v1alpha1.types import datastream -from google.cloud.datastream_v1alpha1.types import datastream_resources +from google.cloud.datastream_v1alpha1.types import datastream, datastream_resources class ListConnectionProfilesPager: diff --git a/google/cloud/datastream_v1alpha1/services/datastream/transports/__init__.py b/google/cloud/datastream_v1alpha1/services/datastream/transports/__init__.py index 8684788..064e682 100644 --- a/google/cloud/datastream_v1alpha1/services/datastream/transports/__init__.py +++ b/google/cloud/datastream_v1alpha1/services/datastream/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import DatastreamGrpcTransport from .grpc_asyncio import DatastreamGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[DatastreamTransport]] _transport_registry["grpc"] = DatastreamGrpcTransport diff --git a/google/cloud/datastream_v1alpha1/services/datastream/transports/base.py b/google/cloud/datastream_v1alpha1/services/datastream/transports/base.py index 37457e4..6d77a67 100644 --- a/google/cloud/datastream_v1alpha1/services/datastream/transports/base.py +++ b/google/cloud/datastream_v1alpha1/services/datastream/transports/base.py @@ -15,20 +15,18 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, operations_v1 from google.api_core import retry as retries -from google.api_core import operations_v1 +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore +from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources -from google.cloud.datastream_v1alpha1.types import datastream -from google.cloud.datastream_v1alpha1.types import datastream_resources -from google.longrunning import operations_pb2 # type: ignore +from google.cloud.datastream_v1alpha1.types import datastream, datastream_resources try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -83,6 +81,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -154,25 +153,39 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.list_streams: gapic_v1.method.wrap_method( - self.list_streams, default_timeout=None, client_info=client_info, + self.list_streams, + default_timeout=None, + client_info=client_info, ), self.get_stream: gapic_v1.method.wrap_method( - self.get_stream, default_timeout=None, client_info=client_info, + self.get_stream, + default_timeout=None, + client_info=client_info, ), self.create_stream: gapic_v1.method.wrap_method( - self.create_stream, default_timeout=60.0, client_info=client_info, + self.create_stream, + default_timeout=60.0, + client_info=client_info, ), self.update_stream: gapic_v1.method.wrap_method( - self.update_stream, default_timeout=60.0, client_info=client_info, + self.update_stream, + default_timeout=60.0, + client_info=client_info, ), self.delete_stream: gapic_v1.method.wrap_method( - self.delete_stream, default_timeout=60.0, client_info=client_info, + self.delete_stream, + default_timeout=60.0, + client_info=client_info, ), self.fetch_errors: gapic_v1.method.wrap_method( - self.fetch_errors, default_timeout=None, client_info=client_info, + self.fetch_errors, + default_timeout=None, + client_info=client_info, ), self.fetch_static_ips: gapic_v1.method.wrap_method( - self.fetch_static_ips, default_timeout=None, client_info=client_info, + self.fetch_static_ips, + default_timeout=None, + client_info=client_info, ), self.create_private_connection: gapic_v1.method.wrap_method( self.create_private_connection, @@ -195,25 +208,33 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.create_route: gapic_v1.method.wrap_method( - self.create_route, default_timeout=60.0, client_info=client_info, + self.create_route, + default_timeout=60.0, + client_info=client_info, ), self.get_route: gapic_v1.method.wrap_method( - self.get_route, default_timeout=None, client_info=client_info, + self.get_route, + default_timeout=None, + client_info=client_info, ), self.list_routes: gapic_v1.method.wrap_method( - self.list_routes, default_timeout=None, client_info=client_info, + self.list_routes, + default_timeout=None, + client_info=client_info, ), self.delete_route: gapic_v1.method.wrap_method( - self.delete_route, default_timeout=60.0, client_info=client_info, + self.delete_route, + default_timeout=60.0, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -431,5 +452,9 @@ def delete_route( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("DatastreamTransport",) diff --git a/google/cloud/datastream_v1alpha1/services/datastream/transports/grpc.py b/google/cloud/datastream_v1alpha1/services/datastream/transports/grpc.py index 6bfd130..cdc9ebd 100644 --- a/google/cloud/datastream_v1alpha1/services/datastream/transports/grpc.py +++ b/google/cloud/datastream_v1alpha1/services/datastream/transports/grpc.py @@ -13,22 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import operations_v1 -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers, operations_v1 import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.longrunning import operations_pb2 # type: ignore import grpc # type: ignore -from google.cloud.datastream_v1alpha1.types import datastream -from google.cloud.datastream_v1alpha1.types import datastream_resources -from google.longrunning import operations_pb2 # type: ignore -from .base import DatastreamTransport, DEFAULT_CLIENT_INFO +from google.cloud.datastream_v1alpha1.types import datastream, datastream_resources + +from .base import DEFAULT_CLIENT_INFO, DatastreamTransport class DatastreamGrpcTransport(DatastreamTransport): @@ -228,8 +225,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -840,5 +836,9 @@ def delete_route( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("DatastreamGrpcTransport",) diff --git a/google/cloud/datastream_v1alpha1/services/datastream/transports/grpc_asyncio.py b/google/cloud/datastream_v1alpha1/services/datastream/transports/grpc_asyncio.py index d36b5b6..079bb6e 100644 --- a/google/cloud/datastream_v1alpha1/services/datastream/transports/grpc_asyncio.py +++ b/google/cloud/datastream_v1alpha1/services/datastream/transports/grpc_asyncio.py @@ -13,22 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async -from google.api_core import operations_v1 +from google.api_core import gapic_v1, grpc_helpers_async, operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.longrunning import operations_pb2 # type: ignore import grpc # type: ignore from grpc.experimental import aio # type: ignore -from google.cloud.datastream_v1alpha1.types import datastream -from google.cloud.datastream_v1alpha1.types import datastream_resources -from google.longrunning import operations_pb2 # type: ignore -from .base import DatastreamTransport, DEFAULT_CLIENT_INFO +from google.cloud.datastream_v1alpha1.types import datastream, datastream_resources + +from .base import DEFAULT_CLIENT_INFO, DatastreamTransport from .grpc import DatastreamGrpcTransport diff --git a/google/cloud/datastream_v1alpha1/types/__init__.py b/google/cloud/datastream_v1alpha1/types/__init__.py index bcb6350..c11abd6 100644 --- a/google/cloud/datastream_v1alpha1/types/__init__.py +++ b/google/cloud/datastream_v1alpha1/types/__init__.py @@ -51,6 +51,7 @@ Error, ForwardSshTunnelConnectivity, GcsDestinationConfig, + GcsFileFormat, GcsProfile, JsonFileFormat, MysqlColumn, @@ -70,6 +71,7 @@ PrivateConnection, PrivateConnectivity, Route, + SchemaFileFormat, SourceConfig, StaticServiceIpConnectivity, Stream, @@ -77,8 +79,6 @@ ValidationMessage, ValidationResult, VpcPeeringConfig, - GcsFileFormat, - SchemaFileFormat, ) __all__ = ( diff --git a/google/cloud/datastream_v1alpha1/types/datastream.py b/google/cloud/datastream_v1alpha1/types/datastream.py index 327eb74..30dad6b 100644 --- a/google/cloud/datastream_v1alpha1/types/datastream.py +++ b/google/cloud/datastream_v1alpha1/types/datastream.py @@ -13,12 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - -from google.cloud.datastream_v1alpha1.types import datastream_resources from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore +import proto # type: ignore +from google.cloud.datastream_v1alpha1.types import datastream_resources __protobuf__ = proto.module( package="google.cloud.datastream.v1alpha1", @@ -101,16 +100,31 @@ class DiscoverConnectionProfileRequest(proto.Message): This field is a member of `oneof`_ ``data_object``. """ - parent = proto.Field(proto.STRING, number=1,) + parent = proto.Field( + proto.STRING, + number=1, + ) connection_profile = proto.Field( proto.MESSAGE, number=200, oneof="target", message=datastream_resources.ConnectionProfile, ) - connection_profile_name = proto.Field(proto.STRING, number=201, oneof="target",) - recursive = proto.Field(proto.BOOL, number=3, oneof="depth",) - recursion_depth = proto.Field(proto.INT32, number=4, oneof="depth",) + connection_profile_name = proto.Field( + proto.STRING, + number=201, + oneof="target", + ) + recursive = proto.Field( + proto.BOOL, + number=3, + oneof="depth", + ) + recursion_depth = proto.Field( + proto.INT32, + number=4, + oneof="depth", + ) oracle_rdbms = proto.Field( proto.MESSAGE, number=100, @@ -175,9 +189,18 @@ class FetchStaticIpsRequest(proto.Message): call. will likely not be specified. """ - name = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class FetchStaticIpsResponse(proto.Message): @@ -196,8 +219,14 @@ class FetchStaticIpsResponse(proto.Message): def raw_page(self): return self - static_ips = proto.RepeatedField(proto.STRING, number=1,) - next_page_token = proto.Field(proto.STRING, number=2,) + static_ips = proto.RepeatedField( + proto.STRING, + number=1, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class FetchErrorsRequest(proto.Message): @@ -209,7 +238,10 @@ class FetchErrorsRequest(proto.Message): fetch any errors. """ - stream = proto.Field(proto.STRING, number=1,) + stream = proto.Field( + proto.STRING, + number=1, + ) class FetchErrorsResponse(proto.Message): @@ -221,7 +253,9 @@ class FetchErrorsResponse(proto.Message): """ errors = proto.RepeatedField( - proto.MESSAGE, number=1, message=datastream_resources.Error, + proto.MESSAGE, + number=1, + message=datastream_resources.Error, ) @@ -251,11 +285,26 @@ class ListConnectionProfilesRequest(proto.Message): Order by fields for the result. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - filter = proto.Field(proto.STRING, number=4,) - order_by = proto.Field(proto.STRING, number=5,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + order_by = proto.Field( + proto.STRING, + number=5, + ) class ListConnectionProfilesResponse(proto.Message): @@ -277,10 +326,18 @@ def raw_page(self): return self connection_profiles = proto.RepeatedField( - proto.MESSAGE, number=1, message=datastream_resources.ConnectionProfile, + proto.MESSAGE, + number=1, + message=datastream_resources.ConnectionProfile, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + unreachable = proto.RepeatedField( + proto.STRING, + number=3, ) - next_page_token = proto.Field(proto.STRING, number=2,) - unreachable = proto.RepeatedField(proto.STRING, number=3,) class GetConnectionProfileRequest(proto.Message): @@ -292,7 +349,10 @@ class GetConnectionProfileRequest(proto.Message): resource to get. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateConnectionProfileRequest(proto.Message): @@ -327,12 +387,23 @@ class CreateConnectionProfileRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - parent = proto.Field(proto.STRING, number=1,) - connection_profile_id = proto.Field(proto.STRING, number=2,) + parent = proto.Field( + proto.STRING, + number=1, + ) + connection_profile_id = proto.Field( + proto.STRING, + number=2, + ) connection_profile = proto.Field( - proto.MESSAGE, number=3, message=datastream_resources.ConnectionProfile, + proto.MESSAGE, + number=3, + message=datastream_resources.ConnectionProfile, + ) + request_id = proto.Field( + proto.STRING, + number=4, ) - request_id = proto.Field(proto.STRING, number=4,) class UpdateConnectionProfileRequest(proto.Message): @@ -369,12 +440,19 @@ class UpdateConnectionProfileRequest(proto.Message): """ update_mask = proto.Field( - proto.MESSAGE, number=1, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=1, + message=field_mask_pb2.FieldMask, ) connection_profile = proto.Field( - proto.MESSAGE, number=2, message=datastream_resources.ConnectionProfile, + proto.MESSAGE, + number=2, + message=datastream_resources.ConnectionProfile, + ) + request_id = proto.Field( + proto.STRING, + number=3, ) - request_id = proto.Field(proto.STRING, number=3,) class DeleteConnectionProfileRequest(proto.Message): @@ -404,8 +482,14 @@ class DeleteConnectionProfileRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1,) - request_id = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + request_id = proto.Field( + proto.STRING, + number=2, + ) class ListStreamsRequest(proto.Message): @@ -433,11 +517,26 @@ class ListStreamsRequest(proto.Message): Order by fields for the result. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - filter = proto.Field(proto.STRING, number=4,) - order_by = proto.Field(proto.STRING, number=5,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + order_by = proto.Field( + proto.STRING, + number=5, + ) class ListStreamsResponse(proto.Message): @@ -459,10 +558,18 @@ def raw_page(self): return self streams = proto.RepeatedField( - proto.MESSAGE, number=1, message=datastream_resources.Stream, + proto.MESSAGE, + number=1, + message=datastream_resources.Stream, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + unreachable = proto.RepeatedField( + proto.STRING, + number=3, ) - next_page_token = proto.Field(proto.STRING, number=2,) - unreachable = proto.RepeatedField(proto.STRING, number=3,) class GetStreamRequest(proto.Message): @@ -474,7 +581,10 @@ class GetStreamRequest(proto.Message): get. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateStreamRequest(proto.Message): @@ -514,12 +624,31 @@ class CreateStreamRequest(proto.Message): validating it. """ - parent = proto.Field(proto.STRING, number=1,) - stream_id = proto.Field(proto.STRING, number=2,) - stream = proto.Field(proto.MESSAGE, number=3, message=datastream_resources.Stream,) - request_id = proto.Field(proto.STRING, number=4,) - validate_only = proto.Field(proto.BOOL, number=5,) - force = proto.Field(proto.BOOL, number=6,) + parent = proto.Field( + proto.STRING, + number=1, + ) + stream_id = proto.Field( + proto.STRING, + number=2, + ) + stream = proto.Field( + proto.MESSAGE, + number=3, + message=datastream_resources.Stream, + ) + request_id = proto.Field( + proto.STRING, + number=4, + ) + validate_only = proto.Field( + proto.BOOL, + number=5, + ) + force = proto.Field( + proto.BOOL, + number=6, + ) class UpdateStreamRequest(proto.Message): @@ -563,12 +692,27 @@ class UpdateStreamRequest(proto.Message): """ update_mask = proto.Field( - proto.MESSAGE, number=1, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=1, + message=field_mask_pb2.FieldMask, + ) + stream = proto.Field( + proto.MESSAGE, + number=2, + message=datastream_resources.Stream, + ) + request_id = proto.Field( + proto.STRING, + number=3, + ) + validate_only = proto.Field( + proto.BOOL, + number=4, + ) + force = proto.Field( + proto.BOOL, + number=5, ) - stream = proto.Field(proto.MESSAGE, number=2, message=datastream_resources.Stream,) - request_id = proto.Field(proto.STRING, number=3,) - validate_only = proto.Field(proto.BOOL, number=4,) - force = proto.Field(proto.BOOL, number=5,) class DeleteStreamRequest(proto.Message): @@ -598,8 +742,14 @@ class DeleteStreamRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1,) - request_id = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + request_id = proto.Field( + proto.STRING, + number=2, + ) class OperationMetadata(proto.Message): @@ -635,15 +785,40 @@ class OperationMetadata(proto.Message): if there are any. """ - create_time = proto.Field(proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - target = proto.Field(proto.STRING, number=3,) - verb = proto.Field(proto.STRING, number=4,) - status_message = proto.Field(proto.STRING, number=5,) - requested_cancellation = proto.Field(proto.BOOL, number=6,) - api_version = proto.Field(proto.STRING, number=7,) + create_time = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + target = proto.Field( + proto.STRING, + number=3, + ) + verb = proto.Field( + proto.STRING, + number=4, + ) + status_message = proto.Field( + proto.STRING, + number=5, + ) + requested_cancellation = proto.Field( + proto.BOOL, + number=6, + ) + api_version = proto.Field( + proto.STRING, + number=7, + ) validation_result = proto.Field( - proto.MESSAGE, number=8, message=datastream_resources.ValidationResult, + proto.MESSAGE, + number=8, + message=datastream_resources.ValidationResult, ) @@ -680,12 +855,23 @@ class CreatePrivateConnectionRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - parent = proto.Field(proto.STRING, number=1,) - private_connection_id = proto.Field(proto.STRING, number=2,) + parent = proto.Field( + proto.STRING, + number=1, + ) + private_connection_id = proto.Field( + proto.STRING, + number=2, + ) private_connection = proto.Field( - proto.MESSAGE, number=3, message=datastream_resources.PrivateConnection, + proto.MESSAGE, + number=3, + message=datastream_resources.PrivateConnection, + ) + request_id = proto.Field( + proto.STRING, + number=4, ) - request_id = proto.Field(proto.STRING, number=4,) class ListPrivateConnectionsRequest(proto.Message): @@ -715,11 +901,26 @@ class ListPrivateConnectionsRequest(proto.Message): Order by fields for the result. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - filter = proto.Field(proto.STRING, number=4,) - order_by = proto.Field(proto.STRING, number=5,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + order_by = proto.Field( + proto.STRING, + number=5, + ) class ListPrivateConnectionsResponse(proto.Message): @@ -741,10 +942,18 @@ def raw_page(self): return self private_connections = proto.RepeatedField( - proto.MESSAGE, number=1, message=datastream_resources.PrivateConnection, + proto.MESSAGE, + number=1, + message=datastream_resources.PrivateConnection, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + unreachable = proto.RepeatedField( + proto.STRING, + number=3, ) - next_page_token = proto.Field(proto.STRING, number=2,) - unreachable = proto.RepeatedField(proto.STRING, number=3,) class DeletePrivateConnectionRequest(proto.Message): @@ -778,9 +987,18 @@ class DeletePrivateConnectionRequest(proto.Message): be deleted. """ - name = proto.Field(proto.STRING, number=1,) - request_id = proto.Field(proto.STRING, number=2,) - force = proto.Field(proto.BOOL, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + request_id = proto.Field( + proto.STRING, + number=2, + ) + force = proto.Field( + proto.BOOL, + number=3, + ) class GetPrivateConnectionRequest(proto.Message): @@ -792,7 +1010,10 @@ class GetPrivateConnectionRequest(proto.Message): connectivity configuration to get. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateRouteRequest(proto.Message): @@ -826,10 +1047,23 @@ class CreateRouteRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - parent = proto.Field(proto.STRING, number=1,) - route_id = proto.Field(proto.STRING, number=2,) - route = proto.Field(proto.MESSAGE, number=3, message=datastream_resources.Route,) - request_id = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + route_id = proto.Field( + proto.STRING, + number=2, + ) + route = proto.Field( + proto.MESSAGE, + number=3, + message=datastream_resources.Route, + ) + request_id = proto.Field( + proto.STRING, + number=4, + ) class ListRoutesRequest(proto.Message): @@ -858,11 +1092,26 @@ class ListRoutesRequest(proto.Message): Order by fields for the result. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - filter = proto.Field(proto.STRING, number=4,) - order_by = proto.Field(proto.STRING, number=5,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + order_by = proto.Field( + proto.STRING, + number=5, + ) class ListRoutesResponse(proto.Message): @@ -884,10 +1133,18 @@ def raw_page(self): return self routes = proto.RepeatedField( - proto.MESSAGE, number=1, message=datastream_resources.Route, + proto.MESSAGE, + number=1, + message=datastream_resources.Route, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + unreachable = proto.RepeatedField( + proto.STRING, + number=3, ) - next_page_token = proto.Field(proto.STRING, number=2,) - unreachable = proto.RepeatedField(proto.STRING, number=3,) class DeleteRouteRequest(proto.Message): @@ -917,8 +1174,14 @@ class DeleteRouteRequest(proto.Message): (00000000-0000-0000-0000-000000000000). """ - name = proto.Field(proto.STRING, number=1,) - request_id = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + request_id = proto.Field( + proto.STRING, + number=2, + ) class GetRouteRequest(proto.Message): @@ -930,7 +1193,10 @@ class GetRouteRequest(proto.Message): get. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/datastream_v1alpha1/types/datastream_resources.py b/google/cloud/datastream_v1alpha1/types/datastream_resources.py index b6c2f08..5d20a3e 100644 --- a/google/cloud/datastream_v1alpha1/types/datastream_resources.py +++ b/google/cloud/datastream_v1alpha1/types/datastream_resources.py @@ -13,11 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.protobuf import duration_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.cloud.datastream.v1alpha1", @@ -89,16 +87,35 @@ class OracleProfile(proto.Message): Required. Password for the Oracle connection. database_service (str): Required. Database for the Oracle connection. - connection_attributes (Sequence[google.cloud.datastream_v1alpha1.types.OracleProfile.ConnectionAttributesEntry]): + connection_attributes (Mapping[str, str]): Connection string attributes """ - hostname = proto.Field(proto.STRING, number=1,) - port = proto.Field(proto.INT32, number=2,) - username = proto.Field(proto.STRING, number=3,) - password = proto.Field(proto.STRING, number=4,) - database_service = proto.Field(proto.STRING, number=5,) - connection_attributes = proto.MapField(proto.STRING, proto.STRING, number=6,) + hostname = proto.Field( + proto.STRING, + number=1, + ) + port = proto.Field( + proto.INT32, + number=2, + ) + username = proto.Field( + proto.STRING, + number=3, + ) + password = proto.Field( + proto.STRING, + number=4, + ) + database_service = proto.Field( + proto.STRING, + number=5, + ) + connection_attributes = proto.MapField( + proto.STRING, + proto.STRING, + number=6, + ) class MysqlProfile(proto.Message): @@ -119,11 +136,27 @@ class MysqlProfile(proto.Message): SSL configuration for the MySQL connection. """ - hostname = proto.Field(proto.STRING, number=1,) - port = proto.Field(proto.INT32, number=2,) - username = proto.Field(proto.STRING, number=3,) - password = proto.Field(proto.STRING, number=4,) - ssl_config = proto.Field(proto.MESSAGE, number=5, message="MysqlSslConfig",) + hostname = proto.Field( + proto.STRING, + number=1, + ) + port = proto.Field( + proto.INT32, + number=2, + ) + username = proto.Field( + proto.STRING, + number=3, + ) + password = proto.Field( + proto.STRING, + number=4, + ) + ssl_config = proto.Field( + proto.MESSAGE, + number=5, + message="MysqlSslConfig", + ) class GcsProfile(proto.Message): @@ -138,18 +171,22 @@ class GcsProfile(proto.Message): bucket. """ - bucket_name = proto.Field(proto.STRING, number=1,) - root_path = proto.Field(proto.STRING, number=2,) + bucket_name = proto.Field( + proto.STRING, + number=1, + ) + root_path = proto.Field( + proto.STRING, + number=2, + ) class NoConnectivitySettings(proto.Message): - r"""No connectivity settings. - """ + r"""No connectivity settings.""" class StaticServiceIpConnectivity(proto.Message): - r"""Static IP address connectivity. - """ + r"""Static IP address connectivity.""" class ForwardSshTunnelConnectivity(proto.Message): @@ -179,11 +216,28 @@ class ForwardSshTunnelConnectivity(proto.Message): This field is a member of `oneof`_ ``authentication_method``. """ - hostname = proto.Field(proto.STRING, number=1,) - username = proto.Field(proto.STRING, number=2,) - port = proto.Field(proto.INT32, number=3,) - password = proto.Field(proto.STRING, number=100, oneof="authentication_method",) - private_key = proto.Field(proto.STRING, number=101, oneof="authentication_method",) + hostname = proto.Field( + proto.STRING, + number=1, + ) + username = proto.Field( + proto.STRING, + number=2, + ) + port = proto.Field( + proto.INT32, + number=3, + ) + password = proto.Field( + proto.STRING, + number=100, + oneof="authentication_method", + ) + private_key = proto.Field( + proto.STRING, + number=101, + oneof="authentication_method", + ) class VpcPeeringConfig(proto.Message): @@ -199,8 +253,14 @@ class VpcPeeringConfig(proto.Message): /29) """ - vpc_name = proto.Field(proto.STRING, number=1,) - subnet = proto.Field(proto.STRING, number=2,) + vpc_name = proto.Field( + proto.STRING, + number=1, + ) + subnet = proto.Field( + proto.STRING, + number=2, + ) class PrivateConnection(proto.Message): @@ -214,7 +274,7 @@ class PrivateConnection(proto.Message): Output only. The create time of the resource. update_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The update time of the resource. - labels (Sequence[google.cloud.datastream_v1alpha1.types.PrivateConnection.LabelsEntry]): + labels (Mapping[str, str]): Labels. display_name (str): Required. Display name. @@ -235,15 +295,43 @@ class State(proto.Enum): CREATED = 2 FAILED = 3 - name = proto.Field(proto.STRING, number=1,) - create_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - labels = proto.MapField(proto.STRING, proto.STRING, number=4,) - display_name = proto.Field(proto.STRING, number=5,) - state = proto.Field(proto.ENUM, number=6, enum=State,) - error = proto.Field(proto.MESSAGE, number=7, message="Error",) + name = proto.Field( + proto.STRING, + number=1, + ) + create_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + display_name = proto.Field( + proto.STRING, + number=5, + ) + state = proto.Field( + proto.ENUM, + number=6, + enum=State, + ) + error = proto.Field( + proto.MESSAGE, + number=7, + message="Error", + ) vpc_peering_config = proto.Field( - proto.MESSAGE, number=100, message="VpcPeeringConfig", + proto.MESSAGE, + number=100, + message="VpcPeeringConfig", ) @@ -255,7 +343,10 @@ class PrivateConnectivity(proto.Message): """ - private_connection_name = proto.Field(proto.STRING, number=1,) + private_connection_name = proto.Field( + proto.STRING, + number=1, + ) class Route(proto.Message): @@ -270,7 +361,7 @@ class Route(proto.Message): Output only. The create time of the resource. update_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The update time of the resource. - labels (Sequence[google.cloud.datastream_v1alpha1.types.Route.LabelsEntry]): + labels (Mapping[str, str]): Labels. display_name (str): Required. Display name. @@ -280,13 +371,37 @@ class Route(proto.Message): Destination port for connection """ - name = proto.Field(proto.STRING, number=1,) - create_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - labels = proto.MapField(proto.STRING, proto.STRING, number=4,) - display_name = proto.Field(proto.STRING, number=5,) - destination_address = proto.Field(proto.STRING, number=6,) - destination_port = proto.Field(proto.INT32, number=7,) + name = proto.Field( + proto.STRING, + number=1, + ) + create_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + display_name = proto.Field( + proto.STRING, + number=5, + ) + destination_address = proto.Field( + proto.STRING, + number=6, + ) + destination_port = proto.Field( + proto.INT32, + number=7, + ) class MysqlSslConfig(proto.Message): @@ -317,12 +432,30 @@ class MysqlSslConfig(proto.Message): set. """ - client_key = proto.Field(proto.STRING, number=11,) - client_key_set = proto.Field(proto.BOOL, number=12,) - client_certificate = proto.Field(proto.STRING, number=13,) - client_certificate_set = proto.Field(proto.BOOL, number=14,) - ca_certificate = proto.Field(proto.STRING, number=15,) - ca_certificate_set = proto.Field(proto.BOOL, number=16,) + client_key = proto.Field( + proto.STRING, + number=11, + ) + client_key_set = proto.Field( + proto.BOOL, + number=12, + ) + client_certificate = proto.Field( + proto.STRING, + number=13, + ) + client_certificate_set = proto.Field( + proto.BOOL, + number=14, + ) + ca_certificate = proto.Field( + proto.STRING, + number=15, + ) + ca_certificate_set = proto.Field( + proto.BOOL, + number=16, + ) class ConnectionProfile(proto.Message): @@ -342,7 +475,7 @@ class ConnectionProfile(proto.Message): Output only. The create time of the resource. update_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The update time of the resource. - labels (Sequence[google.cloud.datastream_v1alpha1.types.ConnectionProfile.LabelsEntry]): + labels (Mapping[str, str]): Labels. display_name (str): Required. Display name. @@ -377,19 +510,46 @@ class ConnectionProfile(proto.Message): This field is a member of `oneof`_ ``connectivity``. """ - name = proto.Field(proto.STRING, number=1,) - create_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - labels = proto.MapField(proto.STRING, proto.STRING, number=4,) - display_name = proto.Field(proto.STRING, number=5,) + name = proto.Field( + proto.STRING, + number=1, + ) + create_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + display_name = proto.Field( + proto.STRING, + number=5, + ) oracle_profile = proto.Field( - proto.MESSAGE, number=100, oneof="profile", message="OracleProfile", + proto.MESSAGE, + number=100, + oneof="profile", + message="OracleProfile", ) gcs_profile = proto.Field( - proto.MESSAGE, number=101, oneof="profile", message="GcsProfile", + proto.MESSAGE, + number=101, + oneof="profile", + message="GcsProfile", ) mysql_profile = proto.Field( - proto.MESSAGE, number=102, oneof="profile", message="MysqlProfile", + proto.MESSAGE, + number=102, + oneof="profile", + message="MysqlProfile", ) no_connectivity = proto.Field( proto.MESSAGE, @@ -410,7 +570,10 @@ class ConnectionProfile(proto.Message): message="ForwardSshTunnelConnectivity", ) private_connectivity = proto.Field( - proto.MESSAGE, number=203, oneof="connectivity", message="PrivateConnectivity", + proto.MESSAGE, + number=203, + oneof="connectivity", + message="PrivateConnectivity", ) @@ -441,15 +604,42 @@ class OracleColumn(proto.Message): table. """ - column_name = proto.Field(proto.STRING, number=1,) - data_type = proto.Field(proto.STRING, number=2,) - length = proto.Field(proto.INT32, number=3,) - precision = proto.Field(proto.INT32, number=4,) - scale = proto.Field(proto.INT32, number=5,) - encoding = proto.Field(proto.STRING, number=6,) - primary_key = proto.Field(proto.BOOL, number=7,) - nullable = proto.Field(proto.BOOL, number=8,) - ordinal_position = proto.Field(proto.INT32, number=9,) + column_name = proto.Field( + proto.STRING, + number=1, + ) + data_type = proto.Field( + proto.STRING, + number=2, + ) + length = proto.Field( + proto.INT32, + number=3, + ) + precision = proto.Field( + proto.INT32, + number=4, + ) + scale = proto.Field( + proto.INT32, + number=5, + ) + encoding = proto.Field( + proto.STRING, + number=6, + ) + primary_key = proto.Field( + proto.BOOL, + number=7, + ) + nullable = proto.Field( + proto.BOOL, + number=8, + ) + ordinal_position = proto.Field( + proto.INT32, + number=9, + ) class OracleTable(proto.Message): @@ -464,9 +654,14 @@ class OracleTable(proto.Message): lists, includes/excludes everything. """ - table_name = proto.Field(proto.STRING, number=1,) + table_name = proto.Field( + proto.STRING, + number=1, + ) oracle_columns = proto.RepeatedField( - proto.MESSAGE, number=2, message="OracleColumn", + proto.MESSAGE, + number=2, + message="OracleColumn", ) @@ -480,8 +675,15 @@ class OracleSchema(proto.Message): Tables in the schema. """ - schema_name = proto.Field(proto.STRING, number=1,) - oracle_tables = proto.RepeatedField(proto.MESSAGE, number=2, message="OracleTable",) + schema_name = proto.Field( + proto.STRING, + number=1, + ) + oracle_tables = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="OracleTable", + ) class OracleRdbms(proto.Message): @@ -494,7 +696,9 @@ class OracleRdbms(proto.Message): """ oracle_schemas = proto.RepeatedField( - proto.MESSAGE, number=1, message="OracleSchema", + proto.MESSAGE, + number=1, + message="OracleSchema", ) @@ -508,8 +712,16 @@ class OracleSourceConfig(proto.Message): Oracle objects to exclude from the stream. """ - allowlist = proto.Field(proto.MESSAGE, number=1, message="OracleRdbms",) - rejectlist = proto.Field(proto.MESSAGE, number=2, message="OracleRdbms",) + allowlist = proto.Field( + proto.MESSAGE, + number=1, + message="OracleRdbms", + ) + rejectlist = proto.Field( + proto.MESSAGE, + number=2, + message="OracleRdbms", + ) class MysqlColumn(proto.Message): @@ -537,13 +749,34 @@ class MysqlColumn(proto.Message): table. """ - column_name = proto.Field(proto.STRING, number=1,) - data_type = proto.Field(proto.STRING, number=2,) - length = proto.Field(proto.INT32, number=3,) - collation = proto.Field(proto.STRING, number=4,) - primary_key = proto.Field(proto.BOOL, number=5,) - nullable = proto.Field(proto.BOOL, number=6,) - ordinal_position = proto.Field(proto.INT32, number=7,) + column_name = proto.Field( + proto.STRING, + number=1, + ) + data_type = proto.Field( + proto.STRING, + number=2, + ) + length = proto.Field( + proto.INT32, + number=3, + ) + collation = proto.Field( + proto.STRING, + number=4, + ) + primary_key = proto.Field( + proto.BOOL, + number=5, + ) + nullable = proto.Field( + proto.BOOL, + number=6, + ) + ordinal_position = proto.Field( + proto.INT32, + number=7, + ) class MysqlTable(proto.Message): @@ -558,8 +791,15 @@ class MysqlTable(proto.Message): lists, includes/excludes everything. """ - table_name = proto.Field(proto.STRING, number=1,) - mysql_columns = proto.RepeatedField(proto.MESSAGE, number=2, message="MysqlColumn",) + table_name = proto.Field( + proto.STRING, + number=1, + ) + mysql_columns = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="MysqlColumn", + ) class MysqlDatabase(proto.Message): @@ -572,8 +812,15 @@ class MysqlDatabase(proto.Message): Tables in the database. """ - database_name = proto.Field(proto.STRING, number=1,) - mysql_tables = proto.RepeatedField(proto.MESSAGE, number=2, message="MysqlTable",) + database_name = proto.Field( + proto.STRING, + number=1, + ) + mysql_tables = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="MysqlTable", + ) class MysqlRdbms(proto.Message): @@ -585,7 +832,9 @@ class MysqlRdbms(proto.Message): """ mysql_databases = proto.RepeatedField( - proto.MESSAGE, number=1, message="MysqlDatabase", + proto.MESSAGE, + number=1, + message="MysqlDatabase", ) @@ -599,8 +848,16 @@ class MysqlSourceConfig(proto.Message): MySQL objects to exclude from the stream. """ - allowlist = proto.Field(proto.MESSAGE, number=1, message="MysqlRdbms",) - rejectlist = proto.Field(proto.MESSAGE, number=2, message="MysqlRdbms",) + allowlist = proto.Field( + proto.MESSAGE, + number=1, + message="MysqlRdbms", + ) + rejectlist = proto.Field( + proto.MESSAGE, + number=2, + message="MysqlRdbms", + ) class SourceConfig(proto.Message): @@ -627,7 +884,10 @@ class SourceConfig(proto.Message): This field is a member of `oneof`_ ``source_stream_config``. """ - source_connection_profile_name = proto.Field(proto.STRING, number=1,) + source_connection_profile_name = proto.Field( + proto.STRING, + number=1, + ) oracle_source_config = proto.Field( proto.MESSAGE, number=100, @@ -643,8 +903,7 @@ class SourceConfig(proto.Message): class AvroFileFormat(proto.Message): - r"""AVRO file format configuration. - """ + r"""AVRO file format configuration.""" class JsonFileFormat(proto.Message): @@ -663,8 +922,16 @@ class JsonCompression(proto.Enum): NO_COMPRESSION = 1 GZIP = 2 - schema_file_format = proto.Field(proto.ENUM, number=1, enum="SchemaFileFormat",) - compression = proto.Field(proto.ENUM, number=2, enum=JsonCompression,) + schema_file_format = proto.Field( + proto.ENUM, + number=1, + enum="SchemaFileFormat", + ) + compression = proto.Field( + proto.ENUM, + number=2, + enum=JsonCompression, + ) class GcsDestinationConfig(proto.Message): @@ -701,17 +968,35 @@ class GcsDestinationConfig(proto.Message): This field is a member of `oneof`_ ``file_format``. """ - path = proto.Field(proto.STRING, number=1,) - gcs_file_format = proto.Field(proto.ENUM, number=2, enum="GcsFileFormat",) - file_rotation_mb = proto.Field(proto.INT32, number=3,) + path = proto.Field( + proto.STRING, + number=1, + ) + gcs_file_format = proto.Field( + proto.ENUM, + number=2, + enum="GcsFileFormat", + ) + file_rotation_mb = proto.Field( + proto.INT32, + number=3, + ) file_rotation_interval = proto.Field( - proto.MESSAGE, number=4, message=duration_pb2.Duration, + proto.MESSAGE, + number=4, + message=duration_pb2.Duration, ) avro_file_format = proto.Field( - proto.MESSAGE, number=100, oneof="file_format", message="AvroFileFormat", + proto.MESSAGE, + number=100, + oneof="file_format", + message="AvroFileFormat", ) json_file_format = proto.Field( - proto.MESSAGE, number=101, oneof="file_format", message="JsonFileFormat", + proto.MESSAGE, + number=101, + oneof="file_format", + message="JsonFileFormat", ) @@ -729,7 +1014,10 @@ class DestinationConfig(proto.Message): This field is a member of `oneof`_ ``destination_stream_config``. """ - destination_connection_profile_name = proto.Field(proto.STRING, number=1,) + destination_connection_profile_name = proto.Field( + proto.STRING, + number=1, + ) gcs_destination_config = proto.Field( proto.MESSAGE, number=100, @@ -756,7 +1044,7 @@ class Stream(proto.Message): update_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The last update time of the stream. - labels (Sequence[google.cloud.datastream_v1alpha1.types.Stream.LabelsEntry]): + labels (Mapping[str, str]): Labels. display_name (str): Required. Display name. @@ -819,10 +1107,16 @@ class BackfillAllStrategy(proto.Message): """ oracle_excluded_objects = proto.Field( - proto.MESSAGE, number=1, oneof="excluded_objects", message="OracleRdbms", + proto.MESSAGE, + number=1, + oneof="excluded_objects", + message="OracleRdbms", ) mysql_excluded_objects = proto.Field( - proto.MESSAGE, number=2, oneof="excluded_objects", message="MysqlRdbms", + proto.MESSAGE, + number=2, + oneof="excluded_objects", + message="MysqlRdbms", ) class BackfillNoneStrategy(proto.Message): @@ -831,16 +1125,44 @@ class BackfillNoneStrategy(proto.Message): """ - name = proto.Field(proto.STRING, number=1,) - create_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - labels = proto.MapField(proto.STRING, proto.STRING, number=4,) - display_name = proto.Field(proto.STRING, number=5,) - source_config = proto.Field(proto.MESSAGE, number=6, message="SourceConfig",) + name = proto.Field( + proto.STRING, + number=1, + ) + create_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + display_name = proto.Field( + proto.STRING, + number=5, + ) + source_config = proto.Field( + proto.MESSAGE, + number=6, + message="SourceConfig", + ) destination_config = proto.Field( - proto.MESSAGE, number=7, message="DestinationConfig", + proto.MESSAGE, + number=7, + message="DestinationConfig", + ) + state = proto.Field( + proto.ENUM, + number=8, + enum=State, ) - state = proto.Field(proto.ENUM, number=8, enum=State,) backfill_all = proto.Field( proto.MESSAGE, number=101, @@ -853,7 +1175,11 @@ class BackfillNoneStrategy(proto.Message): oneof="backfill_strategy", message=BackfillNoneStrategy, ) - errors = proto.RepeatedField(proto.MESSAGE, number=9, message="Error",) + errors = proto.RepeatedField( + proto.MESSAGE, + number=9, + message="Error", + ) class Error(proto.Message): @@ -872,15 +1198,32 @@ class Error(proto.Message): the error that occurred. error_time (google.protobuf.timestamp_pb2.Timestamp): The time when the error occurred. - details (Sequence[google.cloud.datastream_v1alpha1.types.Error.DetailsEntry]): + details (Mapping[str, str]): Additional information about the error. """ - reason = proto.Field(proto.STRING, number=1,) - error_uuid = proto.Field(proto.STRING, number=2,) - message = proto.Field(proto.STRING, number=3,) - error_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) - details = proto.MapField(proto.STRING, proto.STRING, number=5,) + reason = proto.Field( + proto.STRING, + number=1, + ) + error_uuid = proto.Field( + proto.STRING, + number=2, + ) + message = proto.Field( + proto.STRING, + number=3, + ) + error_time = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) + details = proto.MapField( + proto.STRING, + proto.STRING, + number=5, + ) class ValidationResult(proto.Message): @@ -892,7 +1235,11 @@ class ValidationResult(proto.Message): as well as not executed validations). """ - validations = proto.RepeatedField(proto.MESSAGE, number=1, message="Validation",) + validations = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Validation", + ) class Validation(proto.Message): @@ -916,10 +1263,24 @@ class Status(proto.Enum): FAILED = 2 PASSED = 3 - description = proto.Field(proto.STRING, number=1,) - status = proto.Field(proto.ENUM, number=2, enum=Status,) - message = proto.RepeatedField(proto.MESSAGE, number=3, message="ValidationMessage",) - code = proto.Field(proto.STRING, number=4,) + description = proto.Field( + proto.STRING, + number=1, + ) + status = proto.Field( + proto.ENUM, + number=2, + enum=Status, + ) + message = proto.RepeatedField( + proto.MESSAGE, + number=3, + message="ValidationMessage", + ) + code = proto.Field( + proto.STRING, + number=4, + ) class ValidationMessage(proto.Message): @@ -930,7 +1291,7 @@ class ValidationMessage(proto.Message): The result of the validation. level (google.cloud.datastream_v1alpha1.types.ValidationMessage.Level): Message severity level (warning or error). - metadata (Sequence[google.cloud.datastream_v1alpha1.types.ValidationMessage.MetadataEntry]): + metadata (Mapping[str, str]): Additional metadata related to the result. code (str): A custom code identifying this specific @@ -943,10 +1304,24 @@ class Level(proto.Enum): WARNING = 1 ERROR = 2 - message = proto.Field(proto.STRING, number=1,) - level = proto.Field(proto.ENUM, number=2, enum=Level,) - metadata = proto.MapField(proto.STRING, proto.STRING, number=3,) - code = proto.Field(proto.STRING, number=4,) + message = proto.Field( + proto.STRING, + number=1, + ) + level = proto.Field( + proto.ENUM, + number=2, + enum=Level, + ) + metadata = proto.MapField( + proto.STRING, + proto.STRING, + number=3, + ) + code = proto.Field( + proto.STRING, + number=4, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/noxfile.py b/noxfile.py index 2a2001c..7c1742d 100644 --- a/noxfile.py +++ b/noxfile.py @@ -17,19 +17,45 @@ # Generated by synthtool. DO NOT EDIT! from __future__ import absolute_import + import os import pathlib import shutil +import warnings import nox - -BLACK_VERSION = "black==19.10b0" -BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +BLACK_VERSION = "black==22.3.0" +ISORT_VERSION = "isort==5.10.1" +LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" -SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] + UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] +UNIT_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "asyncmock", + "pytest", + "pytest-cov", + "pytest-asyncio", +] +UNIT_TEST_EXTERNAL_DEPENDENCIES = [] +UNIT_TEST_LOCAL_DEPENDENCIES = [] +UNIT_TEST_DEPENDENCIES = [] +UNIT_TEST_EXTRAS = [] +UNIT_TEST_EXTRAS_BY_PYTHON = {} + +SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] +SYSTEM_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "pytest", + "google-cloud-testutils", +] +SYSTEM_TEST_EXTERNAL_DEPENDENCIES = [] +SYSTEM_TEST_LOCAL_DEPENDENCIES = [] +SYSTEM_TEST_DEPENDENCIES = [] +SYSTEM_TEST_EXTRAS = [] +SYSTEM_TEST_EXTRAS_BY_PYTHON = {} CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() @@ -57,7 +83,9 @@ def lint(session): """ session.install("flake8", BLACK_VERSION) session.run( - "black", "--check", *BLACK_PATHS, + "black", + "--check", + *LINT_PATHS, ) session.run("flake8", "google", "tests") @@ -67,7 +95,28 @@ def blacken(session): """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) session.run( - "black", *BLACK_PATHS, + "black", + *LINT_PATHS, + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def format(session): + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run( + "isort", + "--fss", + *LINT_PATHS, + ) + session.run( + "black", + *LINT_PATHS, ) @@ -78,23 +127,41 @@ def lint_setup_py(session): session.run("python", "setup.py", "check", "--restructuredtext", "--strict") +def install_unittest_dependencies(session, *constraints): + standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES + session.install(*standard_deps, *constraints) + + if UNIT_TEST_EXTERNAL_DEPENDENCIES: + warnings.warn( + "'unit_test_external_dependencies' is deprecated. Instead, please " + "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", + DeprecationWarning, + ) + session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_LOCAL_DEPENDENCIES: + session.install(*UNIT_TEST_LOCAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_EXTRAS_BY_PYTHON: + extras = UNIT_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif UNIT_TEST_EXTRAS: + extras = UNIT_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + def default(session): # Install all test dependencies, then install this package in-place. constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) - session.install( - "mock", - "asyncmock", - "pytest", - "pytest-cov", - "pytest-asyncio", - "-c", - constraints_path, - ) - - session.install("-e", ".", "-c", constraints_path) + install_unittest_dependencies(session, "-c", constraints_path) # Run py.test against the unit tests. session.run( @@ -118,6 +185,35 @@ def unit(session): default(session) +def install_systemtest_dependencies(session, *constraints): + + # Use pre-release gRPC for system tests. + session.install("--pre", "grpcio") + + session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTERNAL_DEPENDENCIES: + session.install(*SYSTEM_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_LOCAL_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_LOCAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTRAS_BY_PYTHON: + extras = SYSTEM_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif SYSTEM_TEST_EXTRAS: + extras = SYSTEM_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" @@ -140,13 +236,7 @@ def system(session): if not system_test_exists and not system_test_folder_exists: session.skip("System tests were not found") - # Use pre-release gRPC for system tests. - session.install("--pre", "grpcio") - - # Install all test dependencies, then install this package into the - # virtualenv's dist-packages. - session.install("mock", "pytest", "google-cloud-testutils", "-c", constraints_path) - session.install("-e", ".", "-c", constraints_path) + install_systemtest_dependencies(session, "-c", constraints_path) # Run py.test against the system tests. if system_test_exists: diff --git a/samples/generated_samples/snippet_metadata_datastream_v1.json b/samples/generated_samples/snippet_metadata_datastream_v1.json index 41ce403..4d5a54b 100644 --- a/samples/generated_samples/snippet_metadata_datastream_v1.json +++ b/samples/generated_samples/snippet_metadata_datastream_v1.json @@ -1,16 +1,69 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.datastream.v1", + "version": "v1" + } + ], + "language": "PYTHON", + "name": "google-cloud-datastream" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.create_connection_profile", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.CreateConnectionProfile", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "CreateConnectionProfile" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.CreateConnectionProfileRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "connection_profile", + "type": "google.cloud.datastream_v1.types.ConnectionProfile" + }, + { + "name": "connection_profile_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_connection_profile" }, + "description": "Sample for CreateConnectionProfile", "file": "datastream_v1_generated_datastream_create_connection_profile_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_CreateConnectionProfile_async", "segments": [ { @@ -43,18 +96,62 @@ "start": 55, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_create_connection_profile_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.create_connection_profile", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.CreateConnectionProfile", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "CreateConnectionProfile" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.CreateConnectionProfileRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "connection_profile", + "type": "google.cloud.datastream_v1.types.ConnectionProfile" + }, + { + "name": "connection_profile_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_connection_profile" }, + "description": "Sample for CreateConnectionProfile", "file": "datastream_v1_generated_datastream_create_connection_profile_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_CreateConnectionProfile_sync", "segments": [ { @@ -87,19 +184,63 @@ "start": 55, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_create_connection_profile_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.create_private_connection", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.CreatePrivateConnection", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "CreatePrivateConnection" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.CreatePrivateConnectionRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "private_connection", + "type": "google.cloud.datastream_v1.types.PrivateConnection" + }, + { + "name": "private_connection_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_private_connection" }, + "description": "Sample for CreatePrivateConnection", "file": "datastream_v1_generated_datastream_create_private_connection_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_CreatePrivateConnection_async", "segments": [ { @@ -132,18 +273,62 @@ "start": 51, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_create_private_connection_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.create_private_connection", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.CreatePrivateConnection", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "CreatePrivateConnection" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.CreatePrivateConnectionRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "private_connection", + "type": "google.cloud.datastream_v1.types.PrivateConnection" + }, + { + "name": "private_connection_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_private_connection" }, + "description": "Sample for CreatePrivateConnection", "file": "datastream_v1_generated_datastream_create_private_connection_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_CreatePrivateConnection_sync", "segments": [ { @@ -176,19 +361,63 @@ "start": 51, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_create_private_connection_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.create_route", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.CreateRoute", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "CreateRoute" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.CreateRouteRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "route", + "type": "google.cloud.datastream_v1.types.Route" + }, + { + "name": "route_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_route" }, + "description": "Sample for CreateRoute", "file": "datastream_v1_generated_datastream_create_route_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_CreateRoute_async", "segments": [ { @@ -221,18 +450,62 @@ "start": 52, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_create_route_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.create_route", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.CreateRoute", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "CreateRoute" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.CreateRouteRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "route", + "type": "google.cloud.datastream_v1.types.Route" + }, + { + "name": "route_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_route" }, + "description": "Sample for CreateRoute", "file": "datastream_v1_generated_datastream_create_route_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_CreateRoute_sync", "segments": [ { @@ -265,19 +538,63 @@ "start": 52, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_create_route_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.create_stream", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.CreateStream", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "CreateStream" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.CreateStreamRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "stream", + "type": "google.cloud.datastream_v1.types.Stream" + }, + { + "name": "stream_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_stream" }, + "description": "Sample for CreateStream", "file": "datastream_v1_generated_datastream_create_stream_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_CreateStream_async", "segments": [ { @@ -310,18 +627,62 @@ "start": 53, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_create_stream_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.create_stream", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.CreateStream", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "CreateStream" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.CreateStreamRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "stream", + "type": "google.cloud.datastream_v1.types.Stream" + }, + { + "name": "stream_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_stream" }, + "description": "Sample for CreateStream", "file": "datastream_v1_generated_datastream_create_stream_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_CreateStream_sync", "segments": [ { @@ -354,19 +715,55 @@ "start": 53, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_create_stream_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.delete_connection_profile", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.DeleteConnectionProfile", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "DeleteConnectionProfile" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.DeleteConnectionProfileRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_connection_profile" }, + "description": "Sample for DeleteConnectionProfile", "file": "datastream_v1_generated_datastream_delete_connection_profile_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_DeleteConnectionProfile_async", "segments": [ { @@ -399,18 +796,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_delete_connection_profile_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.delete_connection_profile", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.DeleteConnectionProfile", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "DeleteConnectionProfile" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.DeleteConnectionProfileRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_connection_profile" }, + "description": "Sample for DeleteConnectionProfile", "file": "datastream_v1_generated_datastream_delete_connection_profile_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_DeleteConnectionProfile_sync", "segments": [ { @@ -443,19 +876,55 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_delete_connection_profile_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.delete_private_connection", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.DeletePrivateConnection", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "DeletePrivateConnection" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.DeletePrivateConnectionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_private_connection" }, + "description": "Sample for DeletePrivateConnection", "file": "datastream_v1_generated_datastream_delete_private_connection_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_DeletePrivateConnection_async", "segments": [ { @@ -488,18 +957,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_delete_private_connection_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.delete_private_connection", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.DeletePrivateConnection", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "DeletePrivateConnection" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.DeletePrivateConnectionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_private_connection" }, + "description": "Sample for DeletePrivateConnection", "file": "datastream_v1_generated_datastream_delete_private_connection_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_DeletePrivateConnection_sync", "segments": [ { @@ -532,19 +1037,55 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_delete_private_connection_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.delete_route", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.DeleteRoute", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "DeleteRoute" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.DeleteRouteRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_route" }, + "description": "Sample for DeleteRoute", "file": "datastream_v1_generated_datastream_delete_route_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_DeleteRoute_async", "segments": [ { @@ -577,18 +1118,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_delete_route_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.delete_route", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.DeleteRoute", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "DeleteRoute" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.DeleteRouteRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_route" }, + "description": "Sample for DeleteRoute", "file": "datastream_v1_generated_datastream_delete_route_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_DeleteRoute_sync", "segments": [ { @@ -621,19 +1198,55 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_delete_route_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.delete_stream", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.DeleteStream", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "DeleteStream" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.DeleteStreamRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_stream" }, + "description": "Sample for DeleteStream", "file": "datastream_v1_generated_datastream_delete_stream_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_DeleteStream_async", "segments": [ { @@ -666,18 +1279,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_delete_stream_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.delete_stream", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.DeleteStream", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "DeleteStream" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.DeleteStreamRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_stream" }, + "description": "Sample for DeleteStream", "file": "datastream_v1_generated_datastream_delete_stream_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_DeleteStream_sync", "segments": [ { @@ -710,19 +1359,51 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_delete_stream_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.discover_connection_profile", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.DiscoverConnectionProfile", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "DiscoverConnectionProfile" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.DiscoverConnectionProfileRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.types.DiscoverConnectionProfileResponse", + "shortName": "discover_connection_profile" }, + "description": "Sample for DiscoverConnectionProfile", "file": "datastream_v1_generated_datastream_discover_connection_profile_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_DiscoverConnectionProfile_async", "segments": [ { @@ -755,18 +1436,50 @@ "start": 51, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_discover_connection_profile_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.discover_connection_profile", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.DiscoverConnectionProfile", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "DiscoverConnectionProfile" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.DiscoverConnectionProfileRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.types.DiscoverConnectionProfileResponse", + "shortName": "discover_connection_profile" }, + "description": "Sample for DiscoverConnectionProfile", "file": "datastream_v1_generated_datastream_discover_connection_profile_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_DiscoverConnectionProfile_sync", "segments": [ { @@ -799,19 +1512,55 @@ "start": 51, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_discover_connection_profile_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.fetch_static_ips", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.FetchStaticIps", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "FetchStaticIps" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.FetchStaticIpsRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.services.datastream.pagers.FetchStaticIpsAsyncPager", + "shortName": "fetch_static_ips" }, + "description": "Sample for FetchStaticIps", "file": "datastream_v1_generated_datastream_fetch_static_ips_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_FetchStaticIps_async", "segments": [ { @@ -844,18 +1593,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_fetch_static_ips_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.fetch_static_ips", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.FetchStaticIps", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "FetchStaticIps" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.FetchStaticIpsRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.services.datastream.pagers.FetchStaticIpsPager", + "shortName": "fetch_static_ips" }, + "description": "Sample for FetchStaticIps", "file": "datastream_v1_generated_datastream_fetch_static_ips_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_FetchStaticIps_sync", "segments": [ { @@ -888,19 +1673,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_fetch_static_ips_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.get_connection_profile", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.GetConnectionProfile", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "GetConnectionProfile" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.GetConnectionProfileRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.types.ConnectionProfile", + "shortName": "get_connection_profile" }, + "description": "Sample for GetConnectionProfile", "file": "datastream_v1_generated_datastream_get_connection_profile_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_GetConnectionProfile_async", "segments": [ { @@ -933,18 +1754,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_get_connection_profile_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.get_connection_profile", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.GetConnectionProfile", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "GetConnectionProfile" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.GetConnectionProfileRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.types.ConnectionProfile", + "shortName": "get_connection_profile" }, + "description": "Sample for GetConnectionProfile", "file": "datastream_v1_generated_datastream_get_connection_profile_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_GetConnectionProfile_sync", "segments": [ { @@ -977,19 +1834,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_get_connection_profile_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.get_private_connection", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.GetPrivateConnection", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "GetPrivateConnection" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.GetPrivateConnectionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.types.PrivateConnection", + "shortName": "get_private_connection" }, + "description": "Sample for GetPrivateConnection", "file": "datastream_v1_generated_datastream_get_private_connection_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_GetPrivateConnection_async", "segments": [ { @@ -1022,18 +1915,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_get_private_connection_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.get_private_connection", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.GetPrivateConnection", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "GetPrivateConnection" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.GetPrivateConnectionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.types.PrivateConnection", + "shortName": "get_private_connection" }, + "description": "Sample for GetPrivateConnection", "file": "datastream_v1_generated_datastream_get_private_connection_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_GetPrivateConnection_sync", "segments": [ { @@ -1066,19 +1995,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_get_private_connection_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.get_route", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.GetRoute", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "GetRoute" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.GetRouteRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.types.Route", + "shortName": "get_route" }, + "description": "Sample for GetRoute", "file": "datastream_v1_generated_datastream_get_route_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_GetRoute_async", "segments": [ { @@ -1111,18 +2076,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_get_route_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.get_route", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.GetRoute", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "GetRoute" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.GetRouteRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.types.Route", + "shortName": "get_route" }, + "description": "Sample for GetRoute", "file": "datastream_v1_generated_datastream_get_route_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_GetRoute_sync", "segments": [ { @@ -1155,19 +2156,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_get_route_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.get_stream_object", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.GetStreamObject", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "GetStreamObject" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.GetStreamObjectRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.types.StreamObject", + "shortName": "get_stream_object" }, + "description": "Sample for GetStreamObject", "file": "datastream_v1_generated_datastream_get_stream_object_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_GetStreamObject_async", "segments": [ { @@ -1200,18 +2237,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_get_stream_object_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.get_stream_object", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.GetStreamObject", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "GetStreamObject" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.GetStreamObjectRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.types.StreamObject", + "shortName": "get_stream_object" }, + "description": "Sample for GetStreamObject", "file": "datastream_v1_generated_datastream_get_stream_object_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_GetStreamObject_sync", "segments": [ { @@ -1244,19 +2317,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_get_stream_object_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.get_stream", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.GetStream", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "GetStream" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.GetStreamRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.types.Stream", + "shortName": "get_stream" }, + "description": "Sample for GetStream", "file": "datastream_v1_generated_datastream_get_stream_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_GetStream_async", "segments": [ { @@ -1289,18 +2398,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_get_stream_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.get_stream", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.GetStream", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "GetStream" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.GetStreamRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.types.Stream", + "shortName": "get_stream" }, + "description": "Sample for GetStream", "file": "datastream_v1_generated_datastream_get_stream_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_GetStream_sync", "segments": [ { @@ -1333,19 +2478,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_get_stream_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.list_connection_profiles", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.ListConnectionProfiles", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "ListConnectionProfiles" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.ListConnectionProfilesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.services.datastream.pagers.ListConnectionProfilesAsyncPager", + "shortName": "list_connection_profiles" }, + "description": "Sample for ListConnectionProfiles", "file": "datastream_v1_generated_datastream_list_connection_profiles_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_ListConnectionProfiles_async", "segments": [ { @@ -1378,18 +2559,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_list_connection_profiles_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.list_connection_profiles", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.ListConnectionProfiles", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "ListConnectionProfiles" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.ListConnectionProfilesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.services.datastream.pagers.ListConnectionProfilesPager", + "shortName": "list_connection_profiles" }, + "description": "Sample for ListConnectionProfiles", "file": "datastream_v1_generated_datastream_list_connection_profiles_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_ListConnectionProfiles_sync", "segments": [ { @@ -1422,19 +2639,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_list_connection_profiles_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.list_private_connections", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.ListPrivateConnections", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "ListPrivateConnections" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.ListPrivateConnectionsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.services.datastream.pagers.ListPrivateConnectionsAsyncPager", + "shortName": "list_private_connections" }, + "description": "Sample for ListPrivateConnections", "file": "datastream_v1_generated_datastream_list_private_connections_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_ListPrivateConnections_async", "segments": [ { @@ -1467,18 +2720,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_list_private_connections_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.list_private_connections", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.ListPrivateConnections", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "ListPrivateConnections" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.ListPrivateConnectionsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.services.datastream.pagers.ListPrivateConnectionsPager", + "shortName": "list_private_connections" }, + "description": "Sample for ListPrivateConnections", "file": "datastream_v1_generated_datastream_list_private_connections_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_ListPrivateConnections_sync", "segments": [ { @@ -1511,19 +2800,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_list_private_connections_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.list_routes", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.ListRoutes", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "ListRoutes" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.ListRoutesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.services.datastream.pagers.ListRoutesAsyncPager", + "shortName": "list_routes" }, + "description": "Sample for ListRoutes", "file": "datastream_v1_generated_datastream_list_routes_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_ListRoutes_async", "segments": [ { @@ -1556,18 +2881,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_list_routes_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.list_routes", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.ListRoutes", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "ListRoutes" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.ListRoutesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.services.datastream.pagers.ListRoutesPager", + "shortName": "list_routes" }, + "description": "Sample for ListRoutes", "file": "datastream_v1_generated_datastream_list_routes_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_ListRoutes_sync", "segments": [ { @@ -1600,19 +2961,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_list_routes_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.list_stream_objects", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.ListStreamObjects", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "ListStreamObjects" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.ListStreamObjectsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.services.datastream.pagers.ListStreamObjectsAsyncPager", + "shortName": "list_stream_objects" }, + "description": "Sample for ListStreamObjects", "file": "datastream_v1_generated_datastream_list_stream_objects_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_ListStreamObjects_async", "segments": [ { @@ -1645,18 +3042,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_list_stream_objects_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.list_stream_objects", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.ListStreamObjects", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "ListStreamObjects" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.ListStreamObjectsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.services.datastream.pagers.ListStreamObjectsPager", + "shortName": "list_stream_objects" }, + "description": "Sample for ListStreamObjects", "file": "datastream_v1_generated_datastream_list_stream_objects_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_ListStreamObjects_sync", "segments": [ { @@ -1689,19 +3122,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_list_stream_objects_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.list_streams", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.ListStreams", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "ListStreams" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.ListStreamsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.services.datastream.pagers.ListStreamsAsyncPager", + "shortName": "list_streams" }, + "description": "Sample for ListStreams", "file": "datastream_v1_generated_datastream_list_streams_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_ListStreams_async", "segments": [ { @@ -1734,18 +3203,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_list_streams_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.list_streams", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.ListStreams", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "ListStreams" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.ListStreamsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.services.datastream.pagers.ListStreamsPager", + "shortName": "list_streams" }, + "description": "Sample for ListStreams", "file": "datastream_v1_generated_datastream_list_streams_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_ListStreams_sync", "segments": [ { @@ -1778,19 +3283,51 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_list_streams_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.lookup_stream_object", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.LookupStreamObject", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "LookupStreamObject" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.LookupStreamObjectRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.types.StreamObject", + "shortName": "lookup_stream_object" }, + "description": "Sample for LookupStreamObject", "file": "datastream_v1_generated_datastream_lookup_stream_object_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_LookupStreamObject_async", "segments": [ { @@ -1823,18 +3360,50 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_lookup_stream_object_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.lookup_stream_object", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.LookupStreamObject", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "LookupStreamObject" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.LookupStreamObjectRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.types.StreamObject", + "shortName": "lookup_stream_object" }, + "description": "Sample for LookupStreamObject", "file": "datastream_v1_generated_datastream_lookup_stream_object_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_LookupStreamObject_sync", "segments": [ { @@ -1867,19 +3436,55 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_lookup_stream_object_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.start_backfill_job", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.StartBackfillJob", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "StartBackfillJob" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.StartBackfillJobRequest" + }, + { + "name": "object_", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.types.StartBackfillJobResponse", + "shortName": "start_backfill_job" }, + "description": "Sample for StartBackfillJob", "file": "datastream_v1_generated_datastream_start_backfill_job_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_StartBackfillJob_async", "segments": [ { @@ -1912,18 +3517,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_start_backfill_job_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.start_backfill_job", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.StartBackfillJob", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "StartBackfillJob" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.StartBackfillJobRequest" + }, + { + "name": "object_", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.types.StartBackfillJobResponse", + "shortName": "start_backfill_job" }, + "description": "Sample for StartBackfillJob", "file": "datastream_v1_generated_datastream_start_backfill_job_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_StartBackfillJob_sync", "segments": [ { @@ -1956,19 +3597,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_start_backfill_job_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.stop_backfill_job", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.StopBackfillJob", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "StopBackfillJob" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.StopBackfillJobRequest" + }, + { + "name": "object_", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.types.StopBackfillJobResponse", + "shortName": "stop_backfill_job" }, + "description": "Sample for StopBackfillJob", "file": "datastream_v1_generated_datastream_stop_backfill_job_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_StopBackfillJob_async", "segments": [ { @@ -2001,18 +3678,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_stop_backfill_job_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.stop_backfill_job", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.StopBackfillJob", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "StopBackfillJob" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.StopBackfillJobRequest" + }, + { + "name": "object_", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1.types.StopBackfillJobResponse", + "shortName": "stop_backfill_job" }, + "description": "Sample for StopBackfillJob", "file": "datastream_v1_generated_datastream_stop_backfill_job_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_StopBackfillJob_sync", "segments": [ { @@ -2045,19 +3758,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_stop_backfill_job_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.update_connection_profile", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.UpdateConnectionProfile", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "UpdateConnectionProfile" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.UpdateConnectionProfileRequest" + }, + { + "name": "connection_profile", + "type": "google.cloud.datastream_v1.types.ConnectionProfile" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "update_connection_profile" }, + "description": "Sample for UpdateConnectionProfile", "file": "datastream_v1_generated_datastream_update_connection_profile_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_UpdateConnectionProfile_async", "segments": [ { @@ -2090,18 +3843,58 @@ "start": 53, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_update_connection_profile_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.update_connection_profile", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.UpdateConnectionProfile", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "UpdateConnectionProfile" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.UpdateConnectionProfileRequest" + }, + { + "name": "connection_profile", + "type": "google.cloud.datastream_v1.types.ConnectionProfile" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "update_connection_profile" }, + "description": "Sample for UpdateConnectionProfile", "file": "datastream_v1_generated_datastream_update_connection_profile_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_UpdateConnectionProfile_sync", "segments": [ { @@ -2134,19 +3927,59 @@ "start": 53, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_update_connection_profile_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamAsyncClient.update_stream", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.UpdateStream", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "UpdateStream" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.UpdateStreamRequest" + }, + { + "name": "stream", + "type": "google.cloud.datastream_v1.types.Stream" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "update_stream" }, + "description": "Sample for UpdateStream", "file": "datastream_v1_generated_datastream_update_stream_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_UpdateStream_async", "segments": [ { @@ -2179,18 +4012,58 @@ "start": 51, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_update_stream_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1.DatastreamClient.update_stream", "method": { + "fullName": "google.cloud.datastream.v1.Datastream.UpdateStream", "service": { + "fullName": "google.cloud.datastream.v1.Datastream", "shortName": "Datastream" }, "shortName": "UpdateStream" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1.types.UpdateStreamRequest" + }, + { + "name": "stream", + "type": "google.cloud.datastream_v1.types.Stream" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "update_stream" }, + "description": "Sample for UpdateStream", "file": "datastream_v1_generated_datastream_update_stream_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1_generated_Datastream_UpdateStream_sync", "segments": [ { @@ -2223,7 +4096,8 @@ "start": 51, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1_generated_datastream_update_stream_sync.py" } ] } diff --git a/samples/generated_samples/snippet_metadata_datastream_v1alpha1.json b/samples/generated_samples/snippet_metadata_datastream_v1alpha1.json index c68d11b..83dc755 100644 --- a/samples/generated_samples/snippet_metadata_datastream_v1alpha1.json +++ b/samples/generated_samples/snippet_metadata_datastream_v1alpha1.json @@ -1,16 +1,69 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.datastream.v1alpha1", + "version": "v1alpha1" + } + ], + "language": "PYTHON", + "name": "google-cloud-datastream" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient.create_connection_profile", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.CreateConnectionProfile", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "CreateConnectionProfile" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.CreateConnectionProfileRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "connection_profile", + "type": "google.cloud.datastream_v1alpha1.types.ConnectionProfile" + }, + { + "name": "connection_profile_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_connection_profile" }, + "description": "Sample for CreateConnectionProfile", "file": "datastream_v1alpha1_generated_datastream_create_connection_profile_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_CreateConnectionProfile_async", "segments": [ { @@ -43,18 +96,62 @@ "start": 55, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_create_connection_profile_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient.create_connection_profile", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.CreateConnectionProfile", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "CreateConnectionProfile" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.CreateConnectionProfileRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "connection_profile", + "type": "google.cloud.datastream_v1alpha1.types.ConnectionProfile" + }, + { + "name": "connection_profile_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_connection_profile" }, + "description": "Sample for CreateConnectionProfile", "file": "datastream_v1alpha1_generated_datastream_create_connection_profile_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_CreateConnectionProfile_sync", "segments": [ { @@ -87,19 +184,63 @@ "start": 55, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_create_connection_profile_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient.create_private_connection", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.CreatePrivateConnection", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "CreatePrivateConnection" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.CreatePrivateConnectionRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "private_connection", + "type": "google.cloud.datastream_v1alpha1.types.PrivateConnection" + }, + { + "name": "private_connection_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_private_connection" }, + "description": "Sample for CreatePrivateConnection", "file": "datastream_v1alpha1_generated_datastream_create_private_connection_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_CreatePrivateConnection_async", "segments": [ { @@ -132,18 +273,62 @@ "start": 51, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_create_private_connection_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient.create_private_connection", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.CreatePrivateConnection", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "CreatePrivateConnection" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.CreatePrivateConnectionRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "private_connection", + "type": "google.cloud.datastream_v1alpha1.types.PrivateConnection" + }, + { + "name": "private_connection_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_private_connection" }, + "description": "Sample for CreatePrivateConnection", "file": "datastream_v1alpha1_generated_datastream_create_private_connection_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_CreatePrivateConnection_sync", "segments": [ { @@ -176,19 +361,63 @@ "start": 51, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_create_private_connection_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient.create_route", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.CreateRoute", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "CreateRoute" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.CreateRouteRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "route", + "type": "google.cloud.datastream_v1alpha1.types.Route" + }, + { + "name": "route_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_route" }, + "description": "Sample for CreateRoute", "file": "datastream_v1alpha1_generated_datastream_create_route_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_CreateRoute_async", "segments": [ { @@ -221,18 +450,62 @@ "start": 52, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_create_route_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient.create_route", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.CreateRoute", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "CreateRoute" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.CreateRouteRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "route", + "type": "google.cloud.datastream_v1alpha1.types.Route" + }, + { + "name": "route_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_route" }, + "description": "Sample for CreateRoute", "file": "datastream_v1alpha1_generated_datastream_create_route_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_CreateRoute_sync", "segments": [ { @@ -265,19 +538,63 @@ "start": 52, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_create_route_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient.create_stream", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.CreateStream", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "CreateStream" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.CreateStreamRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "stream", + "type": "google.cloud.datastream_v1alpha1.types.Stream" + }, + { + "name": "stream_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_stream" }, + "description": "Sample for CreateStream", "file": "datastream_v1alpha1_generated_datastream_create_stream_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_CreateStream_async", "segments": [ { @@ -310,18 +627,62 @@ "start": 53, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_create_stream_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient.create_stream", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.CreateStream", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "CreateStream" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.CreateStreamRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "stream", + "type": "google.cloud.datastream_v1alpha1.types.Stream" + }, + { + "name": "stream_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_stream" }, + "description": "Sample for CreateStream", "file": "datastream_v1alpha1_generated_datastream_create_stream_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_CreateStream_sync", "segments": [ { @@ -354,19 +715,55 @@ "start": 53, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_create_stream_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient.delete_connection_profile", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.DeleteConnectionProfile", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "DeleteConnectionProfile" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.DeleteConnectionProfileRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_connection_profile" }, + "description": "Sample for DeleteConnectionProfile", "file": "datastream_v1alpha1_generated_datastream_delete_connection_profile_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_DeleteConnectionProfile_async", "segments": [ { @@ -399,18 +796,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_delete_connection_profile_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient.delete_connection_profile", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.DeleteConnectionProfile", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "DeleteConnectionProfile" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.DeleteConnectionProfileRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_connection_profile" }, + "description": "Sample for DeleteConnectionProfile", "file": "datastream_v1alpha1_generated_datastream_delete_connection_profile_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_DeleteConnectionProfile_sync", "segments": [ { @@ -443,19 +876,55 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_delete_connection_profile_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient.delete_private_connection", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.DeletePrivateConnection", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "DeletePrivateConnection" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.DeletePrivateConnectionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_private_connection" }, + "description": "Sample for DeletePrivateConnection", "file": "datastream_v1alpha1_generated_datastream_delete_private_connection_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_DeletePrivateConnection_async", "segments": [ { @@ -488,18 +957,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_delete_private_connection_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient.delete_private_connection", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.DeletePrivateConnection", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "DeletePrivateConnection" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.DeletePrivateConnectionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_private_connection" }, + "description": "Sample for DeletePrivateConnection", "file": "datastream_v1alpha1_generated_datastream_delete_private_connection_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_DeletePrivateConnection_sync", "segments": [ { @@ -532,19 +1037,55 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_delete_private_connection_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient.delete_route", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.DeleteRoute", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "DeleteRoute" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.DeleteRouteRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_route" }, + "description": "Sample for DeleteRoute", "file": "datastream_v1alpha1_generated_datastream_delete_route_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_DeleteRoute_async", "segments": [ { @@ -577,18 +1118,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_delete_route_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient.delete_route", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.DeleteRoute", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "DeleteRoute" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.DeleteRouteRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_route" }, + "description": "Sample for DeleteRoute", "file": "datastream_v1alpha1_generated_datastream_delete_route_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_DeleteRoute_sync", "segments": [ { @@ -621,19 +1198,55 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_delete_route_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient.delete_stream", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.DeleteStream", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "DeleteStream" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.DeleteStreamRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_stream" }, + "description": "Sample for DeleteStream", "file": "datastream_v1alpha1_generated_datastream_delete_stream_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_DeleteStream_async", "segments": [ { @@ -666,18 +1279,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_delete_stream_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient.delete_stream", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.DeleteStream", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "DeleteStream" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.DeleteStreamRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_stream" }, + "description": "Sample for DeleteStream", "file": "datastream_v1alpha1_generated_datastream_delete_stream_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_DeleteStream_sync", "segments": [ { @@ -710,19 +1359,51 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_delete_stream_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient.discover_connection_profile", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.DiscoverConnectionProfile", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "DiscoverConnectionProfile" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.DiscoverConnectionProfileRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1alpha1.types.DiscoverConnectionProfileResponse", + "shortName": "discover_connection_profile" }, + "description": "Sample for DiscoverConnectionProfile", "file": "datastream_v1alpha1_generated_datastream_discover_connection_profile_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_DiscoverConnectionProfile_async", "segments": [ { @@ -755,18 +1436,50 @@ "start": 51, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_discover_connection_profile_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient.discover_connection_profile", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.DiscoverConnectionProfile", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "DiscoverConnectionProfile" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.DiscoverConnectionProfileRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1alpha1.types.DiscoverConnectionProfileResponse", + "shortName": "discover_connection_profile" }, + "description": "Sample for DiscoverConnectionProfile", "file": "datastream_v1alpha1_generated_datastream_discover_connection_profile_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_DiscoverConnectionProfile_sync", "segments": [ { @@ -799,19 +1512,51 @@ "start": 51, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_discover_connection_profile_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient.fetch_errors", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.FetchErrors", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "FetchErrors" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.FetchErrorsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "fetch_errors" }, + "description": "Sample for FetchErrors", "file": "datastream_v1alpha1_generated_datastream_fetch_errors_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_FetchErrors_async", "segments": [ { @@ -844,18 +1589,50 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_fetch_errors_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient.fetch_errors", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.FetchErrors", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "FetchErrors" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.FetchErrorsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "fetch_errors" }, + "description": "Sample for FetchErrors", "file": "datastream_v1alpha1_generated_datastream_fetch_errors_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_FetchErrors_sync", "segments": [ { @@ -888,19 +1665,55 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_fetch_errors_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient.fetch_static_ips", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.FetchStaticIps", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "FetchStaticIps" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.FetchStaticIpsRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1alpha1.services.datastream.pagers.FetchStaticIpsAsyncPager", + "shortName": "fetch_static_ips" }, + "description": "Sample for FetchStaticIps", "file": "datastream_v1alpha1_generated_datastream_fetch_static_ips_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_FetchStaticIps_async", "segments": [ { @@ -933,18 +1746,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_fetch_static_ips_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient.fetch_static_ips", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.FetchStaticIps", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "FetchStaticIps" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.FetchStaticIpsRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1alpha1.services.datastream.pagers.FetchStaticIpsPager", + "shortName": "fetch_static_ips" }, + "description": "Sample for FetchStaticIps", "file": "datastream_v1alpha1_generated_datastream_fetch_static_ips_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_FetchStaticIps_sync", "segments": [ { @@ -977,19 +1826,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_fetch_static_ips_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient.get_connection_profile", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.GetConnectionProfile", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "GetConnectionProfile" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.GetConnectionProfileRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1alpha1.types.ConnectionProfile", + "shortName": "get_connection_profile" }, + "description": "Sample for GetConnectionProfile", "file": "datastream_v1alpha1_generated_datastream_get_connection_profile_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_GetConnectionProfile_async", "segments": [ { @@ -1022,18 +1907,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_get_connection_profile_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient.get_connection_profile", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.GetConnectionProfile", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "GetConnectionProfile" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.GetConnectionProfileRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1alpha1.types.ConnectionProfile", + "shortName": "get_connection_profile" }, + "description": "Sample for GetConnectionProfile", "file": "datastream_v1alpha1_generated_datastream_get_connection_profile_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_GetConnectionProfile_sync", "segments": [ { @@ -1066,19 +1987,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_get_connection_profile_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient.get_private_connection", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.GetPrivateConnection", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "GetPrivateConnection" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.GetPrivateConnectionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1alpha1.types.PrivateConnection", + "shortName": "get_private_connection" }, + "description": "Sample for GetPrivateConnection", "file": "datastream_v1alpha1_generated_datastream_get_private_connection_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_GetPrivateConnection_async", "segments": [ { @@ -1111,18 +2068,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_get_private_connection_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient.get_private_connection", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.GetPrivateConnection", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "GetPrivateConnection" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.GetPrivateConnectionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1alpha1.types.PrivateConnection", + "shortName": "get_private_connection" }, + "description": "Sample for GetPrivateConnection", "file": "datastream_v1alpha1_generated_datastream_get_private_connection_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_GetPrivateConnection_sync", "segments": [ { @@ -1155,19 +2148,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_get_private_connection_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient.get_route", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.GetRoute", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "GetRoute" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.GetRouteRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1alpha1.types.Route", + "shortName": "get_route" }, + "description": "Sample for GetRoute", "file": "datastream_v1alpha1_generated_datastream_get_route_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_GetRoute_async", "segments": [ { @@ -1200,18 +2229,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_get_route_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient.get_route", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.GetRoute", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "GetRoute" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.GetRouteRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1alpha1.types.Route", + "shortName": "get_route" }, + "description": "Sample for GetRoute", "file": "datastream_v1alpha1_generated_datastream_get_route_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_GetRoute_sync", "segments": [ { @@ -1244,19 +2309,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_get_route_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient.get_stream", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.GetStream", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "GetStream" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.GetStreamRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1alpha1.types.Stream", + "shortName": "get_stream" }, + "description": "Sample for GetStream", "file": "datastream_v1alpha1_generated_datastream_get_stream_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_GetStream_async", "segments": [ { @@ -1289,18 +2390,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_get_stream_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient.get_stream", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.GetStream", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "GetStream" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.GetStreamRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1alpha1.types.Stream", + "shortName": "get_stream" }, + "description": "Sample for GetStream", "file": "datastream_v1alpha1_generated_datastream_get_stream_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_GetStream_sync", "segments": [ { @@ -1333,19 +2470,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_get_stream_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient.list_connection_profiles", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.ListConnectionProfiles", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "ListConnectionProfiles" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.ListConnectionProfilesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1alpha1.services.datastream.pagers.ListConnectionProfilesAsyncPager", + "shortName": "list_connection_profiles" }, + "description": "Sample for ListConnectionProfiles", "file": "datastream_v1alpha1_generated_datastream_list_connection_profiles_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_ListConnectionProfiles_async", "segments": [ { @@ -1378,18 +2551,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_list_connection_profiles_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient.list_connection_profiles", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.ListConnectionProfiles", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "ListConnectionProfiles" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.ListConnectionProfilesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1alpha1.services.datastream.pagers.ListConnectionProfilesPager", + "shortName": "list_connection_profiles" }, + "description": "Sample for ListConnectionProfiles", "file": "datastream_v1alpha1_generated_datastream_list_connection_profiles_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_ListConnectionProfiles_sync", "segments": [ { @@ -1422,19 +2631,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_list_connection_profiles_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient.list_private_connections", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.ListPrivateConnections", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "ListPrivateConnections" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.ListPrivateConnectionsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1alpha1.services.datastream.pagers.ListPrivateConnectionsAsyncPager", + "shortName": "list_private_connections" }, + "description": "Sample for ListPrivateConnections", "file": "datastream_v1alpha1_generated_datastream_list_private_connections_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_ListPrivateConnections_async", "segments": [ { @@ -1467,18 +2712,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_list_private_connections_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient.list_private_connections", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.ListPrivateConnections", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "ListPrivateConnections" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.ListPrivateConnectionsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1alpha1.services.datastream.pagers.ListPrivateConnectionsPager", + "shortName": "list_private_connections" }, + "description": "Sample for ListPrivateConnections", "file": "datastream_v1alpha1_generated_datastream_list_private_connections_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_ListPrivateConnections_sync", "segments": [ { @@ -1511,19 +2792,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_list_private_connections_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient.list_routes", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.ListRoutes", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "ListRoutes" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.ListRoutesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1alpha1.services.datastream.pagers.ListRoutesAsyncPager", + "shortName": "list_routes" }, + "description": "Sample for ListRoutes", "file": "datastream_v1alpha1_generated_datastream_list_routes_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_ListRoutes_async", "segments": [ { @@ -1556,18 +2873,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_list_routes_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient.list_routes", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.ListRoutes", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "ListRoutes" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.ListRoutesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1alpha1.services.datastream.pagers.ListRoutesPager", + "shortName": "list_routes" }, + "description": "Sample for ListRoutes", "file": "datastream_v1alpha1_generated_datastream_list_routes_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_ListRoutes_sync", "segments": [ { @@ -1600,19 +2953,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_list_routes_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient.list_streams", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.ListStreams", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "ListStreams" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.ListStreamsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1alpha1.services.datastream.pagers.ListStreamsAsyncPager", + "shortName": "list_streams" }, + "description": "Sample for ListStreams", "file": "datastream_v1alpha1_generated_datastream_list_streams_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_ListStreams_async", "segments": [ { @@ -1645,18 +3034,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_list_streams_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient.list_streams", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.ListStreams", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "ListStreams" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.ListStreamsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.datastream_v1alpha1.services.datastream.pagers.ListStreamsPager", + "shortName": "list_streams" }, + "description": "Sample for ListStreams", "file": "datastream_v1alpha1_generated_datastream_list_streams_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_ListStreams_sync", "segments": [ { @@ -1689,19 +3114,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_list_streams_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient.update_connection_profile", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.UpdateConnectionProfile", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "UpdateConnectionProfile" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.UpdateConnectionProfileRequest" + }, + { + "name": "connection_profile", + "type": "google.cloud.datastream_v1alpha1.types.ConnectionProfile" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "update_connection_profile" }, + "description": "Sample for UpdateConnectionProfile", "file": "datastream_v1alpha1_generated_datastream_update_connection_profile_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_UpdateConnectionProfile_async", "segments": [ { @@ -1734,18 +3199,58 @@ "start": 53, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_update_connection_profile_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient.update_connection_profile", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.UpdateConnectionProfile", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "UpdateConnectionProfile" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.UpdateConnectionProfileRequest" + }, + { + "name": "connection_profile", + "type": "google.cloud.datastream_v1alpha1.types.ConnectionProfile" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "update_connection_profile" }, + "description": "Sample for UpdateConnectionProfile", "file": "datastream_v1alpha1_generated_datastream_update_connection_profile_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_UpdateConnectionProfile_sync", "segments": [ { @@ -1778,19 +3283,59 @@ "start": 53, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_update_connection_profile_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient", + "shortName": "DatastreamAsyncClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamAsyncClient.update_stream", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.UpdateStream", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "UpdateStream" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.UpdateStreamRequest" + }, + { + "name": "stream", + "type": "google.cloud.datastream_v1alpha1.types.Stream" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "update_stream" }, + "description": "Sample for UpdateStream", "file": "datastream_v1alpha1_generated_datastream_update_stream_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_UpdateStream_async", "segments": [ { @@ -1823,18 +3368,58 @@ "start": 51, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_update_stream_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient", + "shortName": "DatastreamClient" + }, + "fullName": "google.cloud.datastream_v1alpha1.DatastreamClient.update_stream", "method": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream.UpdateStream", "service": { + "fullName": "google.cloud.datastream.v1alpha1.Datastream", "shortName": "Datastream" }, "shortName": "UpdateStream" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.datastream_v1alpha1.types.UpdateStreamRequest" + }, + { + "name": "stream", + "type": "google.cloud.datastream_v1alpha1.types.Stream" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "update_stream" }, + "description": "Sample for UpdateStream", "file": "datastream_v1alpha1_generated_datastream_update_stream_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "datastream_v1alpha1_generated_Datastream_UpdateStream_sync", "segments": [ { @@ -1867,7 +3452,8 @@ "start": 51, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "datastream_v1alpha1_generated_datastream_update_stream_sync.py" } ] } diff --git a/scripts/readme-gen/readme_gen.py b/scripts/readme-gen/readme_gen.py index d309d6e..91b5967 100644 --- a/scripts/readme-gen/readme_gen.py +++ b/scripts/readme-gen/readme_gen.py @@ -28,7 +28,10 @@ jinja_env = jinja2.Environment( trim_blocks=True, loader=jinja2.FileSystemLoader( - os.path.abspath(os.path.join(os.path.dirname(__file__), 'templates')))) + os.path.abspath(os.path.join(os.path.dirname(__file__), "templates")) + ), + autoescape=True, +) README_TMPL = jinja_env.get_template('README.tmpl.rst') diff --git a/setup.py b/setup.py index 7d33b0b..b369ee5 100644 --- a/setup.py +++ b/setup.py @@ -19,10 +19,9 @@ import setuptools - name = "google-cloud-datastream" description = "Datastream client library" -version = "1.0.0" +version = "1.0.1" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-datastream" dependencies = [ diff --git a/tests/unit/gapic/datastream_v1/test_datastream.py b/tests/unit/gapic/datastream_v1/test_datastream.py index ce7fc66..09e4ffb 100644 --- a/tests/unit/gapic/datastream_v1/test_datastream.py +++ b/tests/unit/gapic/datastream_v1/test_datastream.py @@ -13,40 +13,42 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import os -import mock - -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule - +import os +from google.api_core import ( + future, + gapic_v1, + grpc_helpers, + grpc_helpers_async, + operation, + operations_v1, + path_template, +) from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import future -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import operation from google.api_core import operation_async # type: ignore -from google.api_core import operations_v1 -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError -from google.cloud.datastream_v1.services.datastream import DatastreamAsyncClient -from google.cloud.datastream_v1.services.datastream import DatastreamClient -from google.cloud.datastream_v1.services.datastream import pagers -from google.cloud.datastream_v1.services.datastream import transports -from google.cloud.datastream_v1.types import datastream -from google.cloud.datastream_v1.types import datastream_resources from google.longrunning import operations_pb2 from google.oauth2 import service_account from google.protobuf import duration_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -import google.auth +import grpc +from grpc.experimental import aio +import mock +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + +from google.cloud.datastream_v1.services.datastream import ( + DatastreamAsyncClient, + DatastreamClient, + pagers, + transports, +) +from google.cloud.datastream_v1.types import datastream, datastream_resources def client_cert_source_callback(): @@ -90,19 +92,25 @@ def test__get_default_mtls_endpoint(): assert DatastreamClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [DatastreamClient, DatastreamAsyncClient,]) -def test_datastream_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (DatastreamClient, "grpc"), + (DatastreamAsyncClient, "grpc_asyncio"), + ], +) +def test_datastream_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "datastream.googleapis.com:443" + assert client.transport._host == ("datastream.googleapis.com:443") @pytest.mark.parametrize( @@ -130,22 +138,32 @@ def test_datastream_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [DatastreamClient, DatastreamAsyncClient,]) -def test_datastream_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (DatastreamClient, "grpc"), + (DatastreamAsyncClient, "grpc_asyncio"), + ], +) +def test_datastream_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "datastream.googleapis.com:443" + assert client.transport._host == ("datastream.googleapis.com:443") def test_datastream_client_get_transport_class(): @@ -485,7 +503,9 @@ def test_datastream_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -614,11 +634,16 @@ def test_datastream_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [datastream.ListConnectionProfilesRequest, dict,] + "request_type", + [ + datastream.ListConnectionProfilesRequest, + dict, + ], ) def test_list_connection_profiles(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -631,7 +656,8 @@ def test_list_connection_profiles(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = datastream.ListConnectionProfilesResponse( - next_page_token="next_page_token_value", unreachable=["unreachable_value"], + next_page_token="next_page_token_value", + unreachable=["unreachable_value"], ) response = client.list_connection_profiles(request) @@ -650,7 +676,8 @@ def test_list_connection_profiles_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -669,7 +696,8 @@ async def test_list_connection_profiles_async( request_type=datastream.ListConnectionProfilesRequest, ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -706,13 +734,15 @@ async def test_list_connection_profiles_async_from_dict(): def test_list_connection_profiles_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.ListConnectionProfilesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -728,18 +758,23 @@ def test_list_connection_profiles_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_connection_profiles_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.ListConnectionProfilesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -757,11 +792,16 @@ async def test_list_connection_profiles_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_connection_profiles_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -771,7 +811,9 @@ def test_list_connection_profiles_flattened(): call.return_value = datastream.ListConnectionProfilesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_connection_profiles(parent="parent_value",) + client.list_connection_profiles( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -783,19 +825,24 @@ def test_list_connection_profiles_flattened(): def test_list_connection_profiles_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_connection_profiles( - datastream.ListConnectionProfilesRequest(), parent="parent_value", + datastream.ListConnectionProfilesRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_connection_profiles_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -809,7 +856,9 @@ async def test_list_connection_profiles_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_connection_profiles(parent="parent_value",) + response = await client.list_connection_profiles( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -822,19 +871,23 @@ async def test_list_connection_profiles_flattened_async(): @pytest.mark.asyncio async def test_list_connection_profiles_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_connection_profiles( - datastream.ListConnectionProfilesRequest(), parent="parent_value", + datastream.ListConnectionProfilesRequest(), + parent="parent_value", ) def test_list_connection_profiles_pager(transport_name: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -852,10 +905,13 @@ def test_list_connection_profiles_pager(transport_name: str = "grpc"): next_page_token="abc", ), datastream.ListConnectionProfilesResponse( - connection_profiles=[], next_page_token="def", + connection_profiles=[], + next_page_token="def", ), datastream.ListConnectionProfilesResponse( - connection_profiles=[datastream_resources.ConnectionProfile(),], + connection_profiles=[ + datastream_resources.ConnectionProfile(), + ], next_page_token="ghi", ), datastream.ListConnectionProfilesResponse( @@ -875,7 +931,7 @@ def test_list_connection_profiles_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all( isinstance(i, datastream_resources.ConnectionProfile) for i in results @@ -884,7 +940,8 @@ def test_list_connection_profiles_pager(transport_name: str = "grpc"): def test_list_connection_profiles_pages(transport_name: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -902,10 +959,13 @@ def test_list_connection_profiles_pages(transport_name: str = "grpc"): next_page_token="abc", ), datastream.ListConnectionProfilesResponse( - connection_profiles=[], next_page_token="def", + connection_profiles=[], + next_page_token="def", ), datastream.ListConnectionProfilesResponse( - connection_profiles=[datastream_resources.ConnectionProfile(),], + connection_profiles=[ + datastream_resources.ConnectionProfile(), + ], next_page_token="ghi", ), datastream.ListConnectionProfilesResponse( @@ -923,7 +983,9 @@ def test_list_connection_profiles_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_connection_profiles_async_pager(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -942,10 +1004,13 @@ async def test_list_connection_profiles_async_pager(): next_page_token="abc", ), datastream.ListConnectionProfilesResponse( - connection_profiles=[], next_page_token="def", + connection_profiles=[], + next_page_token="def", ), datastream.ListConnectionProfilesResponse( - connection_profiles=[datastream_resources.ConnectionProfile(),], + connection_profiles=[ + datastream_resources.ConnectionProfile(), + ], next_page_token="ghi", ), datastream.ListConnectionProfilesResponse( @@ -956,10 +1021,12 @@ async def test_list_connection_profiles_async_pager(): ), RuntimeError, ) - async_pager = await client.list_connection_profiles(request={},) + async_pager = await client.list_connection_profiles( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -970,7 +1037,9 @@ async def test_list_connection_profiles_async_pager(): @pytest.mark.asyncio async def test_list_connection_profiles_async_pages(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -989,10 +1058,13 @@ async def test_list_connection_profiles_async_pages(): next_page_token="abc", ), datastream.ListConnectionProfilesResponse( - connection_profiles=[], next_page_token="def", + connection_profiles=[], + next_page_token="def", ), datastream.ListConnectionProfilesResponse( - connection_profiles=[datastream_resources.ConnectionProfile(),], + connection_profiles=[ + datastream_resources.ConnectionProfile(), + ], next_page_token="ghi", ), datastream.ListConnectionProfilesResponse( @@ -1004,18 +1076,25 @@ async def test_list_connection_profiles_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_connection_profiles(request={})).pages: + async for page_ in ( + await client.list_connection_profiles(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [datastream.GetConnectionProfileRequest, dict,] + "request_type", + [ + datastream.GetConnectionProfileRequest, + dict, + ], ) def test_get_connection_profile(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1052,7 +1131,8 @@ def test_get_connection_profile_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1070,7 +1150,8 @@ async def test_get_connection_profile_async( transport: str = "grpc_asyncio", request_type=datastream.GetConnectionProfileRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1084,7 +1165,8 @@ async def test_get_connection_profile_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( datastream_resources.ConnectionProfile( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) ) response = await client.get_connection_profile(request) @@ -1106,13 +1188,15 @@ async def test_get_connection_profile_async_from_dict(): def test_get_connection_profile_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.GetConnectionProfileRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1128,18 +1212,23 @@ def test_get_connection_profile_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_connection_profile_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.GetConnectionProfileRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1157,11 +1246,16 @@ async def test_get_connection_profile_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_connection_profile_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1171,7 +1265,9 @@ def test_get_connection_profile_flattened(): call.return_value = datastream_resources.ConnectionProfile() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_connection_profile(name="name_value",) + client.get_connection_profile( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1183,19 +1279,24 @@ def test_get_connection_profile_flattened(): def test_get_connection_profile_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_connection_profile( - datastream.GetConnectionProfileRequest(), name="name_value", + datastream.GetConnectionProfileRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_connection_profile_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1209,7 +1310,9 @@ async def test_get_connection_profile_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_connection_profile(name="name_value",) + response = await client.get_connection_profile( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1222,22 +1325,30 @@ async def test_get_connection_profile_flattened_async(): @pytest.mark.asyncio async def test_get_connection_profile_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_connection_profile( - datastream.GetConnectionProfileRequest(), name="name_value", + datastream.GetConnectionProfileRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [datastream.CreateConnectionProfileRequest, dict,] + "request_type", + [ + datastream.CreateConnectionProfileRequest, + dict, + ], ) def test_create_connection_profile(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1265,7 +1376,8 @@ def test_create_connection_profile_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1284,7 +1396,8 @@ async def test_create_connection_profile_async( request_type=datastream.CreateConnectionProfileRequest, ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1316,13 +1429,15 @@ async def test_create_connection_profile_async_from_dict(): def test_create_connection_profile_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.CreateConnectionProfileRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1338,18 +1453,23 @@ def test_create_connection_profile_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_connection_profile_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.CreateConnectionProfileRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1367,11 +1487,16 @@ async def test_create_connection_profile_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_connection_profile_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1405,7 +1530,9 @@ def test_create_connection_profile_flattened(): def test_create_connection_profile_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1422,7 +1549,9 @@ def test_create_connection_profile_flattened_error(): @pytest.mark.asyncio async def test_create_connection_profile_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1461,7 +1590,9 @@ async def test_create_connection_profile_flattened_async(): @pytest.mark.asyncio async def test_create_connection_profile_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1477,11 +1608,16 @@ async def test_create_connection_profile_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [datastream.UpdateConnectionProfileRequest, dict,] + "request_type", + [ + datastream.UpdateConnectionProfileRequest, + dict, + ], ) def test_update_connection_profile(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1509,7 +1645,8 @@ def test_update_connection_profile_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1528,7 +1665,8 @@ async def test_update_connection_profile_async( request_type=datastream.UpdateConnectionProfileRequest, ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1560,13 +1698,15 @@ async def test_update_connection_profile_async_from_dict(): def test_update_connection_profile_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.UpdateConnectionProfileRequest() - request.connection_profile.name = "connection_profile.name/value" + request.connection_profile.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1584,19 +1724,21 @@ def test_update_connection_profile_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "connection_profile.name=connection_profile.name/value", + "connection_profile.name=name_value", ) in kw["metadata"] @pytest.mark.asyncio async def test_update_connection_profile_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.UpdateConnectionProfileRequest() - request.connection_profile.name = "connection_profile.name/value" + request.connection_profile.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1616,12 +1758,14 @@ async def test_update_connection_profile_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "connection_profile.name=connection_profile.name/value", + "connection_profile.name=name_value", ) in kw["metadata"] def test_update_connection_profile_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1651,7 +1795,9 @@ def test_update_connection_profile_flattened(): def test_update_connection_profile_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1667,7 +1813,9 @@ def test_update_connection_profile_flattened_error(): @pytest.mark.asyncio async def test_update_connection_profile_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1702,7 +1850,9 @@ async def test_update_connection_profile_flattened_async(): @pytest.mark.asyncio async def test_update_connection_profile_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1717,11 +1867,16 @@ async def test_update_connection_profile_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [datastream.DeleteConnectionProfileRequest, dict,] + "request_type", + [ + datastream.DeleteConnectionProfileRequest, + dict, + ], ) def test_delete_connection_profile(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1749,7 +1904,8 @@ def test_delete_connection_profile_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1768,7 +1924,8 @@ async def test_delete_connection_profile_async( request_type=datastream.DeleteConnectionProfileRequest, ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1800,13 +1957,15 @@ async def test_delete_connection_profile_async_from_dict(): def test_delete_connection_profile_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.DeleteConnectionProfileRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1822,18 +1981,23 @@ def test_delete_connection_profile_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_connection_profile_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.DeleteConnectionProfileRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1851,11 +2015,16 @@ async def test_delete_connection_profile_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_connection_profile_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1865,7 +2034,9 @@ def test_delete_connection_profile_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_connection_profile(name="name_value",) + client.delete_connection_profile( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1877,19 +2048,24 @@ def test_delete_connection_profile_flattened(): def test_delete_connection_profile_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_connection_profile( - datastream.DeleteConnectionProfileRequest(), name="name_value", + datastream.DeleteConnectionProfileRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_connection_profile_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1903,7 +2079,9 @@ async def test_delete_connection_profile_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_connection_profile(name="name_value",) + response = await client.delete_connection_profile( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1916,22 +2094,30 @@ async def test_delete_connection_profile_flattened_async(): @pytest.mark.asyncio async def test_delete_connection_profile_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_connection_profile( - datastream.DeleteConnectionProfileRequest(), name="name_value", + datastream.DeleteConnectionProfileRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [datastream.DiscoverConnectionProfileRequest, dict,] + "request_type", + [ + datastream.DiscoverConnectionProfileRequest, + dict, + ], ) def test_discover_connection_profile(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1965,7 +2151,8 @@ def test_discover_connection_profile_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1984,7 +2171,8 @@ async def test_discover_connection_profile_async( request_type=datastream.DiscoverConnectionProfileRequest, ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2016,13 +2204,15 @@ async def test_discover_connection_profile_async_from_dict(): def test_discover_connection_profile_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.DiscoverConnectionProfileRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2038,18 +2228,23 @@ def test_discover_connection_profile_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_discover_connection_profile_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.DiscoverConnectionProfileRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2067,13 +2262,23 @@ async def test_discover_connection_profile_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [datastream.ListStreamsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.ListStreamsRequest, + dict, + ], +) def test_list_streams(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2084,7 +2289,8 @@ def test_list_streams(request_type, transport: str = "grpc"): with mock.patch.object(type(client.transport.list_streams), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = datastream.ListStreamsResponse( - next_page_token="next_page_token_value", unreachable=["unreachable_value"], + next_page_token="next_page_token_value", + unreachable=["unreachable_value"], ) response = client.list_streams(request) @@ -2103,7 +2309,8 @@ def test_list_streams_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2119,7 +2326,8 @@ async def test_list_streams_async( transport: str = "grpc_asyncio", request_type=datastream.ListStreamsRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2154,13 +2362,15 @@ async def test_list_streams_async_from_dict(): def test_list_streams_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.ListStreamsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_streams), "__call__") as call: @@ -2174,18 +2384,23 @@ def test_list_streams_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_streams_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.ListStreamsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_streams), "__call__") as call: @@ -2201,11 +2416,16 @@ async def test_list_streams_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_streams_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_streams), "__call__") as call: @@ -2213,7 +2433,9 @@ def test_list_streams_flattened(): call.return_value = datastream.ListStreamsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_streams(parent="parent_value",) + client.list_streams( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2225,19 +2447,24 @@ def test_list_streams_flattened(): def test_list_streams_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) - - # Attempting to call a method with both a request object and flattened + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_streams( - datastream.ListStreamsRequest(), parent="parent_value", + datastream.ListStreamsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_streams_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_streams), "__call__") as call: @@ -2249,7 +2476,9 @@ async def test_list_streams_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_streams(parent="parent_value",) + response = await client.list_streams( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2262,19 +2491,23 @@ async def test_list_streams_flattened_async(): @pytest.mark.asyncio async def test_list_streams_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_streams( - datastream.ListStreamsRequest(), parent="parent_value", + datastream.ListStreamsRequest(), + parent="parent_value", ) def test_list_streams_pager(transport_name: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2289,12 +2522,21 @@ def test_list_streams_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - datastream.ListStreamsResponse(streams=[], next_page_token="def",), datastream.ListStreamsResponse( - streams=[datastream_resources.Stream(),], next_page_token="ghi", + streams=[], + next_page_token="def", ), datastream.ListStreamsResponse( - streams=[datastream_resources.Stream(), datastream_resources.Stream(),], + streams=[ + datastream_resources.Stream(), + ], + next_page_token="ghi", + ), + datastream.ListStreamsResponse( + streams=[ + datastream_resources.Stream(), + datastream_resources.Stream(), + ], ), RuntimeError, ) @@ -2307,14 +2549,15 @@ def test_list_streams_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, datastream_resources.Stream) for i in results) def test_list_streams_pages(transport_name: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2329,12 +2572,21 @@ def test_list_streams_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - datastream.ListStreamsResponse(streams=[], next_page_token="def",), datastream.ListStreamsResponse( - streams=[datastream_resources.Stream(),], next_page_token="ghi", + streams=[], + next_page_token="def", + ), + datastream.ListStreamsResponse( + streams=[ + datastream_resources.Stream(), + ], + next_page_token="ghi", ), datastream.ListStreamsResponse( - streams=[datastream_resources.Stream(), datastream_resources.Stream(),], + streams=[ + datastream_resources.Stream(), + datastream_resources.Stream(), + ], ), RuntimeError, ) @@ -2345,7 +2597,9 @@ def test_list_streams_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_streams_async_pager(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2361,19 +2615,30 @@ async def test_list_streams_async_pager(): ], next_page_token="abc", ), - datastream.ListStreamsResponse(streams=[], next_page_token="def",), datastream.ListStreamsResponse( - streams=[datastream_resources.Stream(),], next_page_token="ghi", + streams=[], + next_page_token="def", ), datastream.ListStreamsResponse( - streams=[datastream_resources.Stream(), datastream_resources.Stream(),], + streams=[ + datastream_resources.Stream(), + ], + next_page_token="ghi", + ), + datastream.ListStreamsResponse( + streams=[ + datastream_resources.Stream(), + datastream_resources.Stream(), + ], ), RuntimeError, ) - async_pager = await client.list_streams(request={},) + async_pager = await client.list_streams( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -2382,7 +2647,9 @@ async def test_list_streams_async_pager(): @pytest.mark.asyncio async def test_list_streams_async_pages(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2398,26 +2665,44 @@ async def test_list_streams_async_pages(): ], next_page_token="abc", ), - datastream.ListStreamsResponse(streams=[], next_page_token="def",), datastream.ListStreamsResponse( - streams=[datastream_resources.Stream(),], next_page_token="ghi", + streams=[], + next_page_token="def", ), datastream.ListStreamsResponse( - streams=[datastream_resources.Stream(), datastream_resources.Stream(),], + streams=[ + datastream_resources.Stream(), + ], + next_page_token="ghi", + ), + datastream.ListStreamsResponse( + streams=[ + datastream_resources.Stream(), + datastream_resources.Stream(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_streams(request={})).pages: + async for page_ in ( + await client.list_streams(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [datastream.GetStreamRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.GetStreamRequest, + dict, + ], +) def test_get_stream(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2462,7 +2747,8 @@ def test_get_stream_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2478,7 +2764,8 @@ async def test_get_stream_async( transport: str = "grpc_asyncio", request_type=datastream.GetStreamRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2520,13 +2807,15 @@ async def test_get_stream_async_from_dict(): def test_get_stream_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.GetStreamRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_stream), "__call__") as call: @@ -2540,18 +2829,23 @@ def test_get_stream_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_stream_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.GetStreamRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_stream), "__call__") as call: @@ -2567,11 +2861,16 @@ async def test_get_stream_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_stream_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_stream), "__call__") as call: @@ -2579,7 +2878,9 @@ def test_get_stream_flattened(): call.return_value = datastream_resources.Stream() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_stream(name="name_value",) + client.get_stream( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2591,19 +2892,24 @@ def test_get_stream_flattened(): def test_get_stream_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_stream( - datastream.GetStreamRequest(), name="name_value", + datastream.GetStreamRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_stream_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_stream), "__call__") as call: @@ -2615,7 +2921,9 @@ async def test_get_stream_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_stream(name="name_value",) + response = await client.get_stream( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2628,20 +2936,30 @@ async def test_get_stream_flattened_async(): @pytest.mark.asyncio async def test_get_stream_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_stream( - datastream.GetStreamRequest(), name="name_value", + datastream.GetStreamRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [datastream.CreateStreamRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.CreateStreamRequest, + dict, + ], +) def test_create_stream(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2667,7 +2985,8 @@ def test_create_stream_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2683,7 +3002,8 @@ async def test_create_stream_async( transport: str = "grpc_asyncio", request_type=datastream.CreateStreamRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2713,13 +3033,15 @@ async def test_create_stream_async_from_dict(): def test_create_stream_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.CreateStreamRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_stream), "__call__") as call: @@ -2733,18 +3055,23 @@ def test_create_stream_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_stream_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.CreateStreamRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_stream), "__call__") as call: @@ -2760,11 +3087,16 @@ async def test_create_stream_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_stream_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_stream), "__call__") as call: @@ -2794,7 +3126,9 @@ def test_create_stream_flattened(): def test_create_stream_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2809,7 +3143,9 @@ def test_create_stream_flattened_error(): @pytest.mark.asyncio async def test_create_stream_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_stream), "__call__") as call: @@ -2844,7 +3180,9 @@ async def test_create_stream_flattened_async(): @pytest.mark.asyncio async def test_create_stream_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2857,10 +3195,17 @@ async def test_create_stream_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [datastream.UpdateStreamRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.UpdateStreamRequest, + dict, + ], +) def test_update_stream(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2886,7 +3231,8 @@ def test_update_stream_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2902,7 +3248,8 @@ async def test_update_stream_async( transport: str = "grpc_asyncio", request_type=datastream.UpdateStreamRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2932,13 +3279,15 @@ async def test_update_stream_async_from_dict(): def test_update_stream_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.UpdateStreamRequest() - request.stream.name = "stream.name/value" + request.stream.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_stream), "__call__") as call: @@ -2952,18 +3301,23 @@ def test_update_stream_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "stream.name=stream.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "stream.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_stream_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.UpdateStreamRequest() - request.stream.name = "stream.name/value" + request.stream.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_stream), "__call__") as call: @@ -2979,11 +3333,16 @@ async def test_update_stream_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "stream.name=stream.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "stream.name=name_value", + ) in kw["metadata"] def test_update_stream_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_stream), "__call__") as call: @@ -3009,7 +3368,9 @@ def test_update_stream_flattened(): def test_update_stream_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3023,7 +3384,9 @@ def test_update_stream_flattened_error(): @pytest.mark.asyncio async def test_update_stream_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_stream), "__call__") as call: @@ -3054,7 +3417,9 @@ async def test_update_stream_flattened_async(): @pytest.mark.asyncio async def test_update_stream_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3066,10 +3431,17 @@ async def test_update_stream_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [datastream.DeleteStreamRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.DeleteStreamRequest, + dict, + ], +) def test_delete_stream(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3095,7 +3467,8 @@ def test_delete_stream_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3111,7 +3484,8 @@ async def test_delete_stream_async( transport: str = "grpc_asyncio", request_type=datastream.DeleteStreamRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3141,13 +3515,15 @@ async def test_delete_stream_async_from_dict(): def test_delete_stream_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.DeleteStreamRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_stream), "__call__") as call: @@ -3161,18 +3537,23 @@ def test_delete_stream_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_stream_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.DeleteStreamRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_stream), "__call__") as call: @@ -3188,11 +3569,16 @@ async def test_delete_stream_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_stream_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_stream), "__call__") as call: @@ -3200,7 +3586,9 @@ def test_delete_stream_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_stream(name="name_value",) + client.delete_stream( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3212,19 +3600,24 @@ def test_delete_stream_flattened(): def test_delete_stream_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_stream( - datastream.DeleteStreamRequest(), name="name_value", + datastream.DeleteStreamRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_stream_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_stream), "__call__") as call: @@ -3236,7 +3629,9 @@ async def test_delete_stream_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_stream(name="name_value",) + response = await client.delete_stream( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3249,20 +3644,30 @@ async def test_delete_stream_flattened_async(): @pytest.mark.asyncio async def test_delete_stream_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_stream( - datastream.DeleteStreamRequest(), name="name_value", + datastream.DeleteStreamRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [datastream.GetStreamObjectRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.GetStreamObjectRequest, + dict, + ], +) def test_get_stream_object(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3275,7 +3680,8 @@ def test_get_stream_object(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = datastream_resources.StreamObject( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) response = client.get_stream_object(request) @@ -3294,7 +3700,8 @@ def test_get_stream_object_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3312,7 +3719,8 @@ async def test_get_stream_object_async( transport: str = "grpc_asyncio", request_type=datastream.GetStreamObjectRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3326,7 +3734,8 @@ async def test_get_stream_object_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( datastream_resources.StreamObject( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) ) response = await client.get_stream_object(request) @@ -3348,13 +3757,15 @@ async def test_get_stream_object_async_from_dict(): def test_get_stream_object_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.GetStreamObjectRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3370,18 +3781,23 @@ def test_get_stream_object_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_stream_object_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.GetStreamObjectRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3399,11 +3815,16 @@ async def test_get_stream_object_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_stream_object_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3413,7 +3834,9 @@ def test_get_stream_object_flattened(): call.return_value = datastream_resources.StreamObject() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_stream_object(name="name_value",) + client.get_stream_object( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3425,19 +3848,24 @@ def test_get_stream_object_flattened(): def test_get_stream_object_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_stream_object( - datastream.GetStreamObjectRequest(), name="name_value", + datastream.GetStreamObjectRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_stream_object_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3451,7 +3879,9 @@ async def test_get_stream_object_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_stream_object(name="name_value",) + response = await client.get_stream_object( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3464,20 +3894,30 @@ async def test_get_stream_object_flattened_async(): @pytest.mark.asyncio async def test_get_stream_object_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_stream_object( - datastream.GetStreamObjectRequest(), name="name_value", + datastream.GetStreamObjectRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [datastream.LookupStreamObjectRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.LookupStreamObjectRequest, + dict, + ], +) def test_lookup_stream_object(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3490,7 +3930,8 @@ def test_lookup_stream_object(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = datastream_resources.StreamObject( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) response = client.lookup_stream_object(request) @@ -3509,7 +3950,8 @@ def test_lookup_stream_object_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3527,7 +3969,8 @@ async def test_lookup_stream_object_async( transport: str = "grpc_asyncio", request_type=datastream.LookupStreamObjectRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3541,7 +3984,8 @@ async def test_lookup_stream_object_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( datastream_resources.StreamObject( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) ) response = await client.lookup_stream_object(request) @@ -3563,13 +4007,15 @@ async def test_lookup_stream_object_async_from_dict(): def test_lookup_stream_object_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.LookupStreamObjectRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3585,18 +4031,23 @@ def test_lookup_stream_object_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_lookup_stream_object_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.LookupStreamObjectRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3614,13 +4065,23 @@ async def test_lookup_stream_object_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [datastream.ListStreamObjectsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.ListStreamObjectsRequest, + dict, + ], +) def test_list_stream_objects(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3651,7 +4112,8 @@ def test_list_stream_objects_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3669,7 +4131,8 @@ async def test_list_stream_objects_async( transport: str = "grpc_asyncio", request_type=datastream.ListStreamObjectsRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3704,13 +4167,15 @@ async def test_list_stream_objects_async_from_dict(): def test_list_stream_objects_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.ListStreamObjectsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3726,18 +4191,23 @@ def test_list_stream_objects_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_stream_objects_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.ListStreamObjectsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3755,11 +4225,16 @@ async def test_list_stream_objects_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_stream_objects_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3769,7 +4244,9 @@ def test_list_stream_objects_flattened(): call.return_value = datastream.ListStreamObjectsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_stream_objects(parent="parent_value",) + client.list_stream_objects( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3781,19 +4258,24 @@ def test_list_stream_objects_flattened(): def test_list_stream_objects_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_stream_objects( - datastream.ListStreamObjectsRequest(), parent="parent_value", + datastream.ListStreamObjectsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_stream_objects_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3807,7 +4289,9 @@ async def test_list_stream_objects_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_stream_objects(parent="parent_value",) + response = await client.list_stream_objects( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3820,19 +4304,23 @@ async def test_list_stream_objects_flattened_async(): @pytest.mark.asyncio async def test_list_stream_objects_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_stream_objects( - datastream.ListStreamObjectsRequest(), parent="parent_value", + datastream.ListStreamObjectsRequest(), + parent="parent_value", ) def test_list_stream_objects_pager(transport_name: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3850,10 +4338,13 @@ def test_list_stream_objects_pager(transport_name: str = "grpc"): next_page_token="abc", ), datastream.ListStreamObjectsResponse( - stream_objects=[], next_page_token="def", + stream_objects=[], + next_page_token="def", ), datastream.ListStreamObjectsResponse( - stream_objects=[datastream_resources.StreamObject(),], + stream_objects=[ + datastream_resources.StreamObject(), + ], next_page_token="ghi", ), datastream.ListStreamObjectsResponse( @@ -3873,14 +4364,15 @@ def test_list_stream_objects_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, datastream_resources.StreamObject) for i in results) def test_list_stream_objects_pages(transport_name: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3898,10 +4390,13 @@ def test_list_stream_objects_pages(transport_name: str = "grpc"): next_page_token="abc", ), datastream.ListStreamObjectsResponse( - stream_objects=[], next_page_token="def", + stream_objects=[], + next_page_token="def", ), datastream.ListStreamObjectsResponse( - stream_objects=[datastream_resources.StreamObject(),], + stream_objects=[ + datastream_resources.StreamObject(), + ], next_page_token="ghi", ), datastream.ListStreamObjectsResponse( @@ -3919,7 +4414,9 @@ def test_list_stream_objects_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_stream_objects_async_pager(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3938,10 +4435,13 @@ async def test_list_stream_objects_async_pager(): next_page_token="abc", ), datastream.ListStreamObjectsResponse( - stream_objects=[], next_page_token="def", + stream_objects=[], + next_page_token="def", ), datastream.ListStreamObjectsResponse( - stream_objects=[datastream_resources.StreamObject(),], + stream_objects=[ + datastream_resources.StreamObject(), + ], next_page_token="ghi", ), datastream.ListStreamObjectsResponse( @@ -3952,10 +4452,12 @@ async def test_list_stream_objects_async_pager(): ), RuntimeError, ) - async_pager = await client.list_stream_objects(request={},) + async_pager = await client.list_stream_objects( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -3964,7 +4466,9 @@ async def test_list_stream_objects_async_pager(): @pytest.mark.asyncio async def test_list_stream_objects_async_pages(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3983,10 +4487,13 @@ async def test_list_stream_objects_async_pages(): next_page_token="abc", ), datastream.ListStreamObjectsResponse( - stream_objects=[], next_page_token="def", + stream_objects=[], + next_page_token="def", ), datastream.ListStreamObjectsResponse( - stream_objects=[datastream_resources.StreamObject(),], + stream_objects=[ + datastream_resources.StreamObject(), + ], next_page_token="ghi", ), datastream.ListStreamObjectsResponse( @@ -3998,16 +4505,25 @@ async def test_list_stream_objects_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_stream_objects(request={})).pages: + async for page_ in ( + await client.list_stream_objects(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [datastream.StartBackfillJobRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.StartBackfillJobRequest, + dict, + ], +) def test_start_backfill_job(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4035,7 +4551,8 @@ def test_start_backfill_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4053,7 +4570,8 @@ async def test_start_backfill_job_async( transport: str = "grpc_asyncio", request_type=datastream.StartBackfillJobRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4085,13 +4603,15 @@ async def test_start_backfill_job_async_from_dict(): def test_start_backfill_job_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.StartBackfillJobRequest() - request.object_ = "object/value" + request.object_ = "object__value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4107,18 +4627,23 @@ def test_start_backfill_job_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "object=object/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "object=object__value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_start_backfill_job_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.StartBackfillJobRequest() - request.object_ = "object/value" + request.object_ = "object__value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4136,11 +4661,16 @@ async def test_start_backfill_job_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "object=object/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "object=object__value", + ) in kw["metadata"] def test_start_backfill_job_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4150,7 +4680,9 @@ def test_start_backfill_job_flattened(): call.return_value = datastream.StartBackfillJobResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.start_backfill_job(object_="object__value",) + client.start_backfill_job( + object_="object__value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4162,19 +4694,24 @@ def test_start_backfill_job_flattened(): def test_start_backfill_job_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.start_backfill_job( - datastream.StartBackfillJobRequest(), object_="object__value", + datastream.StartBackfillJobRequest(), + object_="object__value", ) @pytest.mark.asyncio async def test_start_backfill_job_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4188,7 +4725,9 @@ async def test_start_backfill_job_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.start_backfill_job(object_="object__value",) + response = await client.start_backfill_job( + object_="object__value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4201,20 +4740,30 @@ async def test_start_backfill_job_flattened_async(): @pytest.mark.asyncio async def test_start_backfill_job_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.start_backfill_job( - datastream.StartBackfillJobRequest(), object_="object__value", + datastream.StartBackfillJobRequest(), + object_="object__value", ) -@pytest.mark.parametrize("request_type", [datastream.StopBackfillJobRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.StopBackfillJobRequest, + dict, + ], +) def test_stop_backfill_job(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4242,7 +4791,8 @@ def test_stop_backfill_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4260,7 +4810,8 @@ async def test_stop_backfill_job_async( transport: str = "grpc_asyncio", request_type=datastream.StopBackfillJobRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4292,13 +4843,15 @@ async def test_stop_backfill_job_async_from_dict(): def test_stop_backfill_job_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.StopBackfillJobRequest() - request.object_ = "object/value" + request.object_ = "object__value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4314,18 +4867,23 @@ def test_stop_backfill_job_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "object=object/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "object=object__value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_stop_backfill_job_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.StopBackfillJobRequest() - request.object_ = "object/value" + request.object_ = "object__value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4343,11 +4901,16 @@ async def test_stop_backfill_job_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "object=object/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "object=object__value", + ) in kw["metadata"] def test_stop_backfill_job_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4357,7 +4920,9 @@ def test_stop_backfill_job_flattened(): call.return_value = datastream.StopBackfillJobResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.stop_backfill_job(object_="object__value",) + client.stop_backfill_job( + object_="object__value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4369,19 +4934,24 @@ def test_stop_backfill_job_flattened(): def test_stop_backfill_job_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.stop_backfill_job( - datastream.StopBackfillJobRequest(), object_="object__value", + datastream.StopBackfillJobRequest(), + object_="object__value", ) @pytest.mark.asyncio async def test_stop_backfill_job_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4395,7 +4965,9 @@ async def test_stop_backfill_job_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.stop_backfill_job(object_="object__value",) + response = await client.stop_backfill_job( + object_="object__value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4408,20 +4980,30 @@ async def test_stop_backfill_job_flattened_async(): @pytest.mark.asyncio async def test_stop_backfill_job_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.stop_backfill_job( - datastream.StopBackfillJobRequest(), object_="object__value", + datastream.StopBackfillJobRequest(), + object_="object__value", ) -@pytest.mark.parametrize("request_type", [datastream.FetchStaticIpsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.FetchStaticIpsRequest, + dict, + ], +) def test_fetch_static_ips(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4432,7 +5014,8 @@ def test_fetch_static_ips(request_type, transport: str = "grpc"): with mock.patch.object(type(client.transport.fetch_static_ips), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = datastream.FetchStaticIpsResponse( - static_ips=["static_ips_value"], next_page_token="next_page_token_value", + static_ips=["static_ips_value"], + next_page_token="next_page_token_value", ) response = client.fetch_static_ips(request) @@ -4451,7 +5034,8 @@ def test_fetch_static_ips_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4467,7 +5051,8 @@ async def test_fetch_static_ips_async( transport: str = "grpc_asyncio", request_type=datastream.FetchStaticIpsRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4502,13 +5087,15 @@ async def test_fetch_static_ips_async_from_dict(): def test_fetch_static_ips_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.FetchStaticIpsRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.fetch_static_ips), "__call__") as call: @@ -4522,18 +5109,23 @@ def test_fetch_static_ips_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_fetch_static_ips_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.FetchStaticIpsRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.fetch_static_ips), "__call__") as call: @@ -4549,11 +5141,16 @@ async def test_fetch_static_ips_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_fetch_static_ips_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.fetch_static_ips), "__call__") as call: @@ -4561,7 +5158,9 @@ def test_fetch_static_ips_flattened(): call.return_value = datastream.FetchStaticIpsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.fetch_static_ips(name="name_value",) + client.fetch_static_ips( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4573,19 +5172,24 @@ def test_fetch_static_ips_flattened(): def test_fetch_static_ips_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.fetch_static_ips( - datastream.FetchStaticIpsRequest(), name="name_value", + datastream.FetchStaticIpsRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_fetch_static_ips_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.fetch_static_ips), "__call__") as call: @@ -4597,7 +5201,9 @@ async def test_fetch_static_ips_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.fetch_static_ips(name="name_value",) + response = await client.fetch_static_ips( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4610,19 +5216,23 @@ async def test_fetch_static_ips_flattened_async(): @pytest.mark.asyncio async def test_fetch_static_ips_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.fetch_static_ips( - datastream.FetchStaticIpsRequest(), name="name_value", + datastream.FetchStaticIpsRequest(), + name="name_value", ) def test_fetch_static_ips_pager(transport_name: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4630,13 +5240,29 @@ def test_fetch_static_ips_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( datastream.FetchStaticIpsResponse( - static_ips=[str(), str(), str(),], next_page_token="abc", + static_ips=[ + str(), + str(), + str(), + ], + next_page_token="abc", + ), + datastream.FetchStaticIpsResponse( + static_ips=[], + next_page_token="def", + ), + datastream.FetchStaticIpsResponse( + static_ips=[ + str(), + ], + next_page_token="ghi", ), - datastream.FetchStaticIpsResponse(static_ips=[], next_page_token="def",), datastream.FetchStaticIpsResponse( - static_ips=[str(),], next_page_token="ghi", + static_ips=[ + str(), + str(), + ], ), - datastream.FetchStaticIpsResponse(static_ips=[str(), str(),],), RuntimeError, ) @@ -4648,14 +5274,15 @@ def test_fetch_static_ips_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, str) for i in results) def test_fetch_static_ips_pages(transport_name: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4663,13 +5290,29 @@ def test_fetch_static_ips_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( datastream.FetchStaticIpsResponse( - static_ips=[str(), str(), str(),], next_page_token="abc", + static_ips=[ + str(), + str(), + str(), + ], + next_page_token="abc", + ), + datastream.FetchStaticIpsResponse( + static_ips=[], + next_page_token="def", + ), + datastream.FetchStaticIpsResponse( + static_ips=[ + str(), + ], + next_page_token="ghi", ), - datastream.FetchStaticIpsResponse(static_ips=[], next_page_token="def",), datastream.FetchStaticIpsResponse( - static_ips=[str(),], next_page_token="ghi", + static_ips=[ + str(), + str(), + ], ), - datastream.FetchStaticIpsResponse(static_ips=[str(), str(),],), RuntimeError, ) pages = list(client.fetch_static_ips(request={}).pages) @@ -4679,7 +5322,9 @@ def test_fetch_static_ips_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_fetch_static_ips_async_pager(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4688,19 +5333,37 @@ async def test_fetch_static_ips_async_pager(): # Set the response to a series of pages. call.side_effect = ( datastream.FetchStaticIpsResponse( - static_ips=[str(), str(), str(),], next_page_token="abc", + static_ips=[ + str(), + str(), + str(), + ], + next_page_token="abc", + ), + datastream.FetchStaticIpsResponse( + static_ips=[], + next_page_token="def", + ), + datastream.FetchStaticIpsResponse( + static_ips=[ + str(), + ], + next_page_token="ghi", ), - datastream.FetchStaticIpsResponse(static_ips=[], next_page_token="def",), datastream.FetchStaticIpsResponse( - static_ips=[str(),], next_page_token="ghi", + static_ips=[ + str(), + str(), + ], ), - datastream.FetchStaticIpsResponse(static_ips=[str(), str(),],), RuntimeError, ) - async_pager = await client.fetch_static_ips(request={},) + async_pager = await client.fetch_static_ips( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -4709,7 +5372,9 @@ async def test_fetch_static_ips_async_pager(): @pytest.mark.asyncio async def test_fetch_static_ips_async_pages(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4718,28 +5383,51 @@ async def test_fetch_static_ips_async_pages(): # Set the response to a series of pages. call.side_effect = ( datastream.FetchStaticIpsResponse( - static_ips=[str(), str(), str(),], next_page_token="abc", + static_ips=[ + str(), + str(), + str(), + ], + next_page_token="abc", + ), + datastream.FetchStaticIpsResponse( + static_ips=[], + next_page_token="def", + ), + datastream.FetchStaticIpsResponse( + static_ips=[ + str(), + ], + next_page_token="ghi", ), - datastream.FetchStaticIpsResponse(static_ips=[], next_page_token="def",), datastream.FetchStaticIpsResponse( - static_ips=[str(),], next_page_token="ghi", + static_ips=[ + str(), + str(), + ], ), - datastream.FetchStaticIpsResponse(static_ips=[str(), str(),],), RuntimeError, ) pages = [] - async for page_ in (await client.fetch_static_ips(request={})).pages: + async for page_ in ( + await client.fetch_static_ips(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [datastream.CreatePrivateConnectionRequest, dict,] + "request_type", + [ + datastream.CreatePrivateConnectionRequest, + dict, + ], ) def test_create_private_connection(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4767,7 +5455,8 @@ def test_create_private_connection_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4786,7 +5475,8 @@ async def test_create_private_connection_async( request_type=datastream.CreatePrivateConnectionRequest, ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4818,13 +5508,15 @@ async def test_create_private_connection_async_from_dict(): def test_create_private_connection_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.CreatePrivateConnectionRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4840,18 +5532,23 @@ def test_create_private_connection_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_private_connection_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.CreatePrivateConnectionRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4869,11 +5566,16 @@ async def test_create_private_connection_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_private_connection_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4907,7 +5609,9 @@ def test_create_private_connection_flattened(): def test_create_private_connection_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4924,7 +5628,9 @@ def test_create_private_connection_flattened_error(): @pytest.mark.asyncio async def test_create_private_connection_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4963,7 +5669,9 @@ async def test_create_private_connection_flattened_async(): @pytest.mark.asyncio async def test_create_private_connection_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4979,11 +5687,16 @@ async def test_create_private_connection_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [datastream.GetPrivateConnectionRequest, dict,] + "request_type", + [ + datastream.GetPrivateConnectionRequest, + dict, + ], ) def test_get_private_connection(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5018,7 +5731,8 @@ def test_get_private_connection_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5036,7 +5750,8 @@ async def test_get_private_connection_async( transport: str = "grpc_asyncio", request_type=datastream.GetPrivateConnectionRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5075,13 +5790,15 @@ async def test_get_private_connection_async_from_dict(): def test_get_private_connection_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.GetPrivateConnectionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5097,18 +5814,23 @@ def test_get_private_connection_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_private_connection_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.GetPrivateConnectionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5126,11 +5848,16 @@ async def test_get_private_connection_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_private_connection_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5140,7 +5867,9 @@ def test_get_private_connection_flattened(): call.return_value = datastream_resources.PrivateConnection() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_private_connection(name="name_value",) + client.get_private_connection( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5152,19 +5881,24 @@ def test_get_private_connection_flattened(): def test_get_private_connection_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_private_connection( - datastream.GetPrivateConnectionRequest(), name="name_value", + datastream.GetPrivateConnectionRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_private_connection_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5178,7 +5912,9 @@ async def test_get_private_connection_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_private_connection(name="name_value",) + response = await client.get_private_connection( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5191,22 +5927,30 @@ async def test_get_private_connection_flattened_async(): @pytest.mark.asyncio async def test_get_private_connection_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_private_connection( - datastream.GetPrivateConnectionRequest(), name="name_value", + datastream.GetPrivateConnectionRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [datastream.ListPrivateConnectionsRequest, dict,] + "request_type", + [ + datastream.ListPrivateConnectionsRequest, + dict, + ], ) def test_list_private_connections(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5219,7 +5963,8 @@ def test_list_private_connections(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = datastream.ListPrivateConnectionsResponse( - next_page_token="next_page_token_value", unreachable=["unreachable_value"], + next_page_token="next_page_token_value", + unreachable=["unreachable_value"], ) response = client.list_private_connections(request) @@ -5238,7 +5983,8 @@ def test_list_private_connections_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5257,7 +6003,8 @@ async def test_list_private_connections_async( request_type=datastream.ListPrivateConnectionsRequest, ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5294,13 +6041,15 @@ async def test_list_private_connections_async_from_dict(): def test_list_private_connections_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.ListPrivateConnectionsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5316,18 +6065,23 @@ def test_list_private_connections_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_private_connections_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.ListPrivateConnectionsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5345,11 +6099,16 @@ async def test_list_private_connections_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_private_connections_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5359,7 +6118,9 @@ def test_list_private_connections_flattened(): call.return_value = datastream.ListPrivateConnectionsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_private_connections(parent="parent_value",) + client.list_private_connections( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5371,19 +6132,24 @@ def test_list_private_connections_flattened(): def test_list_private_connections_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_private_connections( - datastream.ListPrivateConnectionsRequest(), parent="parent_value", + datastream.ListPrivateConnectionsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_private_connections_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5397,7 +6163,9 @@ async def test_list_private_connections_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_private_connections(parent="parent_value",) + response = await client.list_private_connections( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5410,19 +6178,23 @@ async def test_list_private_connections_flattened_async(): @pytest.mark.asyncio async def test_list_private_connections_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_private_connections( - datastream.ListPrivateConnectionsRequest(), parent="parent_value", + datastream.ListPrivateConnectionsRequest(), + parent="parent_value", ) def test_list_private_connections_pager(transport_name: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5440,10 +6212,13 @@ def test_list_private_connections_pager(transport_name: str = "grpc"): next_page_token="abc", ), datastream.ListPrivateConnectionsResponse( - private_connections=[], next_page_token="def", + private_connections=[], + next_page_token="def", ), datastream.ListPrivateConnectionsResponse( - private_connections=[datastream_resources.PrivateConnection(),], + private_connections=[ + datastream_resources.PrivateConnection(), + ], next_page_token="ghi", ), datastream.ListPrivateConnectionsResponse( @@ -5463,7 +6238,7 @@ def test_list_private_connections_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all( isinstance(i, datastream_resources.PrivateConnection) for i in results @@ -5472,7 +6247,8 @@ def test_list_private_connections_pager(transport_name: str = "grpc"): def test_list_private_connections_pages(transport_name: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5490,10 +6266,13 @@ def test_list_private_connections_pages(transport_name: str = "grpc"): next_page_token="abc", ), datastream.ListPrivateConnectionsResponse( - private_connections=[], next_page_token="def", + private_connections=[], + next_page_token="def", ), datastream.ListPrivateConnectionsResponse( - private_connections=[datastream_resources.PrivateConnection(),], + private_connections=[ + datastream_resources.PrivateConnection(), + ], next_page_token="ghi", ), datastream.ListPrivateConnectionsResponse( @@ -5511,7 +6290,9 @@ def test_list_private_connections_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_private_connections_async_pager(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5530,10 +6311,13 @@ async def test_list_private_connections_async_pager(): next_page_token="abc", ), datastream.ListPrivateConnectionsResponse( - private_connections=[], next_page_token="def", + private_connections=[], + next_page_token="def", ), datastream.ListPrivateConnectionsResponse( - private_connections=[datastream_resources.PrivateConnection(),], + private_connections=[ + datastream_resources.PrivateConnection(), + ], next_page_token="ghi", ), datastream.ListPrivateConnectionsResponse( @@ -5544,10 +6328,12 @@ async def test_list_private_connections_async_pager(): ), RuntimeError, ) - async_pager = await client.list_private_connections(request={},) + async_pager = await client.list_private_connections( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -5558,7 +6344,9 @@ async def test_list_private_connections_async_pager(): @pytest.mark.asyncio async def test_list_private_connections_async_pages(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5577,10 +6365,13 @@ async def test_list_private_connections_async_pages(): next_page_token="abc", ), datastream.ListPrivateConnectionsResponse( - private_connections=[], next_page_token="def", + private_connections=[], + next_page_token="def", ), datastream.ListPrivateConnectionsResponse( - private_connections=[datastream_resources.PrivateConnection(),], + private_connections=[ + datastream_resources.PrivateConnection(), + ], next_page_token="ghi", ), datastream.ListPrivateConnectionsResponse( @@ -5592,18 +6383,25 @@ async def test_list_private_connections_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_private_connections(request={})).pages: + async for page_ in ( + await client.list_private_connections(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [datastream.DeletePrivateConnectionRequest, dict,] + "request_type", + [ + datastream.DeletePrivateConnectionRequest, + dict, + ], ) def test_delete_private_connection(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5631,7 +6429,8 @@ def test_delete_private_connection_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5650,7 +6449,8 @@ async def test_delete_private_connection_async( request_type=datastream.DeletePrivateConnectionRequest, ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5682,13 +6482,15 @@ async def test_delete_private_connection_async_from_dict(): def test_delete_private_connection_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.DeletePrivateConnectionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5704,18 +6506,23 @@ def test_delete_private_connection_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_private_connection_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.DeletePrivateConnectionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5733,11 +6540,16 @@ async def test_delete_private_connection_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_private_connection_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5747,7 +6559,9 @@ def test_delete_private_connection_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_private_connection(name="name_value",) + client.delete_private_connection( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5759,19 +6573,24 @@ def test_delete_private_connection_flattened(): def test_delete_private_connection_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_private_connection( - datastream.DeletePrivateConnectionRequest(), name="name_value", + datastream.DeletePrivateConnectionRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_private_connection_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5785,7 +6604,9 @@ async def test_delete_private_connection_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_private_connection(name="name_value",) + response = await client.delete_private_connection( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5798,20 +6619,30 @@ async def test_delete_private_connection_flattened_async(): @pytest.mark.asyncio async def test_delete_private_connection_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_private_connection( - datastream.DeletePrivateConnectionRequest(), name="name_value", + datastream.DeletePrivateConnectionRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [datastream.CreateRouteRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.CreateRouteRequest, + dict, + ], +) def test_create_route(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5837,7 +6668,8 @@ def test_create_route_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5853,7 +6685,8 @@ async def test_create_route_async( transport: str = "grpc_asyncio", request_type=datastream.CreateRouteRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5883,13 +6716,15 @@ async def test_create_route_async_from_dict(): def test_create_route_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.CreateRouteRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_route), "__call__") as call: @@ -5903,18 +6738,23 @@ def test_create_route_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_route_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.CreateRouteRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_route), "__call__") as call: @@ -5930,11 +6770,16 @@ async def test_create_route_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_route_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_route), "__call__") as call: @@ -5964,7 +6809,9 @@ def test_create_route_flattened(): def test_create_route_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -5979,7 +6826,9 @@ def test_create_route_flattened_error(): @pytest.mark.asyncio async def test_create_route_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_route), "__call__") as call: @@ -6014,7 +6863,9 @@ async def test_create_route_flattened_async(): @pytest.mark.asyncio async def test_create_route_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -6027,10 +6878,17 @@ async def test_create_route_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [datastream.GetRouteRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.GetRouteRequest, + dict, + ], +) def test_get_route(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6065,7 +6923,8 @@ def test_get_route_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6081,7 +6940,8 @@ async def test_get_route_async( transport: str = "grpc_asyncio", request_type=datastream.GetRouteRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6120,13 +6980,15 @@ async def test_get_route_async_from_dict(): def test_get_route_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.GetRouteRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_route), "__call__") as call: @@ -6140,18 +7002,23 @@ def test_get_route_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_route_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.GetRouteRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_route), "__call__") as call: @@ -6167,11 +7034,16 @@ async def test_get_route_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_route_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_route), "__call__") as call: @@ -6179,7 +7051,9 @@ def test_get_route_flattened(): call.return_value = datastream_resources.Route() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_route(name="name_value",) + client.get_route( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -6191,19 +7065,24 @@ def test_get_route_flattened(): def test_get_route_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_route( - datastream.GetRouteRequest(), name="name_value", + datastream.GetRouteRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_route_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_route), "__call__") as call: @@ -6215,7 +7094,9 @@ async def test_get_route_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_route(name="name_value",) + response = await client.get_route( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -6228,20 +7109,30 @@ async def test_get_route_flattened_async(): @pytest.mark.asyncio async def test_get_route_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_route( - datastream.GetRouteRequest(), name="name_value", + datastream.GetRouteRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [datastream.ListRoutesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.ListRoutesRequest, + dict, + ], +) def test_list_routes(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6252,7 +7143,8 @@ def test_list_routes(request_type, transport: str = "grpc"): with mock.patch.object(type(client.transport.list_routes), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = datastream.ListRoutesResponse( - next_page_token="next_page_token_value", unreachable=["unreachable_value"], + next_page_token="next_page_token_value", + unreachable=["unreachable_value"], ) response = client.list_routes(request) @@ -6271,7 +7163,8 @@ def test_list_routes_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6287,7 +7180,8 @@ async def test_list_routes_async( transport: str = "grpc_asyncio", request_type=datastream.ListRoutesRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6322,13 +7216,15 @@ async def test_list_routes_async_from_dict(): def test_list_routes_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.ListRoutesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_routes), "__call__") as call: @@ -6342,18 +7238,23 @@ def test_list_routes_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_routes_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.ListRoutesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_routes), "__call__") as call: @@ -6369,11 +7270,16 @@ async def test_list_routes_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_routes_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_routes), "__call__") as call: @@ -6381,7 +7287,9 @@ def test_list_routes_flattened(): call.return_value = datastream.ListRoutesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_routes(parent="parent_value",) + client.list_routes( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -6393,19 +7301,24 @@ def test_list_routes_flattened(): def test_list_routes_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_routes( - datastream.ListRoutesRequest(), parent="parent_value", + datastream.ListRoutesRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_routes_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_routes), "__call__") as call: @@ -6417,7 +7330,9 @@ async def test_list_routes_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_routes(parent="parent_value",) + response = await client.list_routes( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -6430,19 +7345,23 @@ async def test_list_routes_flattened_async(): @pytest.mark.asyncio async def test_list_routes_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_routes( - datastream.ListRoutesRequest(), parent="parent_value", + datastream.ListRoutesRequest(), + parent="parent_value", ) def test_list_routes_pager(transport_name: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6457,12 +7376,21 @@ def test_list_routes_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - datastream.ListRoutesResponse(routes=[], next_page_token="def",), datastream.ListRoutesResponse( - routes=[datastream_resources.Route(),], next_page_token="ghi", + routes=[], + next_page_token="def", + ), + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + ], + next_page_token="ghi", ), datastream.ListRoutesResponse( - routes=[datastream_resources.Route(), datastream_resources.Route(),], + routes=[ + datastream_resources.Route(), + datastream_resources.Route(), + ], ), RuntimeError, ) @@ -6475,14 +7403,15 @@ def test_list_routes_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, datastream_resources.Route) for i in results) def test_list_routes_pages(transport_name: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6497,12 +7426,21 @@ def test_list_routes_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - datastream.ListRoutesResponse(routes=[], next_page_token="def",), datastream.ListRoutesResponse( - routes=[datastream_resources.Route(),], next_page_token="ghi", + routes=[], + next_page_token="def", + ), + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + ], + next_page_token="ghi", ), datastream.ListRoutesResponse( - routes=[datastream_resources.Route(), datastream_resources.Route(),], + routes=[ + datastream_resources.Route(), + datastream_resources.Route(), + ], ), RuntimeError, ) @@ -6513,7 +7451,9 @@ def test_list_routes_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_routes_async_pager(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6529,19 +7469,30 @@ async def test_list_routes_async_pager(): ], next_page_token="abc", ), - datastream.ListRoutesResponse(routes=[], next_page_token="def",), datastream.ListRoutesResponse( - routes=[datastream_resources.Route(),], next_page_token="ghi", + routes=[], + next_page_token="def", + ), + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + ], + next_page_token="ghi", ), datastream.ListRoutesResponse( - routes=[datastream_resources.Route(), datastream_resources.Route(),], + routes=[ + datastream_resources.Route(), + datastream_resources.Route(), + ], ), RuntimeError, ) - async_pager = await client.list_routes(request={},) + async_pager = await client.list_routes( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -6550,7 +7501,9 @@ async def test_list_routes_async_pager(): @pytest.mark.asyncio async def test_list_routes_async_pages(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6566,26 +7519,44 @@ async def test_list_routes_async_pages(): ], next_page_token="abc", ), - datastream.ListRoutesResponse(routes=[], next_page_token="def",), datastream.ListRoutesResponse( - routes=[datastream_resources.Route(),], next_page_token="ghi", + routes=[], + next_page_token="def", ), datastream.ListRoutesResponse( - routes=[datastream_resources.Route(), datastream_resources.Route(),], + routes=[ + datastream_resources.Route(), + ], + next_page_token="ghi", + ), + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + datastream_resources.Route(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_routes(request={})).pages: + async for page_ in ( + await client.list_routes(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [datastream.DeleteRouteRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.DeleteRouteRequest, + dict, + ], +) def test_delete_route(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6611,7 +7582,8 @@ def test_delete_route_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6627,7 +7599,8 @@ async def test_delete_route_async( transport: str = "grpc_asyncio", request_type=datastream.DeleteRouteRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6657,13 +7630,15 @@ async def test_delete_route_async_from_dict(): def test_delete_route_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.DeleteRouteRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_route), "__call__") as call: @@ -6677,18 +7652,23 @@ def test_delete_route_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_route_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.DeleteRouteRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_route), "__call__") as call: @@ -6704,11 +7684,16 @@ async def test_delete_route_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_route_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_route), "__call__") as call: @@ -6716,7 +7701,9 @@ def test_delete_route_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_route(name="name_value",) + client.delete_route( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -6728,19 +7715,24 @@ def test_delete_route_flattened(): def test_delete_route_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_route( - datastream.DeleteRouteRequest(), name="name_value", + datastream.DeleteRouteRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_route_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_route), "__call__") as call: @@ -6752,7 +7744,9 @@ async def test_delete_route_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_route(name="name_value",) + response = await client.delete_route( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -6765,13 +7759,16 @@ async def test_delete_route_flattened_async(): @pytest.mark.asyncio async def test_delete_route_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_route( - datastream.DeleteRouteRequest(), name="name_value", + datastream.DeleteRouteRequest(), + name="name_value", ) @@ -6782,7 +7779,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -6802,7 +7800,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = DatastreamClient(client_options=options, transport=transport,) + client = DatastreamClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -6818,7 +7819,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = DatastreamClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -6848,7 +7850,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.DatastreamGrpcTransport, transports.DatastreamGrpcAsyncIOTransport,], + [ + transports.DatastreamGrpcTransport, + transports.DatastreamGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -6858,10 +7863,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = DatastreamClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.DatastreamGrpcTransport,) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.DatastreamGrpcTransport, + ) def test_datastream_base_transport_error(): @@ -6924,6 +7947,14 @@ def test_datastream_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_datastream_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -6935,7 +7966,8 @@ def test_datastream_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.DatastreamTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -6970,7 +8002,10 @@ def test_datastream_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.DatastreamGrpcTransport, transports.DatastreamGrpcAsyncIOTransport,], + [ + transports.DatastreamGrpcTransport, + transports.DatastreamGrpcAsyncIOTransport, + ], ) def test_datastream_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -7062,24 +8097,40 @@ def test_datastream_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_datastream_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_datastream_host_no_port(transport_name): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="datastream.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "datastream.googleapis.com:443" + assert client.transport._host == ("datastream.googleapis.com:443") -def test_datastream_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_datastream_host_with_port(transport_name): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="datastream.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "datastream.googleapis.com:8000" + assert client.transport._host == ("datastream.googleapis.com:8000") def test_datastream_grpc_transport_channel(): @@ -7087,7 +8138,8 @@ def test_datastream_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.DatastreamGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -7099,7 +8151,8 @@ def test_datastream_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.DatastreamGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -7200,12 +8253,16 @@ def test_datastream_transport_channel_mtls_with_adc(transport_class): def test_datastream_grpc_lro_client(): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -7213,12 +8270,16 @@ def test_datastream_grpc_lro_client(): def test_datastream_grpc_lro_async_client(): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -7229,7 +8290,9 @@ def test_connection_profile_path(): location = "clam" connection_profile = "whelk" expected = "projects/{project}/locations/{location}/connectionProfiles/{connection_profile}".format( - project=project, location=location, connection_profile=connection_profile, + project=project, + location=location, + connection_profile=connection_profile, ) actual = DatastreamClient.connection_profile_path( project, location, connection_profile @@ -7254,7 +8317,8 @@ def test_networks_path(): project = "cuttlefish" network = "mussel" expected = "projects/{project}/global/networks/{network}".format( - project=project, network=network, + project=project, + network=network, ) actual = DatastreamClient.networks_path(project, network) assert expected == actual @@ -7277,7 +8341,9 @@ def test_private_connection_path(): location = "abalone" private_connection = "squid" expected = "projects/{project}/locations/{location}/privateConnections/{private_connection}".format( - project=project, location=location, private_connection=private_connection, + project=project, + location=location, + private_connection=private_connection, ) actual = DatastreamClient.private_connection_path( project, location, private_connection @@ -7332,7 +8398,9 @@ def test_stream_path(): location = "clam" stream = "whelk" expected = "projects/{project}/locations/{location}/streams/{stream}".format( - project=project, location=location, stream=stream, + project=project, + location=location, + stream=stream, ) actual = DatastreamClient.stream_path(project, location, stream) assert expected == actual @@ -7357,7 +8425,10 @@ def test_stream_object_path(): stream = "winkle" object = "nautilus" expected = "projects/{project}/locations/{location}/streams/{stream}/objects/{object}".format( - project=project, location=location, stream=stream, object=object, + project=project, + location=location, + stream=stream, + object=object, ) actual = DatastreamClient.stream_object_path(project, location, stream, object) assert expected == actual @@ -7399,7 +8470,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "oyster" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = DatastreamClient.common_folder_path(folder) assert expected == actual @@ -7417,7 +8490,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "cuttlefish" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = DatastreamClient.common_organization_path(organization) assert expected == actual @@ -7435,7 +8510,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "winkle" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = DatastreamClient.common_project_path(project) assert expected == actual @@ -7455,7 +8532,8 @@ def test_common_location_path(): project = "scallop" location = "abalone" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = DatastreamClient.common_location_path(project, location) assert expected == actual @@ -7480,7 +8558,8 @@ def test_client_with_default_client_info(): transports.DatastreamTransport, "_prep_wrapped_messages" ) as prep: client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -7489,7 +8568,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = DatastreamClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -7497,7 +8577,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/datastream_v1alpha1/test_datastream.py b/tests/unit/gapic/datastream_v1alpha1/test_datastream.py index e714883..4916f2b 100644 --- a/tests/unit/gapic/datastream_v1alpha1/test_datastream.py +++ b/tests/unit/gapic/datastream_v1alpha1/test_datastream.py @@ -13,40 +13,42 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import os -import mock - -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule - +import os +from google.api_core import ( + future, + gapic_v1, + grpc_helpers, + grpc_helpers_async, + operation, + operations_v1, + path_template, +) from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import future -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import operation from google.api_core import operation_async # type: ignore -from google.api_core import operations_v1 -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError -from google.cloud.datastream_v1alpha1.services.datastream import DatastreamAsyncClient -from google.cloud.datastream_v1alpha1.services.datastream import DatastreamClient -from google.cloud.datastream_v1alpha1.services.datastream import pagers -from google.cloud.datastream_v1alpha1.services.datastream import transports -from google.cloud.datastream_v1alpha1.types import datastream -from google.cloud.datastream_v1alpha1.types import datastream_resources from google.longrunning import operations_pb2 from google.oauth2 import service_account from google.protobuf import duration_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -import google.auth +import grpc +from grpc.experimental import aio +import mock +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + +from google.cloud.datastream_v1alpha1.services.datastream import ( + DatastreamAsyncClient, + DatastreamClient, + pagers, + transports, +) +from google.cloud.datastream_v1alpha1.types import datastream, datastream_resources def client_cert_source_callback(): @@ -90,19 +92,25 @@ def test__get_default_mtls_endpoint(): assert DatastreamClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [DatastreamClient, DatastreamAsyncClient,]) -def test_datastream_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (DatastreamClient, "grpc"), + (DatastreamAsyncClient, "grpc_asyncio"), + ], +) +def test_datastream_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "datastream.googleapis.com:443" + assert client.transport._host == ("datastream.googleapis.com:443") @pytest.mark.parametrize( @@ -130,22 +138,32 @@ def test_datastream_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [DatastreamClient, DatastreamAsyncClient,]) -def test_datastream_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (DatastreamClient, "grpc"), + (DatastreamAsyncClient, "grpc_asyncio"), + ], +) +def test_datastream_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "datastream.googleapis.com:443" + assert client.transport._host == ("datastream.googleapis.com:443") def test_datastream_client_get_transport_class(): @@ -485,7 +503,9 @@ def test_datastream_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -614,11 +634,16 @@ def test_datastream_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [datastream.ListConnectionProfilesRequest, dict,] + "request_type", + [ + datastream.ListConnectionProfilesRequest, + dict, + ], ) def test_list_connection_profiles(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -631,7 +656,8 @@ def test_list_connection_profiles(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = datastream.ListConnectionProfilesResponse( - next_page_token="next_page_token_value", unreachable=["unreachable_value"], + next_page_token="next_page_token_value", + unreachable=["unreachable_value"], ) response = client.list_connection_profiles(request) @@ -650,7 +676,8 @@ def test_list_connection_profiles_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -669,7 +696,8 @@ async def test_list_connection_profiles_async( request_type=datastream.ListConnectionProfilesRequest, ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -706,13 +734,15 @@ async def test_list_connection_profiles_async_from_dict(): def test_list_connection_profiles_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.ListConnectionProfilesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -728,18 +758,23 @@ def test_list_connection_profiles_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_connection_profiles_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.ListConnectionProfilesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -757,11 +792,16 @@ async def test_list_connection_profiles_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_connection_profiles_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -771,7 +811,9 @@ def test_list_connection_profiles_flattened(): call.return_value = datastream.ListConnectionProfilesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_connection_profiles(parent="parent_value",) + client.list_connection_profiles( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -783,19 +825,24 @@ def test_list_connection_profiles_flattened(): def test_list_connection_profiles_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_connection_profiles( - datastream.ListConnectionProfilesRequest(), parent="parent_value", + datastream.ListConnectionProfilesRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_connection_profiles_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -809,7 +856,9 @@ async def test_list_connection_profiles_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_connection_profiles(parent="parent_value",) + response = await client.list_connection_profiles( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -822,19 +871,23 @@ async def test_list_connection_profiles_flattened_async(): @pytest.mark.asyncio async def test_list_connection_profiles_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_connection_profiles( - datastream.ListConnectionProfilesRequest(), parent="parent_value", + datastream.ListConnectionProfilesRequest(), + parent="parent_value", ) def test_list_connection_profiles_pager(transport_name: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -852,10 +905,13 @@ def test_list_connection_profiles_pager(transport_name: str = "grpc"): next_page_token="abc", ), datastream.ListConnectionProfilesResponse( - connection_profiles=[], next_page_token="def", + connection_profiles=[], + next_page_token="def", ), datastream.ListConnectionProfilesResponse( - connection_profiles=[datastream_resources.ConnectionProfile(),], + connection_profiles=[ + datastream_resources.ConnectionProfile(), + ], next_page_token="ghi", ), datastream.ListConnectionProfilesResponse( @@ -875,7 +931,7 @@ def test_list_connection_profiles_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all( isinstance(i, datastream_resources.ConnectionProfile) for i in results @@ -884,7 +940,8 @@ def test_list_connection_profiles_pager(transport_name: str = "grpc"): def test_list_connection_profiles_pages(transport_name: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -902,10 +959,13 @@ def test_list_connection_profiles_pages(transport_name: str = "grpc"): next_page_token="abc", ), datastream.ListConnectionProfilesResponse( - connection_profiles=[], next_page_token="def", + connection_profiles=[], + next_page_token="def", ), datastream.ListConnectionProfilesResponse( - connection_profiles=[datastream_resources.ConnectionProfile(),], + connection_profiles=[ + datastream_resources.ConnectionProfile(), + ], next_page_token="ghi", ), datastream.ListConnectionProfilesResponse( @@ -923,7 +983,9 @@ def test_list_connection_profiles_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_connection_profiles_async_pager(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -942,10 +1004,13 @@ async def test_list_connection_profiles_async_pager(): next_page_token="abc", ), datastream.ListConnectionProfilesResponse( - connection_profiles=[], next_page_token="def", + connection_profiles=[], + next_page_token="def", ), datastream.ListConnectionProfilesResponse( - connection_profiles=[datastream_resources.ConnectionProfile(),], + connection_profiles=[ + datastream_resources.ConnectionProfile(), + ], next_page_token="ghi", ), datastream.ListConnectionProfilesResponse( @@ -956,10 +1021,12 @@ async def test_list_connection_profiles_async_pager(): ), RuntimeError, ) - async_pager = await client.list_connection_profiles(request={},) + async_pager = await client.list_connection_profiles( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -970,7 +1037,9 @@ async def test_list_connection_profiles_async_pager(): @pytest.mark.asyncio async def test_list_connection_profiles_async_pages(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -989,10 +1058,13 @@ async def test_list_connection_profiles_async_pages(): next_page_token="abc", ), datastream.ListConnectionProfilesResponse( - connection_profiles=[], next_page_token="def", + connection_profiles=[], + next_page_token="def", ), datastream.ListConnectionProfilesResponse( - connection_profiles=[datastream_resources.ConnectionProfile(),], + connection_profiles=[ + datastream_resources.ConnectionProfile(), + ], next_page_token="ghi", ), datastream.ListConnectionProfilesResponse( @@ -1004,18 +1076,25 @@ async def test_list_connection_profiles_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_connection_profiles(request={})).pages: + async for page_ in ( + await client.list_connection_profiles(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [datastream.GetConnectionProfileRequest, dict,] + "request_type", + [ + datastream.GetConnectionProfileRequest, + dict, + ], ) def test_get_connection_profile(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1052,7 +1131,8 @@ def test_get_connection_profile_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1070,7 +1150,8 @@ async def test_get_connection_profile_async( transport: str = "grpc_asyncio", request_type=datastream.GetConnectionProfileRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1084,7 +1165,8 @@ async def test_get_connection_profile_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( datastream_resources.ConnectionProfile( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) ) response = await client.get_connection_profile(request) @@ -1106,13 +1188,15 @@ async def test_get_connection_profile_async_from_dict(): def test_get_connection_profile_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.GetConnectionProfileRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1128,18 +1212,23 @@ def test_get_connection_profile_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_connection_profile_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.GetConnectionProfileRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1157,11 +1246,16 @@ async def test_get_connection_profile_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_connection_profile_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1171,7 +1265,9 @@ def test_get_connection_profile_flattened(): call.return_value = datastream_resources.ConnectionProfile() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_connection_profile(name="name_value",) + client.get_connection_profile( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1183,19 +1279,24 @@ def test_get_connection_profile_flattened(): def test_get_connection_profile_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_connection_profile( - datastream.GetConnectionProfileRequest(), name="name_value", + datastream.GetConnectionProfileRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_connection_profile_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1209,7 +1310,9 @@ async def test_get_connection_profile_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_connection_profile(name="name_value",) + response = await client.get_connection_profile( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1222,22 +1325,30 @@ async def test_get_connection_profile_flattened_async(): @pytest.mark.asyncio async def test_get_connection_profile_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_connection_profile( - datastream.GetConnectionProfileRequest(), name="name_value", + datastream.GetConnectionProfileRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [datastream.CreateConnectionProfileRequest, dict,] + "request_type", + [ + datastream.CreateConnectionProfileRequest, + dict, + ], ) def test_create_connection_profile(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1265,7 +1376,8 @@ def test_create_connection_profile_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1284,7 +1396,8 @@ async def test_create_connection_profile_async( request_type=datastream.CreateConnectionProfileRequest, ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1316,13 +1429,15 @@ async def test_create_connection_profile_async_from_dict(): def test_create_connection_profile_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.CreateConnectionProfileRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1338,18 +1453,23 @@ def test_create_connection_profile_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_connection_profile_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.CreateConnectionProfileRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1367,11 +1487,16 @@ async def test_create_connection_profile_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_connection_profile_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1405,7 +1530,9 @@ def test_create_connection_profile_flattened(): def test_create_connection_profile_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1422,7 +1549,9 @@ def test_create_connection_profile_flattened_error(): @pytest.mark.asyncio async def test_create_connection_profile_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1461,7 +1590,9 @@ async def test_create_connection_profile_flattened_async(): @pytest.mark.asyncio async def test_create_connection_profile_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1477,11 +1608,16 @@ async def test_create_connection_profile_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [datastream.UpdateConnectionProfileRequest, dict,] + "request_type", + [ + datastream.UpdateConnectionProfileRequest, + dict, + ], ) def test_update_connection_profile(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1509,7 +1645,8 @@ def test_update_connection_profile_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1528,7 +1665,8 @@ async def test_update_connection_profile_async( request_type=datastream.UpdateConnectionProfileRequest, ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1560,13 +1698,15 @@ async def test_update_connection_profile_async_from_dict(): def test_update_connection_profile_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.UpdateConnectionProfileRequest() - request.connection_profile.name = "connection_profile.name/value" + request.connection_profile.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1584,19 +1724,21 @@ def test_update_connection_profile_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "connection_profile.name=connection_profile.name/value", + "connection_profile.name=name_value", ) in kw["metadata"] @pytest.mark.asyncio async def test_update_connection_profile_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.UpdateConnectionProfileRequest() - request.connection_profile.name = "connection_profile.name/value" + request.connection_profile.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1616,12 +1758,14 @@ async def test_update_connection_profile_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "connection_profile.name=connection_profile.name/value", + "connection_profile.name=name_value", ) in kw["metadata"] def test_update_connection_profile_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1651,7 +1795,9 @@ def test_update_connection_profile_flattened(): def test_update_connection_profile_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1667,7 +1813,9 @@ def test_update_connection_profile_flattened_error(): @pytest.mark.asyncio async def test_update_connection_profile_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1702,7 +1850,9 @@ async def test_update_connection_profile_flattened_async(): @pytest.mark.asyncio async def test_update_connection_profile_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1717,11 +1867,16 @@ async def test_update_connection_profile_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [datastream.DeleteConnectionProfileRequest, dict,] + "request_type", + [ + datastream.DeleteConnectionProfileRequest, + dict, + ], ) def test_delete_connection_profile(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1749,7 +1904,8 @@ def test_delete_connection_profile_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1768,7 +1924,8 @@ async def test_delete_connection_profile_async( request_type=datastream.DeleteConnectionProfileRequest, ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1800,13 +1957,15 @@ async def test_delete_connection_profile_async_from_dict(): def test_delete_connection_profile_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.DeleteConnectionProfileRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1822,18 +1981,23 @@ def test_delete_connection_profile_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_connection_profile_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.DeleteConnectionProfileRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1851,11 +2015,16 @@ async def test_delete_connection_profile_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_connection_profile_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1865,7 +2034,9 @@ def test_delete_connection_profile_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_connection_profile(name="name_value",) + client.delete_connection_profile( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1877,19 +2048,24 @@ def test_delete_connection_profile_flattened(): def test_delete_connection_profile_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_connection_profile( - datastream.DeleteConnectionProfileRequest(), name="name_value", + datastream.DeleteConnectionProfileRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_connection_profile_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1903,7 +2079,9 @@ async def test_delete_connection_profile_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_connection_profile(name="name_value",) + response = await client.delete_connection_profile( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1916,22 +2094,30 @@ async def test_delete_connection_profile_flattened_async(): @pytest.mark.asyncio async def test_delete_connection_profile_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_connection_profile( - datastream.DeleteConnectionProfileRequest(), name="name_value", + datastream.DeleteConnectionProfileRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [datastream.DiscoverConnectionProfileRequest, dict,] + "request_type", + [ + datastream.DiscoverConnectionProfileRequest, + dict, + ], ) def test_discover_connection_profile(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1965,7 +2151,8 @@ def test_discover_connection_profile_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1984,7 +2171,8 @@ async def test_discover_connection_profile_async( request_type=datastream.DiscoverConnectionProfileRequest, ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2016,13 +2204,15 @@ async def test_discover_connection_profile_async_from_dict(): def test_discover_connection_profile_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.DiscoverConnectionProfileRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2038,18 +2228,23 @@ def test_discover_connection_profile_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_discover_connection_profile_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.DiscoverConnectionProfileRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2067,13 +2262,23 @@ async def test_discover_connection_profile_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [datastream.ListStreamsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.ListStreamsRequest, + dict, + ], +) def test_list_streams(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2084,7 +2289,8 @@ def test_list_streams(request_type, transport: str = "grpc"): with mock.patch.object(type(client.transport.list_streams), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = datastream.ListStreamsResponse( - next_page_token="next_page_token_value", unreachable=["unreachable_value"], + next_page_token="next_page_token_value", + unreachable=["unreachable_value"], ) response = client.list_streams(request) @@ -2103,7 +2309,8 @@ def test_list_streams_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2119,7 +2326,8 @@ async def test_list_streams_async( transport: str = "grpc_asyncio", request_type=datastream.ListStreamsRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2154,13 +2362,15 @@ async def test_list_streams_async_from_dict(): def test_list_streams_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.ListStreamsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_streams), "__call__") as call: @@ -2174,18 +2384,23 @@ def test_list_streams_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_streams_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.ListStreamsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_streams), "__call__") as call: @@ -2201,11 +2416,16 @@ async def test_list_streams_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_streams_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_streams), "__call__") as call: @@ -2213,7 +2433,9 @@ def test_list_streams_flattened(): call.return_value = datastream.ListStreamsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_streams(parent="parent_value",) + client.list_streams( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2225,19 +2447,24 @@ def test_list_streams_flattened(): def test_list_streams_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_streams( - datastream.ListStreamsRequest(), parent="parent_value", + datastream.ListStreamsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_streams_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_streams), "__call__") as call: @@ -2249,7 +2476,9 @@ async def test_list_streams_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_streams(parent="parent_value",) + response = await client.list_streams( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2262,19 +2491,23 @@ async def test_list_streams_flattened_async(): @pytest.mark.asyncio async def test_list_streams_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_streams( - datastream.ListStreamsRequest(), parent="parent_value", + datastream.ListStreamsRequest(), + parent="parent_value", ) def test_list_streams_pager(transport_name: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2289,12 +2522,21 @@ def test_list_streams_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - datastream.ListStreamsResponse(streams=[], next_page_token="def",), datastream.ListStreamsResponse( - streams=[datastream_resources.Stream(),], next_page_token="ghi", + streams=[], + next_page_token="def", + ), + datastream.ListStreamsResponse( + streams=[ + datastream_resources.Stream(), + ], + next_page_token="ghi", ), datastream.ListStreamsResponse( - streams=[datastream_resources.Stream(), datastream_resources.Stream(),], + streams=[ + datastream_resources.Stream(), + datastream_resources.Stream(), + ], ), RuntimeError, ) @@ -2307,14 +2549,15 @@ def test_list_streams_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, datastream_resources.Stream) for i in results) def test_list_streams_pages(transport_name: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2329,12 +2572,21 @@ def test_list_streams_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - datastream.ListStreamsResponse(streams=[], next_page_token="def",), datastream.ListStreamsResponse( - streams=[datastream_resources.Stream(),], next_page_token="ghi", + streams=[], + next_page_token="def", ), datastream.ListStreamsResponse( - streams=[datastream_resources.Stream(), datastream_resources.Stream(),], + streams=[ + datastream_resources.Stream(), + ], + next_page_token="ghi", + ), + datastream.ListStreamsResponse( + streams=[ + datastream_resources.Stream(), + datastream_resources.Stream(), + ], ), RuntimeError, ) @@ -2345,7 +2597,9 @@ def test_list_streams_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_streams_async_pager(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2361,19 +2615,30 @@ async def test_list_streams_async_pager(): ], next_page_token="abc", ), - datastream.ListStreamsResponse(streams=[], next_page_token="def",), datastream.ListStreamsResponse( - streams=[datastream_resources.Stream(),], next_page_token="ghi", + streams=[], + next_page_token="def", + ), + datastream.ListStreamsResponse( + streams=[ + datastream_resources.Stream(), + ], + next_page_token="ghi", ), datastream.ListStreamsResponse( - streams=[datastream_resources.Stream(), datastream_resources.Stream(),], + streams=[ + datastream_resources.Stream(), + datastream_resources.Stream(), + ], ), RuntimeError, ) - async_pager = await client.list_streams(request={},) + async_pager = await client.list_streams( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -2382,7 +2647,9 @@ async def test_list_streams_async_pager(): @pytest.mark.asyncio async def test_list_streams_async_pages(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2398,26 +2665,44 @@ async def test_list_streams_async_pages(): ], next_page_token="abc", ), - datastream.ListStreamsResponse(streams=[], next_page_token="def",), datastream.ListStreamsResponse( - streams=[datastream_resources.Stream(),], next_page_token="ghi", + streams=[], + next_page_token="def", ), datastream.ListStreamsResponse( - streams=[datastream_resources.Stream(), datastream_resources.Stream(),], + streams=[ + datastream_resources.Stream(), + ], + next_page_token="ghi", + ), + datastream.ListStreamsResponse( + streams=[ + datastream_resources.Stream(), + datastream_resources.Stream(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_streams(request={})).pages: + async for page_ in ( + await client.list_streams(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [datastream.GetStreamRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.GetStreamRequest, + dict, + ], +) def test_get_stream(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2459,7 +2744,8 @@ def test_get_stream_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2475,7 +2761,8 @@ async def test_get_stream_async( transport: str = "grpc_asyncio", request_type=datastream.GetStreamRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2512,13 +2799,15 @@ async def test_get_stream_async_from_dict(): def test_get_stream_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.GetStreamRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_stream), "__call__") as call: @@ -2532,18 +2821,23 @@ def test_get_stream_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_stream_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.GetStreamRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_stream), "__call__") as call: @@ -2559,11 +2853,16 @@ async def test_get_stream_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_stream_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_stream), "__call__") as call: @@ -2571,7 +2870,9 @@ def test_get_stream_flattened(): call.return_value = datastream_resources.Stream() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_stream(name="name_value",) + client.get_stream( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2583,19 +2884,24 @@ def test_get_stream_flattened(): def test_get_stream_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_stream( - datastream.GetStreamRequest(), name="name_value", + datastream.GetStreamRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_stream_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_stream), "__call__") as call: @@ -2607,7 +2913,9 @@ async def test_get_stream_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_stream(name="name_value",) + response = await client.get_stream( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2620,20 +2928,30 @@ async def test_get_stream_flattened_async(): @pytest.mark.asyncio async def test_get_stream_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_stream( - datastream.GetStreamRequest(), name="name_value", + datastream.GetStreamRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [datastream.CreateStreamRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.CreateStreamRequest, + dict, + ], +) def test_create_stream(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2659,7 +2977,8 @@ def test_create_stream_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2675,7 +2994,8 @@ async def test_create_stream_async( transport: str = "grpc_asyncio", request_type=datastream.CreateStreamRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2705,13 +3025,15 @@ async def test_create_stream_async_from_dict(): def test_create_stream_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.CreateStreamRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_stream), "__call__") as call: @@ -2725,18 +3047,23 @@ def test_create_stream_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_stream_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.CreateStreamRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_stream), "__call__") as call: @@ -2752,11 +3079,16 @@ async def test_create_stream_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_stream_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_stream), "__call__") as call: @@ -2786,7 +3118,9 @@ def test_create_stream_flattened(): def test_create_stream_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2801,7 +3135,9 @@ def test_create_stream_flattened_error(): @pytest.mark.asyncio async def test_create_stream_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_stream), "__call__") as call: @@ -2836,7 +3172,9 @@ async def test_create_stream_flattened_async(): @pytest.mark.asyncio async def test_create_stream_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2849,10 +3187,17 @@ async def test_create_stream_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [datastream.UpdateStreamRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.UpdateStreamRequest, + dict, + ], +) def test_update_stream(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2878,7 +3223,8 @@ def test_update_stream_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2894,7 +3240,8 @@ async def test_update_stream_async( transport: str = "grpc_asyncio", request_type=datastream.UpdateStreamRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2924,13 +3271,15 @@ async def test_update_stream_async_from_dict(): def test_update_stream_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.UpdateStreamRequest() - request.stream.name = "stream.name/value" + request.stream.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_stream), "__call__") as call: @@ -2944,18 +3293,23 @@ def test_update_stream_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "stream.name=stream.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "stream.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_stream_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.UpdateStreamRequest() - request.stream.name = "stream.name/value" + request.stream.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_stream), "__call__") as call: @@ -2971,11 +3325,16 @@ async def test_update_stream_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "stream.name=stream.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "stream.name=name_value", + ) in kw["metadata"] def test_update_stream_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_stream), "__call__") as call: @@ -3001,7 +3360,9 @@ def test_update_stream_flattened(): def test_update_stream_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3015,7 +3376,9 @@ def test_update_stream_flattened_error(): @pytest.mark.asyncio async def test_update_stream_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_stream), "__call__") as call: @@ -3046,7 +3409,9 @@ async def test_update_stream_flattened_async(): @pytest.mark.asyncio async def test_update_stream_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3058,10 +3423,17 @@ async def test_update_stream_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [datastream.DeleteStreamRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.DeleteStreamRequest, + dict, + ], +) def test_delete_stream(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3087,7 +3459,8 @@ def test_delete_stream_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3103,7 +3476,8 @@ async def test_delete_stream_async( transport: str = "grpc_asyncio", request_type=datastream.DeleteStreamRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3133,13 +3507,15 @@ async def test_delete_stream_async_from_dict(): def test_delete_stream_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.DeleteStreamRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_stream), "__call__") as call: @@ -3153,18 +3529,23 @@ def test_delete_stream_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_stream_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.DeleteStreamRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_stream), "__call__") as call: @@ -3180,11 +3561,16 @@ async def test_delete_stream_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_stream_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_stream), "__call__") as call: @@ -3192,7 +3578,9 @@ def test_delete_stream_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_stream(name="name_value",) + client.delete_stream( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3204,19 +3592,24 @@ def test_delete_stream_flattened(): def test_delete_stream_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_stream( - datastream.DeleteStreamRequest(), name="name_value", + datastream.DeleteStreamRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_stream_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_stream), "__call__") as call: @@ -3228,7 +3621,9 @@ async def test_delete_stream_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_stream(name="name_value",) + response = await client.delete_stream( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3241,20 +3636,30 @@ async def test_delete_stream_flattened_async(): @pytest.mark.asyncio async def test_delete_stream_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_stream( - datastream.DeleteStreamRequest(), name="name_value", + datastream.DeleteStreamRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [datastream.FetchErrorsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.FetchErrorsRequest, + dict, + ], +) def test_fetch_errors(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3280,7 +3685,8 @@ def test_fetch_errors_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3296,7 +3702,8 @@ async def test_fetch_errors_async( transport: str = "grpc_asyncio", request_type=datastream.FetchErrorsRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3326,13 +3733,15 @@ async def test_fetch_errors_async_from_dict(): def test_fetch_errors_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.FetchErrorsRequest() - request.stream = "stream/value" + request.stream = "stream_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.fetch_errors), "__call__") as call: @@ -3346,18 +3755,23 @@ def test_fetch_errors_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "stream=stream/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "stream=stream_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_fetch_errors_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.FetchErrorsRequest() - request.stream = "stream/value" + request.stream = "stream_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.fetch_errors), "__call__") as call: @@ -3373,13 +3787,23 @@ async def test_fetch_errors_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "stream=stream/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "stream=stream_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [datastream.FetchStaticIpsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.FetchStaticIpsRequest, + dict, + ], +) def test_fetch_static_ips(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3390,7 +3814,8 @@ def test_fetch_static_ips(request_type, transport: str = "grpc"): with mock.patch.object(type(client.transport.fetch_static_ips), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = datastream.FetchStaticIpsResponse( - static_ips=["static_ips_value"], next_page_token="next_page_token_value", + static_ips=["static_ips_value"], + next_page_token="next_page_token_value", ) response = client.fetch_static_ips(request) @@ -3409,7 +3834,8 @@ def test_fetch_static_ips_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3425,7 +3851,8 @@ async def test_fetch_static_ips_async( transport: str = "grpc_asyncio", request_type=datastream.FetchStaticIpsRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3460,13 +3887,15 @@ async def test_fetch_static_ips_async_from_dict(): def test_fetch_static_ips_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.FetchStaticIpsRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.fetch_static_ips), "__call__") as call: @@ -3480,18 +3909,23 @@ def test_fetch_static_ips_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_fetch_static_ips_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.FetchStaticIpsRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.fetch_static_ips), "__call__") as call: @@ -3507,11 +3941,16 @@ async def test_fetch_static_ips_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_fetch_static_ips_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.fetch_static_ips), "__call__") as call: @@ -3519,7 +3958,9 @@ def test_fetch_static_ips_flattened(): call.return_value = datastream.FetchStaticIpsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.fetch_static_ips(name="name_value",) + client.fetch_static_ips( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3531,19 +3972,24 @@ def test_fetch_static_ips_flattened(): def test_fetch_static_ips_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.fetch_static_ips( - datastream.FetchStaticIpsRequest(), name="name_value", + datastream.FetchStaticIpsRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_fetch_static_ips_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.fetch_static_ips), "__call__") as call: @@ -3555,7 +4001,9 @@ async def test_fetch_static_ips_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.fetch_static_ips(name="name_value",) + response = await client.fetch_static_ips( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3568,19 +4016,23 @@ async def test_fetch_static_ips_flattened_async(): @pytest.mark.asyncio async def test_fetch_static_ips_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.fetch_static_ips( - datastream.FetchStaticIpsRequest(), name="name_value", + datastream.FetchStaticIpsRequest(), + name="name_value", ) def test_fetch_static_ips_pager(transport_name: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3588,13 +4040,29 @@ def test_fetch_static_ips_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( datastream.FetchStaticIpsResponse( - static_ips=[str(), str(), str(),], next_page_token="abc", + static_ips=[ + str(), + str(), + str(), + ], + next_page_token="abc", + ), + datastream.FetchStaticIpsResponse( + static_ips=[], + next_page_token="def", + ), + datastream.FetchStaticIpsResponse( + static_ips=[ + str(), + ], + next_page_token="ghi", ), - datastream.FetchStaticIpsResponse(static_ips=[], next_page_token="def",), datastream.FetchStaticIpsResponse( - static_ips=[str(),], next_page_token="ghi", + static_ips=[ + str(), + str(), + ], ), - datastream.FetchStaticIpsResponse(static_ips=[str(), str(),],), RuntimeError, ) @@ -3606,14 +4074,15 @@ def test_fetch_static_ips_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, str) for i in results) def test_fetch_static_ips_pages(transport_name: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3621,13 +4090,29 @@ def test_fetch_static_ips_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( datastream.FetchStaticIpsResponse( - static_ips=[str(), str(), str(),], next_page_token="abc", + static_ips=[ + str(), + str(), + str(), + ], + next_page_token="abc", ), - datastream.FetchStaticIpsResponse(static_ips=[], next_page_token="def",), datastream.FetchStaticIpsResponse( - static_ips=[str(),], next_page_token="ghi", + static_ips=[], + next_page_token="def", + ), + datastream.FetchStaticIpsResponse( + static_ips=[ + str(), + ], + next_page_token="ghi", + ), + datastream.FetchStaticIpsResponse( + static_ips=[ + str(), + str(), + ], ), - datastream.FetchStaticIpsResponse(static_ips=[str(), str(),],), RuntimeError, ) pages = list(client.fetch_static_ips(request={}).pages) @@ -3637,7 +4122,9 @@ def test_fetch_static_ips_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_fetch_static_ips_async_pager(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3646,19 +4133,37 @@ async def test_fetch_static_ips_async_pager(): # Set the response to a series of pages. call.side_effect = ( datastream.FetchStaticIpsResponse( - static_ips=[str(), str(), str(),], next_page_token="abc", + static_ips=[ + str(), + str(), + str(), + ], + next_page_token="abc", + ), + datastream.FetchStaticIpsResponse( + static_ips=[], + next_page_token="def", + ), + datastream.FetchStaticIpsResponse( + static_ips=[ + str(), + ], + next_page_token="ghi", ), - datastream.FetchStaticIpsResponse(static_ips=[], next_page_token="def",), datastream.FetchStaticIpsResponse( - static_ips=[str(),], next_page_token="ghi", + static_ips=[ + str(), + str(), + ], ), - datastream.FetchStaticIpsResponse(static_ips=[str(), str(),],), RuntimeError, ) - async_pager = await client.fetch_static_ips(request={},) + async_pager = await client.fetch_static_ips( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -3667,7 +4172,9 @@ async def test_fetch_static_ips_async_pager(): @pytest.mark.asyncio async def test_fetch_static_ips_async_pages(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3676,28 +4183,51 @@ async def test_fetch_static_ips_async_pages(): # Set the response to a series of pages. call.side_effect = ( datastream.FetchStaticIpsResponse( - static_ips=[str(), str(), str(),], next_page_token="abc", + static_ips=[ + str(), + str(), + str(), + ], + next_page_token="abc", + ), + datastream.FetchStaticIpsResponse( + static_ips=[], + next_page_token="def", + ), + datastream.FetchStaticIpsResponse( + static_ips=[ + str(), + ], + next_page_token="ghi", ), - datastream.FetchStaticIpsResponse(static_ips=[], next_page_token="def",), datastream.FetchStaticIpsResponse( - static_ips=[str(),], next_page_token="ghi", + static_ips=[ + str(), + str(), + ], ), - datastream.FetchStaticIpsResponse(static_ips=[str(), str(),],), RuntimeError, ) pages = [] - async for page_ in (await client.fetch_static_ips(request={})).pages: + async for page_ in ( + await client.fetch_static_ips(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [datastream.CreatePrivateConnectionRequest, dict,] + "request_type", + [ + datastream.CreatePrivateConnectionRequest, + dict, + ], ) def test_create_private_connection(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3725,7 +4255,8 @@ def test_create_private_connection_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3744,7 +4275,8 @@ async def test_create_private_connection_async( request_type=datastream.CreatePrivateConnectionRequest, ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3776,13 +4308,15 @@ async def test_create_private_connection_async_from_dict(): def test_create_private_connection_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.CreatePrivateConnectionRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3798,18 +4332,23 @@ def test_create_private_connection_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_private_connection_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.CreatePrivateConnectionRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3827,11 +4366,16 @@ async def test_create_private_connection_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_private_connection_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3865,7 +4409,9 @@ def test_create_private_connection_flattened(): def test_create_private_connection_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3882,7 +4428,9 @@ def test_create_private_connection_flattened_error(): @pytest.mark.asyncio async def test_create_private_connection_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3921,7 +4469,9 @@ async def test_create_private_connection_flattened_async(): @pytest.mark.asyncio async def test_create_private_connection_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3937,11 +4487,16 @@ async def test_create_private_connection_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [datastream.GetPrivateConnectionRequest, dict,] + "request_type", + [ + datastream.GetPrivateConnectionRequest, + dict, + ], ) def test_get_private_connection(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3976,7 +4531,8 @@ def test_get_private_connection_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3994,7 +4550,8 @@ async def test_get_private_connection_async( transport: str = "grpc_asyncio", request_type=datastream.GetPrivateConnectionRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4033,13 +4590,15 @@ async def test_get_private_connection_async_from_dict(): def test_get_private_connection_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.GetPrivateConnectionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4055,18 +4614,23 @@ def test_get_private_connection_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_private_connection_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.GetPrivateConnectionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4084,11 +4648,16 @@ async def test_get_private_connection_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_private_connection_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4098,7 +4667,9 @@ def test_get_private_connection_flattened(): call.return_value = datastream_resources.PrivateConnection() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_private_connection(name="name_value",) + client.get_private_connection( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4110,19 +4681,24 @@ def test_get_private_connection_flattened(): def test_get_private_connection_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_private_connection( - datastream.GetPrivateConnectionRequest(), name="name_value", + datastream.GetPrivateConnectionRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_private_connection_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4136,7 +4712,9 @@ async def test_get_private_connection_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_private_connection(name="name_value",) + response = await client.get_private_connection( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4149,22 +4727,30 @@ async def test_get_private_connection_flattened_async(): @pytest.mark.asyncio async def test_get_private_connection_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_private_connection( - datastream.GetPrivateConnectionRequest(), name="name_value", + datastream.GetPrivateConnectionRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [datastream.ListPrivateConnectionsRequest, dict,] + "request_type", + [ + datastream.ListPrivateConnectionsRequest, + dict, + ], ) def test_list_private_connections(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4177,7 +4763,8 @@ def test_list_private_connections(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = datastream.ListPrivateConnectionsResponse( - next_page_token="next_page_token_value", unreachable=["unreachable_value"], + next_page_token="next_page_token_value", + unreachable=["unreachable_value"], ) response = client.list_private_connections(request) @@ -4196,7 +4783,8 @@ def test_list_private_connections_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4215,7 +4803,8 @@ async def test_list_private_connections_async( request_type=datastream.ListPrivateConnectionsRequest, ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4252,13 +4841,15 @@ async def test_list_private_connections_async_from_dict(): def test_list_private_connections_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.ListPrivateConnectionsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4274,18 +4865,23 @@ def test_list_private_connections_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_private_connections_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.ListPrivateConnectionsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4303,11 +4899,16 @@ async def test_list_private_connections_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_private_connections_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4317,7 +4918,9 @@ def test_list_private_connections_flattened(): call.return_value = datastream.ListPrivateConnectionsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_private_connections(parent="parent_value",) + client.list_private_connections( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4329,19 +4932,24 @@ def test_list_private_connections_flattened(): def test_list_private_connections_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_private_connections( - datastream.ListPrivateConnectionsRequest(), parent="parent_value", + datastream.ListPrivateConnectionsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_private_connections_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4355,7 +4963,9 @@ async def test_list_private_connections_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_private_connections(parent="parent_value",) + response = await client.list_private_connections( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4368,19 +4978,23 @@ async def test_list_private_connections_flattened_async(): @pytest.mark.asyncio async def test_list_private_connections_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_private_connections( - datastream.ListPrivateConnectionsRequest(), parent="parent_value", + datastream.ListPrivateConnectionsRequest(), + parent="parent_value", ) def test_list_private_connections_pager(transport_name: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4398,10 +5012,13 @@ def test_list_private_connections_pager(transport_name: str = "grpc"): next_page_token="abc", ), datastream.ListPrivateConnectionsResponse( - private_connections=[], next_page_token="def", + private_connections=[], + next_page_token="def", ), datastream.ListPrivateConnectionsResponse( - private_connections=[datastream_resources.PrivateConnection(),], + private_connections=[ + datastream_resources.PrivateConnection(), + ], next_page_token="ghi", ), datastream.ListPrivateConnectionsResponse( @@ -4421,7 +5038,7 @@ def test_list_private_connections_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all( isinstance(i, datastream_resources.PrivateConnection) for i in results @@ -4430,7 +5047,8 @@ def test_list_private_connections_pager(transport_name: str = "grpc"): def test_list_private_connections_pages(transport_name: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4448,10 +5066,13 @@ def test_list_private_connections_pages(transport_name: str = "grpc"): next_page_token="abc", ), datastream.ListPrivateConnectionsResponse( - private_connections=[], next_page_token="def", + private_connections=[], + next_page_token="def", ), datastream.ListPrivateConnectionsResponse( - private_connections=[datastream_resources.PrivateConnection(),], + private_connections=[ + datastream_resources.PrivateConnection(), + ], next_page_token="ghi", ), datastream.ListPrivateConnectionsResponse( @@ -4469,7 +5090,9 @@ def test_list_private_connections_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_private_connections_async_pager(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4488,10 +5111,13 @@ async def test_list_private_connections_async_pager(): next_page_token="abc", ), datastream.ListPrivateConnectionsResponse( - private_connections=[], next_page_token="def", + private_connections=[], + next_page_token="def", ), datastream.ListPrivateConnectionsResponse( - private_connections=[datastream_resources.PrivateConnection(),], + private_connections=[ + datastream_resources.PrivateConnection(), + ], next_page_token="ghi", ), datastream.ListPrivateConnectionsResponse( @@ -4502,10 +5128,12 @@ async def test_list_private_connections_async_pager(): ), RuntimeError, ) - async_pager = await client.list_private_connections(request={},) + async_pager = await client.list_private_connections( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -4516,7 +5144,9 @@ async def test_list_private_connections_async_pager(): @pytest.mark.asyncio async def test_list_private_connections_async_pages(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4535,10 +5165,13 @@ async def test_list_private_connections_async_pages(): next_page_token="abc", ), datastream.ListPrivateConnectionsResponse( - private_connections=[], next_page_token="def", + private_connections=[], + next_page_token="def", ), datastream.ListPrivateConnectionsResponse( - private_connections=[datastream_resources.PrivateConnection(),], + private_connections=[ + datastream_resources.PrivateConnection(), + ], next_page_token="ghi", ), datastream.ListPrivateConnectionsResponse( @@ -4550,18 +5183,25 @@ async def test_list_private_connections_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_private_connections(request={})).pages: + async for page_ in ( + await client.list_private_connections(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [datastream.DeletePrivateConnectionRequest, dict,] + "request_type", + [ + datastream.DeletePrivateConnectionRequest, + dict, + ], ) def test_delete_private_connection(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4589,7 +5229,8 @@ def test_delete_private_connection_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4608,7 +5249,8 @@ async def test_delete_private_connection_async( request_type=datastream.DeletePrivateConnectionRequest, ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4640,13 +5282,15 @@ async def test_delete_private_connection_async_from_dict(): def test_delete_private_connection_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.DeletePrivateConnectionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4662,18 +5306,23 @@ def test_delete_private_connection_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_private_connection_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.DeletePrivateConnectionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4691,11 +5340,16 @@ async def test_delete_private_connection_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_private_connection_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4705,7 +5359,9 @@ def test_delete_private_connection_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_private_connection(name="name_value",) + client.delete_private_connection( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4717,19 +5373,24 @@ def test_delete_private_connection_flattened(): def test_delete_private_connection_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_private_connection( - datastream.DeletePrivateConnectionRequest(), name="name_value", + datastream.DeletePrivateConnectionRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_private_connection_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4743,7 +5404,9 @@ async def test_delete_private_connection_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_private_connection(name="name_value",) + response = await client.delete_private_connection( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4756,20 +5419,30 @@ async def test_delete_private_connection_flattened_async(): @pytest.mark.asyncio async def test_delete_private_connection_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_private_connection( - datastream.DeletePrivateConnectionRequest(), name="name_value", + datastream.DeletePrivateConnectionRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [datastream.CreateRouteRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.CreateRouteRequest, + dict, + ], +) def test_create_route(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4795,7 +5468,8 @@ def test_create_route_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4811,7 +5485,8 @@ async def test_create_route_async( transport: str = "grpc_asyncio", request_type=datastream.CreateRouteRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4841,13 +5516,15 @@ async def test_create_route_async_from_dict(): def test_create_route_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.CreateRouteRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_route), "__call__") as call: @@ -4861,18 +5538,23 @@ def test_create_route_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_route_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.CreateRouteRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_route), "__call__") as call: @@ -4888,11 +5570,16 @@ async def test_create_route_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_route_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_route), "__call__") as call: @@ -4922,7 +5609,9 @@ def test_create_route_flattened(): def test_create_route_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4937,7 +5626,9 @@ def test_create_route_flattened_error(): @pytest.mark.asyncio async def test_create_route_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_route), "__call__") as call: @@ -4972,7 +5663,9 @@ async def test_create_route_flattened_async(): @pytest.mark.asyncio async def test_create_route_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4985,10 +5678,17 @@ async def test_create_route_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [datastream.GetRouteRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.GetRouteRequest, + dict, + ], +) def test_get_route(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5023,7 +5723,8 @@ def test_get_route_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5039,7 +5740,8 @@ async def test_get_route_async( transport: str = "grpc_asyncio", request_type=datastream.GetRouteRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5078,13 +5780,15 @@ async def test_get_route_async_from_dict(): def test_get_route_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.GetRouteRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_route), "__call__") as call: @@ -5098,18 +5802,23 @@ def test_get_route_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_route_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.GetRouteRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_route), "__call__") as call: @@ -5125,11 +5834,16 @@ async def test_get_route_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_route_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_route), "__call__") as call: @@ -5137,7 +5851,9 @@ def test_get_route_flattened(): call.return_value = datastream_resources.Route() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_route(name="name_value",) + client.get_route( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5149,19 +5865,24 @@ def test_get_route_flattened(): def test_get_route_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_route( - datastream.GetRouteRequest(), name="name_value", + datastream.GetRouteRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_route_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_route), "__call__") as call: @@ -5173,7 +5894,9 @@ async def test_get_route_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_route(name="name_value",) + response = await client.get_route( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5186,20 +5909,30 @@ async def test_get_route_flattened_async(): @pytest.mark.asyncio async def test_get_route_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_route( - datastream.GetRouteRequest(), name="name_value", + datastream.GetRouteRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [datastream.ListRoutesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.ListRoutesRequest, + dict, + ], +) def test_list_routes(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5210,7 +5943,8 @@ def test_list_routes(request_type, transport: str = "grpc"): with mock.patch.object(type(client.transport.list_routes), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = datastream.ListRoutesResponse( - next_page_token="next_page_token_value", unreachable=["unreachable_value"], + next_page_token="next_page_token_value", + unreachable=["unreachable_value"], ) response = client.list_routes(request) @@ -5229,7 +5963,8 @@ def test_list_routes_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5245,7 +5980,8 @@ async def test_list_routes_async( transport: str = "grpc_asyncio", request_type=datastream.ListRoutesRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5280,13 +6016,15 @@ async def test_list_routes_async_from_dict(): def test_list_routes_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.ListRoutesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_routes), "__call__") as call: @@ -5300,18 +6038,23 @@ def test_list_routes_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_routes_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.ListRoutesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_routes), "__call__") as call: @@ -5327,11 +6070,16 @@ async def test_list_routes_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_routes_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_routes), "__call__") as call: @@ -5339,7 +6087,9 @@ def test_list_routes_flattened(): call.return_value = datastream.ListRoutesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_routes(parent="parent_value",) + client.list_routes( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5351,19 +6101,24 @@ def test_list_routes_flattened(): def test_list_routes_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_routes( - datastream.ListRoutesRequest(), parent="parent_value", + datastream.ListRoutesRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_routes_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_routes), "__call__") as call: @@ -5375,7 +6130,9 @@ async def test_list_routes_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_routes(parent="parent_value",) + response = await client.list_routes( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5388,19 +6145,23 @@ async def test_list_routes_flattened_async(): @pytest.mark.asyncio async def test_list_routes_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_routes( - datastream.ListRoutesRequest(), parent="parent_value", + datastream.ListRoutesRequest(), + parent="parent_value", ) def test_list_routes_pager(transport_name: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5415,12 +6176,21 @@ def test_list_routes_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - datastream.ListRoutesResponse(routes=[], next_page_token="def",), datastream.ListRoutesResponse( - routes=[datastream_resources.Route(),], next_page_token="ghi", + routes=[], + next_page_token="def", ), datastream.ListRoutesResponse( - routes=[datastream_resources.Route(), datastream_resources.Route(),], + routes=[ + datastream_resources.Route(), + ], + next_page_token="ghi", + ), + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + datastream_resources.Route(), + ], ), RuntimeError, ) @@ -5433,14 +6203,15 @@ def test_list_routes_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, datastream_resources.Route) for i in results) def test_list_routes_pages(transport_name: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5455,12 +6226,21 @@ def test_list_routes_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - datastream.ListRoutesResponse(routes=[], next_page_token="def",), datastream.ListRoutesResponse( - routes=[datastream_resources.Route(),], next_page_token="ghi", + routes=[], + next_page_token="def", + ), + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + ], + next_page_token="ghi", ), datastream.ListRoutesResponse( - routes=[datastream_resources.Route(), datastream_resources.Route(),], + routes=[ + datastream_resources.Route(), + datastream_resources.Route(), + ], ), RuntimeError, ) @@ -5471,7 +6251,9 @@ def test_list_routes_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_routes_async_pager(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5487,19 +6269,30 @@ async def test_list_routes_async_pager(): ], next_page_token="abc", ), - datastream.ListRoutesResponse(routes=[], next_page_token="def",), datastream.ListRoutesResponse( - routes=[datastream_resources.Route(),], next_page_token="ghi", + routes=[], + next_page_token="def", + ), + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + ], + next_page_token="ghi", ), datastream.ListRoutesResponse( - routes=[datastream_resources.Route(), datastream_resources.Route(),], + routes=[ + datastream_resources.Route(), + datastream_resources.Route(), + ], ), RuntimeError, ) - async_pager = await client.list_routes(request={},) + async_pager = await client.list_routes( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -5508,7 +6301,9 @@ async def test_list_routes_async_pager(): @pytest.mark.asyncio async def test_list_routes_async_pages(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5524,26 +6319,44 @@ async def test_list_routes_async_pages(): ], next_page_token="abc", ), - datastream.ListRoutesResponse(routes=[], next_page_token="def",), datastream.ListRoutesResponse( - routes=[datastream_resources.Route(),], next_page_token="ghi", + routes=[], + next_page_token="def", + ), + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + ], + next_page_token="ghi", ), datastream.ListRoutesResponse( - routes=[datastream_resources.Route(), datastream_resources.Route(),], + routes=[ + datastream_resources.Route(), + datastream_resources.Route(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_routes(request={})).pages: + async for page_ in ( + await client.list_routes(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [datastream.DeleteRouteRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + datastream.DeleteRouteRequest, + dict, + ], +) def test_delete_route(request_type, transport: str = "grpc"): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5569,7 +6382,8 @@ def test_delete_route_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5585,7 +6399,8 @@ async def test_delete_route_async( transport: str = "grpc_asyncio", request_type=datastream.DeleteRouteRequest ): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5615,13 +6430,15 @@ async def test_delete_route_async_from_dict(): def test_delete_route_field_headers(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.DeleteRouteRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_route), "__call__") as call: @@ -5635,18 +6452,23 @@ def test_delete_route_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_route_field_headers_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = datastream.DeleteRouteRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_route), "__call__") as call: @@ -5662,11 +6484,16 @@ async def test_delete_route_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_route_flattened(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_route), "__call__") as call: @@ -5674,7 +6501,9 @@ def test_delete_route_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_route(name="name_value",) + client.delete_route( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5686,19 +6515,24 @@ def test_delete_route_flattened(): def test_delete_route_flattened_error(): - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_route( - datastream.DeleteRouteRequest(), name="name_value", + datastream.DeleteRouteRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_route_flattened_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_route), "__call__") as call: @@ -5710,7 +6544,9 @@ async def test_delete_route_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_route(name="name_value",) + response = await client.delete_route( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5723,13 +6559,16 @@ async def test_delete_route_flattened_async(): @pytest.mark.asyncio async def test_delete_route_flattened_error_async(): - client = DatastreamAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_route( - datastream.DeleteRouteRequest(), name="name_value", + datastream.DeleteRouteRequest(), + name="name_value", ) @@ -5740,7 +6579,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -5760,7 +6600,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = DatastreamClient(client_options=options, transport=transport,) + client = DatastreamClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -5776,7 +6619,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = DatastreamClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -5806,7 +6650,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.DatastreamGrpcTransport, transports.DatastreamGrpcAsyncIOTransport,], + [ + transports.DatastreamGrpcTransport, + transports.DatastreamGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -5816,10 +6663,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = DatastreamClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = DatastreamClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.DatastreamGrpcTransport,) + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.DatastreamGrpcTransport, + ) def test_datastream_base_transport_error(): @@ -5878,6 +6743,14 @@ def test_datastream_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_datastream_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -5889,7 +6762,8 @@ def test_datastream_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.DatastreamTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -5924,7 +6798,10 @@ def test_datastream_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.DatastreamGrpcTransport, transports.DatastreamGrpcAsyncIOTransport,], + [ + transports.DatastreamGrpcTransport, + transports.DatastreamGrpcAsyncIOTransport, + ], ) def test_datastream_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -6016,24 +6893,40 @@ def test_datastream_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_datastream_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_datastream_host_no_port(transport_name): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="datastream.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "datastream.googleapis.com:443" + assert client.transport._host == ("datastream.googleapis.com:443") -def test_datastream_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_datastream_host_with_port(transport_name): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="datastream.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "datastream.googleapis.com:8000" + assert client.transport._host == ("datastream.googleapis.com:8000") def test_datastream_grpc_transport_channel(): @@ -6041,7 +6934,8 @@ def test_datastream_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.DatastreamGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -6053,7 +6947,8 @@ def test_datastream_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.DatastreamGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -6154,12 +7049,16 @@ def test_datastream_transport_channel_mtls_with_adc(transport_class): def test_datastream_grpc_lro_client(): client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -6167,12 +7066,16 @@ def test_datastream_grpc_lro_client(): def test_datastream_grpc_lro_async_client(): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -6183,7 +7086,9 @@ def test_connection_profile_path(): location = "clam" connection_profile = "whelk" expected = "projects/{project}/locations/{location}/connectionProfiles/{connection_profile}".format( - project=project, location=location, connection_profile=connection_profile, + project=project, + location=location, + connection_profile=connection_profile, ) actual = DatastreamClient.connection_profile_path( project, location, connection_profile @@ -6209,7 +7114,9 @@ def test_private_connection_path(): location = "mussel" private_connection = "winkle" expected = "projects/{project}/locations/{location}/privateConnections/{private_connection}".format( - project=project, location=location, private_connection=private_connection, + project=project, + location=location, + private_connection=private_connection, ) actual = DatastreamClient.private_connection_path( project, location, private_connection @@ -6264,7 +7171,9 @@ def test_stream_path(): location = "nautilus" stream = "scallop" expected = "projects/{project}/locations/{location}/streams/{stream}".format( - project=project, location=location, stream=stream, + project=project, + location=location, + stream=stream, ) actual = DatastreamClient.stream_path(project, location, stream) assert expected == actual @@ -6305,7 +7214,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "oyster" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = DatastreamClient.common_folder_path(folder) assert expected == actual @@ -6323,7 +7234,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "cuttlefish" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = DatastreamClient.common_organization_path(organization) assert expected == actual @@ -6341,7 +7254,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "winkle" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = DatastreamClient.common_project_path(project) assert expected == actual @@ -6361,7 +7276,8 @@ def test_common_location_path(): project = "scallop" location = "abalone" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = DatastreamClient.common_location_path(project, location) assert expected == actual @@ -6386,7 +7302,8 @@ def test_client_with_default_client_info(): transports.DatastreamTransport, "_prep_wrapped_messages" ) as prep: client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6395,7 +7312,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = DatastreamClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6403,7 +7321,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close"