From 9aa9b6f37fa7288a4214ea6e82e52655c526c31f Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 7 Feb 2023 21:05:38 +0000 Subject: [PATCH 1/2] chore: Update gapic-generator-python to v1.8.4 PiperOrigin-RevId: 507808936 Source-Link: https://github.com/googleapis/googleapis/commit/64cf8492b21778ce62c66ecee81b468a293bfd4c Source-Link: https://github.com/googleapis/googleapis-gen/commit/53c48cac153d3b37f3d2c2dec4830cfd91ec4153 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTNjNDhjYWMxNTNkM2IzN2YzZDJjMmRlYzQ4MzBjZmQ5MWVjNDE1MyJ9 --- owl-bot-staging/v1/.coveragerc | 13 + owl-bot-staging/v1/.flake8 | 33 + owl-bot-staging/v1/MANIFEST.in | 2 + owl-bot-staging/v1/README.rst | 49 + owl-bot-staging/v1/docs/conf.py | 376 + .../v1/docs/datastream_v1/datastream.rst | 10 + .../v1/docs/datastream_v1/services.rst | 6 + .../v1/docs/datastream_v1/types.rst | 6 + owl-bot-staging/v1/docs/index.rst | 7 + .../v1/google/cloud/datastream/__init__.py | 181 + .../google/cloud/datastream/gapic_version.py | 16 + .../v1/google/cloud/datastream/py.typed | 2 + .../v1/google/cloud/datastream_v1/__init__.py | 182 + .../cloud/datastream_v1/gapic_metadata.json | 273 + .../cloud/datastream_v1/gapic_version.py | 16 + .../v1/google/cloud/datastream_v1/py.typed | 2 + .../cloud/datastream_v1/services/__init__.py | 15 + .../services/datastream/__init__.py | 22 + .../services/datastream/async_client.py | 3441 +++++++ .../services/datastream/client.py | 3685 +++++++ .../services/datastream/pagers.py | 745 ++ .../datastream/transports/__init__.py | 33 + .../services/datastream/transports/base.py | 548 + .../services/datastream/transports/grpc.py | 1041 ++ .../datastream/transports/grpc_asyncio.py | 1040 ++ .../cloud/datastream_v1/types/__init__.py | 176 + .../cloud/datastream_v1/types/datastream.py | 1401 +++ .../types/datastream_resources.py | 2091 ++++ owl-bot-staging/v1/mypy.ini | 3 + owl-bot-staging/v1/noxfile.py | 184 + ...astream_create_connection_profile_async.py | 65 + ...tastream_create_connection_profile_sync.py | 65 + ...astream_create_private_connection_async.py | 61 + ...tastream_create_private_connection_sync.py | 61 + ...generated_datastream_create_route_async.py | 62 + ..._generated_datastream_create_route_sync.py | 62 + ...enerated_datastream_create_stream_async.py | 63 + ...generated_datastream_create_stream_sync.py | 63 + ...astream_delete_connection_profile_async.py | 56 + ...tastream_delete_connection_profile_sync.py | 56 + ...astream_delete_private_connection_async.py | 56 + ...tastream_delete_private_connection_sync.py | 56 + ...generated_datastream_delete_route_async.py | 56 + ..._generated_datastream_delete_route_sync.py | 56 + ...enerated_datastream_delete_stream_async.py | 56 + ...generated_datastream_delete_stream_sync.py | 56 + ...tream_discover_connection_profile_async.py | 61 + ...stream_discover_connection_profile_sync.py | 61 + ...rated_datastream_fetch_static_ips_async.py | 53 + ...erated_datastream_fetch_static_ips_sync.py | 53 + ...datastream_get_connection_profile_async.py | 52 + ..._datastream_get_connection_profile_sync.py | 52 + ...datastream_get_private_connection_async.py | 52 + ..._datastream_get_private_connection_sync.py | 52 + ...v1_generated_datastream_get_route_async.py | 52 + ..._v1_generated_datastream_get_route_sync.py | 52 + ...1_generated_datastream_get_stream_async.py | 52 + ...ated_datastream_get_stream_object_async.py | 52 + ...rated_datastream_get_stream_object_sync.py | 52 + ...v1_generated_datastream_get_stream_sync.py | 52 + ...tastream_list_connection_profiles_async.py | 53 + ...atastream_list_connection_profiles_sync.py | 53 + ...tastream_list_private_connections_async.py | 53 + ...atastream_list_private_connections_sync.py | 53 + ..._generated_datastream_list_routes_async.py | 53 + ...1_generated_datastream_list_routes_sync.py | 53 + ...ed_datastream_list_stream_objects_async.py | 53 + ...ted_datastream_list_stream_objects_sync.py | 53 + ...generated_datastream_list_streams_async.py | 53 + ..._generated_datastream_list_streams_sync.py | 53 + ...d_datastream_lookup_stream_object_async.py | 57 + ...ed_datastream_lookup_stream_object_sync.py | 57 + ...ted_datastream_start_backfill_job_async.py | 52 + ...ated_datastream_start_backfill_job_sync.py | 52 + ...ated_datastream_stop_backfill_job_async.py | 52 + ...rated_datastream_stop_backfill_job_sync.py | 52 + ...astream_update_connection_profile_async.py | 63 + ...tastream_update_connection_profile_sync.py | 63 + ...enerated_datastream_update_stream_async.py | 61 + ...generated_datastream_update_stream_sync.py | 61 + ...t_metadata_google.cloud.datastream.v1.json | 4104 ++++++++ .../scripts/fixup_datastream_v1_keywords.py | 200 + owl-bot-staging/v1/setup.py | 91 + .../v1/testing/constraints-3.10.txt | 7 + .../v1/testing/constraints-3.11.txt | 7 + .../v1/testing/constraints-3.12.txt | 7 + .../v1/testing/constraints-3.7.txt | 10 + .../v1/testing/constraints-3.8.txt | 7 + .../v1/testing/constraints-3.9.txt | 7 + owl-bot-staging/v1/tests/__init__.py | 16 + owl-bot-staging/v1/tests/unit/__init__.py | 16 + .../v1/tests/unit/gapic/__init__.py | 16 + .../unit/gapic/datastream_v1/__init__.py | 16 + .../gapic/datastream_v1/test_datastream.py | 9022 +++++++++++++++++ owl-bot-staging/v1alpha1/.coveragerc | 13 + owl-bot-staging/v1alpha1/.flake8 | 33 + owl-bot-staging/v1alpha1/MANIFEST.in | 2 + owl-bot-staging/v1alpha1/README.rst | 49 + owl-bot-staging/v1alpha1/docs/conf.py | 376 + .../docs/datastream_v1alpha1/datastream.rst | 10 + .../docs/datastream_v1alpha1/services.rst | 6 + .../docs/datastream_v1alpha1/types.rst | 6 + owl-bot-staging/v1alpha1/docs/index.rst | 7 + .../google/cloud/datastream/__init__.py | 153 + .../google/cloud/datastream/gapic_version.py | 16 + .../v1alpha1/google/cloud/datastream/py.typed | 2 + .../cloud/datastream_v1alpha1/__init__.py | 154 + .../datastream_v1alpha1/gapic_metadata.json | 233 + .../datastream_v1alpha1/gapic_version.py | 16 + .../google/cloud/datastream_v1alpha1/py.typed | 2 + .../datastream_v1alpha1/services/__init__.py | 15 + .../services/datastream/__init__.py | 22 + .../services/datastream/async_client.py | 2690 +++++ .../services/datastream/client.py | 2921 ++++++ .../services/datastream/pagers.py | 624 ++ .../datastream/transports/__init__.py | 33 + .../services/datastream/transports/base.py | 436 + .../services/datastream/transports/grpc.py | 824 ++ .../datastream/transports/grpc_asyncio.py | 823 ++ .../datastream_v1alpha1/types/__init__.py | 148 + .../datastream_v1alpha1/types/datastream.py | 1205 +++ .../types/datastream_resources.py | 1413 +++ owl-bot-staging/v1alpha1/mypy.ini | 3 + owl-bot-staging/v1alpha1/noxfile.py | 184 + ...astream_create_connection_profile_async.py | 65 + ...tastream_create_connection_profile_sync.py | 65 + ...astream_create_private_connection_async.py | 61 + ...tastream_create_private_connection_sync.py | 61 + ...generated_datastream_create_route_async.py | 62 + ..._generated_datastream_create_route_sync.py | 62 + ...enerated_datastream_create_stream_async.py | 63 + ...generated_datastream_create_stream_sync.py | 63 + ...astream_delete_connection_profile_async.py | 56 + ...tastream_delete_connection_profile_sync.py | 56 + ...astream_delete_private_connection_async.py | 56 + ...tastream_delete_private_connection_sync.py | 56 + ...generated_datastream_delete_route_async.py | 56 + ..._generated_datastream_delete_route_sync.py | 56 + ...enerated_datastream_delete_stream_async.py | 56 + ...generated_datastream_delete_stream_sync.py | 56 + ...tream_discover_connection_profile_async.py | 61 + ...stream_discover_connection_profile_sync.py | 61 + ...generated_datastream_fetch_errors_async.py | 55 + ..._generated_datastream_fetch_errors_sync.py | 55 + ...rated_datastream_fetch_static_ips_async.py | 53 + ...erated_datastream_fetch_static_ips_sync.py | 53 + ...datastream_get_connection_profile_async.py | 52 + ..._datastream_get_connection_profile_sync.py | 52 + ...datastream_get_private_connection_async.py | 52 + ..._datastream_get_private_connection_sync.py | 52 + ...a1_generated_datastream_get_route_async.py | 52 + ...ha1_generated_datastream_get_route_sync.py | 52 + ...1_generated_datastream_get_stream_async.py | 52 + ...a1_generated_datastream_get_stream_sync.py | 52 + ...tastream_list_connection_profiles_async.py | 53 + ...atastream_list_connection_profiles_sync.py | 53 + ...tastream_list_private_connections_async.py | 53 + ...atastream_list_private_connections_sync.py | 53 + ..._generated_datastream_list_routes_async.py | 53 + ...1_generated_datastream_list_routes_sync.py | 53 + ...generated_datastream_list_streams_async.py | 53 + ..._generated_datastream_list_streams_sync.py | 53 + ...astream_update_connection_profile_async.py | 63 + ...tastream_update_connection_profile_sync.py | 63 + ...enerated_datastream_update_stream_async.py | 61 + ...generated_datastream_update_stream_sync.py | 61 + ...data_google.cloud.datastream.v1alpha1.json | 3460 +++++++ .../fixup_datastream_v1alpha1_keywords.py | 196 + owl-bot-staging/v1alpha1/setup.py | 90 + .../v1alpha1/testing/constraints-3.10.txt | 6 + .../v1alpha1/testing/constraints-3.11.txt | 6 + .../v1alpha1/testing/constraints-3.12.txt | 6 + .../v1alpha1/testing/constraints-3.7.txt | 9 + .../v1alpha1/testing/constraints-3.8.txt | 6 + .../v1alpha1/testing/constraints-3.9.txt | 6 + owl-bot-staging/v1alpha1/tests/__init__.py | 16 + .../v1alpha1/tests/unit/__init__.py | 16 + .../v1alpha1/tests/unit/gapic/__init__.py | 16 + .../gapic/datastream_v1alpha1/__init__.py | 16 + .../datastream_v1alpha1/test_datastream.py | 7069 +++++++++++++ 180 files changed, 57636 insertions(+) create mode 100644 owl-bot-staging/v1/.coveragerc create mode 100644 owl-bot-staging/v1/.flake8 create mode 100644 owl-bot-staging/v1/MANIFEST.in create mode 100644 owl-bot-staging/v1/README.rst create mode 100644 owl-bot-staging/v1/docs/conf.py create mode 100644 owl-bot-staging/v1/docs/datastream_v1/datastream.rst create mode 100644 owl-bot-staging/v1/docs/datastream_v1/services.rst create mode 100644 owl-bot-staging/v1/docs/datastream_v1/types.rst create mode 100644 owl-bot-staging/v1/docs/index.rst create mode 100644 owl-bot-staging/v1/google/cloud/datastream/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/datastream/gapic_version.py create mode 100644 owl-bot-staging/v1/google/cloud/datastream/py.typed create mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/gapic_metadata.json create mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/gapic_version.py create mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/py.typed create mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/services/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/async_client.py create mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/client.py create mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/pagers.py create mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/base.py create mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/grpc.py create mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/grpc_asyncio.py create mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/types/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/types/datastream.py create mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/types/datastream_resources.py create mode 100644 owl-bot-staging/v1/mypy.ini create mode 100644 owl-bot-staging/v1/noxfile.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_connection_profile_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_connection_profile_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_private_connection_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_private_connection_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_route_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_route_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_stream_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_stream_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_connection_profile_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_connection_profile_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_private_connection_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_private_connection_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_route_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_route_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_stream_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_stream_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_discover_connection_profile_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_discover_connection_profile_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_fetch_static_ips_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_fetch_static_ips_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_connection_profile_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_connection_profile_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_private_connection_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_private_connection_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_route_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_route_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_object_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_object_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_connection_profiles_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_connection_profiles_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_private_connections_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_private_connections_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_routes_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_routes_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_stream_objects_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_stream_objects_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_streams_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_streams_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_lookup_stream_object_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_lookup_stream_object_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_start_backfill_job_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_start_backfill_job_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_stop_backfill_job_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_stop_backfill_job_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_connection_profile_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_connection_profile_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_stream_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_stream_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/snippet_metadata_google.cloud.datastream.v1.json create mode 100644 owl-bot-staging/v1/scripts/fixup_datastream_v1_keywords.py create mode 100644 owl-bot-staging/v1/setup.py create mode 100644 owl-bot-staging/v1/testing/constraints-3.10.txt create mode 100644 owl-bot-staging/v1/testing/constraints-3.11.txt create mode 100644 owl-bot-staging/v1/testing/constraints-3.12.txt create mode 100644 owl-bot-staging/v1/testing/constraints-3.7.txt create mode 100644 owl-bot-staging/v1/testing/constraints-3.8.txt create mode 100644 owl-bot-staging/v1/testing/constraints-3.9.txt create mode 100644 owl-bot-staging/v1/tests/__init__.py create mode 100644 owl-bot-staging/v1/tests/unit/__init__.py create mode 100644 owl-bot-staging/v1/tests/unit/gapic/__init__.py create mode 100644 owl-bot-staging/v1/tests/unit/gapic/datastream_v1/__init__.py create mode 100644 owl-bot-staging/v1/tests/unit/gapic/datastream_v1/test_datastream.py create mode 100644 owl-bot-staging/v1alpha1/.coveragerc create mode 100644 owl-bot-staging/v1alpha1/.flake8 create mode 100644 owl-bot-staging/v1alpha1/MANIFEST.in create mode 100644 owl-bot-staging/v1alpha1/README.rst create mode 100644 owl-bot-staging/v1alpha1/docs/conf.py create mode 100644 owl-bot-staging/v1alpha1/docs/datastream_v1alpha1/datastream.rst create mode 100644 owl-bot-staging/v1alpha1/docs/datastream_v1alpha1/services.rst create mode 100644 owl-bot-staging/v1alpha1/docs/datastream_v1alpha1/types.rst create mode 100644 owl-bot-staging/v1alpha1/docs/index.rst create mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream/__init__.py create mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream/gapic_version.py create mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream/py.typed create mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/__init__.py create mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/gapic_metadata.json create mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/gapic_version.py create mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/py.typed create mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/__init__.py create mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/__init__.py create mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/async_client.py create mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/client.py create mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/pagers.py create mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/__init__.py create mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/base.py create mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/grpc.py create mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/grpc_asyncio.py create mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/types/__init__.py create mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/types/datastream.py create mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/types/datastream_resources.py create mode 100644 owl-bot-staging/v1alpha1/mypy.ini create mode 100644 owl-bot-staging/v1alpha1/noxfile.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_connection_profile_async.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_connection_profile_sync.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_private_connection_async.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_private_connection_sync.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_route_async.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_route_sync.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_stream_async.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_stream_sync.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_connection_profile_async.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_connection_profile_sync.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_private_connection_async.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_private_connection_sync.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_route_async.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_route_sync.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_stream_async.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_stream_sync.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_discover_connection_profile_async.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_discover_connection_profile_sync.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_errors_async.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_errors_sync.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_static_ips_async.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_static_ips_sync.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_connection_profile_async.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_connection_profile_sync.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_private_connection_async.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_private_connection_sync.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_route_async.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_route_sync.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_stream_async.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_stream_sync.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_connection_profiles_async.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_connection_profiles_sync.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_private_connections_async.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_private_connections_sync.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_routes_async.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_routes_sync.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_streams_async.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_streams_sync.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_connection_profile_async.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_connection_profile_sync.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_stream_async.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_stream_sync.py create mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/snippet_metadata_google.cloud.datastream.v1alpha1.json create mode 100644 owl-bot-staging/v1alpha1/scripts/fixup_datastream_v1alpha1_keywords.py create mode 100644 owl-bot-staging/v1alpha1/setup.py create mode 100644 owl-bot-staging/v1alpha1/testing/constraints-3.10.txt create mode 100644 owl-bot-staging/v1alpha1/testing/constraints-3.11.txt create mode 100644 owl-bot-staging/v1alpha1/testing/constraints-3.12.txt create mode 100644 owl-bot-staging/v1alpha1/testing/constraints-3.7.txt create mode 100644 owl-bot-staging/v1alpha1/testing/constraints-3.8.txt create mode 100644 owl-bot-staging/v1alpha1/testing/constraints-3.9.txt create mode 100644 owl-bot-staging/v1alpha1/tests/__init__.py create mode 100644 owl-bot-staging/v1alpha1/tests/unit/__init__.py create mode 100644 owl-bot-staging/v1alpha1/tests/unit/gapic/__init__.py create mode 100644 owl-bot-staging/v1alpha1/tests/unit/gapic/datastream_v1alpha1/__init__.py create mode 100644 owl-bot-staging/v1alpha1/tests/unit/gapic/datastream_v1alpha1/test_datastream.py diff --git a/owl-bot-staging/v1/.coveragerc b/owl-bot-staging/v1/.coveragerc new file mode 100644 index 0000000..99bdb31 --- /dev/null +++ b/owl-bot-staging/v1/.coveragerc @@ -0,0 +1,13 @@ +[run] +branch = True + +[report] +show_missing = True +omit = + google/cloud/datastream/__init__.py + google/cloud/datastream/gapic_version.py +exclude_lines = + # Re-enable the standard pragma + pragma: NO COVER + # Ignore debug-only repr + def __repr__ diff --git a/owl-bot-staging/v1/.flake8 b/owl-bot-staging/v1/.flake8 new file mode 100644 index 0000000..29227d4 --- /dev/null +++ b/owl-bot-staging/v1/.flake8 @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2020 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 +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Generated by synthtool. DO NOT EDIT! +[flake8] +ignore = E203, E266, E501, W503 +exclude = + # Exclude generated code. + **/proto/** + **/gapic/** + **/services/** + **/types/** + *_pb2.py + + # Standard linting exemptions. + **/.nox/** + __pycache__, + .git, + *.pyc, + conf.py diff --git a/owl-bot-staging/v1/MANIFEST.in b/owl-bot-staging/v1/MANIFEST.in new file mode 100644 index 0000000..dbcd8cf --- /dev/null +++ b/owl-bot-staging/v1/MANIFEST.in @@ -0,0 +1,2 @@ +recursive-include google/cloud/datastream *.py +recursive-include google/cloud/datastream_v1 *.py diff --git a/owl-bot-staging/v1/README.rst b/owl-bot-staging/v1/README.rst new file mode 100644 index 0000000..9a1922d --- /dev/null +++ b/owl-bot-staging/v1/README.rst @@ -0,0 +1,49 @@ +Python Client for Google Cloud Datastream API +================================================= + +Quick Start +----------- + +In order to use this library, you first need to go through the following steps: + +1. `Select or create a Cloud Platform project.`_ +2. `Enable billing for your project.`_ +3. Enable the Google Cloud Datastream API. +4. `Setup Authentication.`_ + +.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project +.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project +.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html + +Installation +~~~~~~~~~~~~ + +Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to +create isolated Python environments. The basic problem it addresses is one of +dependencies and versions, and indirectly permissions. + +With `virtualenv`_, it's possible to install this library without needing system +install permissions, and without clashing with the installed system +dependencies. + +.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ + + +Mac/Linux +^^^^^^^^^ + +.. code-block:: console + + python3 -m venv + source /bin/activate + /bin/pip install /path/to/library + + +Windows +^^^^^^^ + +.. code-block:: console + + python3 -m venv + \Scripts\activate + \Scripts\pip.exe install \path\to\library diff --git a/owl-bot-staging/v1/docs/conf.py b/owl-bot-staging/v1/docs/conf.py new file mode 100644 index 0000000..38f6361 --- /dev/null +++ b/owl-bot-staging/v1/docs/conf.py @@ -0,0 +1,376 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# google-cloud-datastream documentation build configuration file +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys +import os +import shlex + +# 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 +# documentation root, use os.path.abspath to make it absolute, like shown here. +sys.path.insert(0, os.path.abspath("..")) + +__version__ = "0.1.0" + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +needs_sphinx = "4.0.1" + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.autosummary", + "sphinx.ext.intersphinx", + "sphinx.ext.coverage", + "sphinx.ext.napoleon", + "sphinx.ext.todo", + "sphinx.ext.viewcode", +] + +# autodoc/autosummary flags +autoclass_content = "both" +autodoc_default_flags = ["members"] +autosummary_generate = True + + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# Allow markdown includes (so releases.md can include CHANGLEOG.md) +# http://www.sphinx-doc.org/en/master/markdown.html +source_parsers = {".md": "recommonmark.parser.CommonMarkParser"} + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +source_suffix = [".rst", ".md"] + +# The encoding of source files. +# source_encoding = 'utf-8-sig' + +# The root toctree document. +root_doc = "index" + +# General information about the project. +project = u"google-cloud-datastream" +copyright = u"2022, Google, LLC" +author = u"Google APIs" # TODO: autogenerate this bit + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The full version, including alpha/beta/rc tags. +release = __version__ +# The short X.Y version. +version = ".".join(release.split(".")[0:2]) + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +# today = '' +# Else, today_fmt is used as the format for a strftime call. +# today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ["_build"] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +# default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +# add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +# add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +# show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = "sphinx" + +# A list of ignored prefixes for module index sorting. +# modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +# keep_warnings = False + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = True + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = "alabaster" + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +html_theme_options = { + "description": "Google Cloud Client Libraries for Python", + "github_user": "googleapis", + "github_repo": "google-cloud-python", + "github_banner": True, + "font_family": "'Roboto', Georgia, sans", + "head_font_family": "'Roboto', Georgia, serif", + "code_font_family": "'Roboto Mono', 'Consolas', monospace", +} + +# Add any paths that contain custom themes here, relative to this directory. +# html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +# html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +# html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +# html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +# html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ["_static"] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +# html_extra_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +# html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +# html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +# html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +# html_additional_pages = {} + +# If false, no module index is generated. +# html_domain_indices = True + +# If false, no index is generated. +# html_use_index = True + +# If true, the index is split into individual pages for each letter. +# html_split_index = False + +# If true, links to the reST sources are added to the pages. +# html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +# html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +# html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +# html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +# html_file_suffix = None + +# Language to be used for generating the HTML full-text search index. +# Sphinx supports the following languages: +# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' +# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' +# html_search_language = 'en' + +# A dictionary with options for the search language support, empty by default. +# Now only 'ja' uses this config value +# html_search_options = {'type': 'default'} + +# The name of a javascript file (relative to the configuration directory) that +# implements a search results scorer. If empty, the default will be used. +# html_search_scorer = 'scorer.js' + +# Output file base name for HTML help builder. +htmlhelp_basename = "google-cloud-datastream-doc" + +# -- Options for warnings ------------------------------------------------------ + + +suppress_warnings = [ + # Temporarily suppress this to avoid "more than one target found for + # cross-reference" warning, which are intractable for us to avoid while in + # a mono-repo. + # See https://github.com/sphinx-doc/sphinx/blob + # /2a65ffeef5c107c19084fabdd706cdff3f52d93c/sphinx/domains/python.py#L843 + "ref.python" +] + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # 'papersize': 'letterpaper', + # The font size ('10pt', '11pt' or '12pt'). + # 'pointsize': '10pt', + # Additional stuff for the LaTeX preamble. + # 'preamble': '', + # Latex figure (float) alignment + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + ( + root_doc, + "google-cloud-datastream.tex", + u"google-cloud-datastream Documentation", + author, + "manual", + ) +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +# latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +# latex_use_parts = False + +# If true, show page references after internal links. +# latex_show_pagerefs = False + +# If true, show URL addresses after external links. +# latex_show_urls = False + +# Documents to append as an appendix to all manuals. +# latex_appendices = [] + +# If false, no module index is generated. +# latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ( + root_doc, + "google-cloud-datastream", + u"Google Cloud Datastream Documentation", + [author], + 1, + ) +] + +# If true, show URL addresses after external links. +# man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ( + root_doc, + "google-cloud-datastream", + u"google-cloud-datastream Documentation", + author, + "google-cloud-datastream", + "GAPIC library for Google Cloud Datastream API", + "APIs", + ) +] + +# Documents to append as an appendix to all manuals. +# texinfo_appendices = [] + +# If false, no module index is generated. +# texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +# texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +# texinfo_no_detailmenu = False + + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = { + "python": ("http://python.readthedocs.org/en/latest/", None), + "gax": ("https://gax-python.readthedocs.org/en/latest/", None), + "google-auth": ("https://google-auth.readthedocs.io/en/stable", None), + "google-gax": ("https://gax-python.readthedocs.io/en/latest/", None), + "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None), + "grpc": ("https://grpc.io/grpc/python/", None), + "requests": ("http://requests.kennethreitz.org/en/stable/", None), + "proto": ("https://proto-plus-python.readthedocs.io/en/stable", None), + "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), +} + + +# Napoleon settings +napoleon_google_docstring = True +napoleon_numpy_docstring = True +napoleon_include_private_with_doc = False +napoleon_include_special_with_doc = True +napoleon_use_admonition_for_examples = False +napoleon_use_admonition_for_notes = False +napoleon_use_admonition_for_references = False +napoleon_use_ivar = False +napoleon_use_param = True +napoleon_use_rtype = True diff --git a/owl-bot-staging/v1/docs/datastream_v1/datastream.rst b/owl-bot-staging/v1/docs/datastream_v1/datastream.rst new file mode 100644 index 0000000..b966db4 --- /dev/null +++ b/owl-bot-staging/v1/docs/datastream_v1/datastream.rst @@ -0,0 +1,10 @@ +Datastream +---------------------------- + +.. automodule:: google.cloud.datastream_v1.services.datastream + :members: + :inherited-members: + +.. automodule:: google.cloud.datastream_v1.services.datastream.pagers + :members: + :inherited-members: diff --git a/owl-bot-staging/v1/docs/datastream_v1/services.rst b/owl-bot-staging/v1/docs/datastream_v1/services.rst new file mode 100644 index 0000000..ec9e529 --- /dev/null +++ b/owl-bot-staging/v1/docs/datastream_v1/services.rst @@ -0,0 +1,6 @@ +Services for Google Cloud Datastream v1 API +=========================================== +.. toctree:: + :maxdepth: 2 + + datastream diff --git a/owl-bot-staging/v1/docs/datastream_v1/types.rst b/owl-bot-staging/v1/docs/datastream_v1/types.rst new file mode 100644 index 0000000..38cae16 --- /dev/null +++ b/owl-bot-staging/v1/docs/datastream_v1/types.rst @@ -0,0 +1,6 @@ +Types for Google Cloud Datastream v1 API +======================================== + +.. automodule:: google.cloud.datastream_v1.types + :members: + :show-inheritance: diff --git a/owl-bot-staging/v1/docs/index.rst b/owl-bot-staging/v1/docs/index.rst new file mode 100644 index 0000000..00795af --- /dev/null +++ b/owl-bot-staging/v1/docs/index.rst @@ -0,0 +1,7 @@ +API Reference +------------- +.. toctree:: + :maxdepth: 2 + + datastream_v1/services + datastream_v1/types diff --git a/owl-bot-staging/v1/google/cloud/datastream/__init__.py b/owl-bot-staging/v1/google/cloud/datastream/__init__.py new file mode 100644 index 0000000..801aabc --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/datastream/__init__.py @@ -0,0 +1,181 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from google.cloud.datastream import gapic_version as package_version + +__version__ = package_version.__version__ + + +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.types.datastream import DiscoverConnectionProfileResponse +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 BigQueryDestinationConfig +from google.cloud.datastream_v1.types.datastream_resources import BigQueryProfile +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 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 PostgresqlColumn +from google.cloud.datastream_v1.types.datastream_resources import PostgresqlProfile +from google.cloud.datastream_v1.types.datastream_resources import PostgresqlRdbms +from google.cloud.datastream_v1.types.datastream_resources import PostgresqlSchema +from google.cloud.datastream_v1.types.datastream_resources import PostgresqlSourceConfig +from google.cloud.datastream_v1.types.datastream_resources import PostgresqlTable +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 StaticServiceIpConnectivity +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', + 'DatastreamAsyncClient', + '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', + 'AvroFileFormat', + 'BackfillJob', + 'BigQueryDestinationConfig', + 'BigQueryProfile', + 'ConnectionProfile', + 'DestinationConfig', + 'Error', + 'ForwardSshTunnelConnectivity', + 'GcsDestinationConfig', + 'GcsProfile', + 'JsonFileFormat', + 'MysqlColumn', + 'MysqlDatabase', + 'MysqlProfile', + 'MysqlRdbms', + 'MysqlSourceConfig', + 'MysqlSslConfig', + 'MysqlTable', + 'OracleColumn', + 'OracleProfile', + 'OracleRdbms', + 'OracleSchema', + 'OracleSourceConfig', + 'OracleTable', + 'PostgresqlColumn', + 'PostgresqlProfile', + 'PostgresqlRdbms', + 'PostgresqlSchema', + 'PostgresqlSourceConfig', + 'PostgresqlTable', + 'PrivateConnection', + 'PrivateConnectivity', + 'Route', + 'SourceConfig', + 'SourceObjectIdentifier', + 'StaticServiceIpConnectivity', + 'Stream', + 'StreamObject', + 'Validation', + 'ValidationMessage', + 'ValidationResult', + 'VpcPeeringConfig', +) diff --git a/owl-bot-staging/v1/google/cloud/datastream/gapic_version.py b/owl-bot-staging/v1/google/cloud/datastream/gapic_version.py new file mode 100644 index 0000000..405b1ce --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/datastream/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__version__ = "0.1.0" # {x-release-please-version} diff --git a/owl-bot-staging/v1/google/cloud/datastream/py.typed b/owl-bot-staging/v1/google/cloud/datastream/py.typed new file mode 100644 index 0000000..38ae0fa --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/datastream/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-cloud-datastream package uses inline types. diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/__init__.py b/owl-bot-staging/v1/google/cloud/datastream_v1/__init__.py new file mode 100644 index 0000000..62798ec --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/datastream_v1/__init__.py @@ -0,0 +1,182 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from google.cloud.datastream_v1 import gapic_version as package_version + +__version__ = package_version.__version__ + + +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 BigQueryDestinationConfig +from .types.datastream_resources import BigQueryProfile +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 PostgresqlColumn +from .types.datastream_resources import PostgresqlProfile +from .types.datastream_resources import PostgresqlRdbms +from .types.datastream_resources import PostgresqlSchema +from .types.datastream_resources import PostgresqlSourceConfig +from .types.datastream_resources import PostgresqlTable +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 + +__all__ = ( + 'DatastreamAsyncClient', +'AvroFileFormat', +'BackfillJob', +'BigQueryDestinationConfig', +'BigQueryProfile', +'ConnectionProfile', +'CreateConnectionProfileRequest', +'CreatePrivateConnectionRequest', +'CreateRouteRequest', +'CreateStreamRequest', +'DatastreamClient', +'DeleteConnectionProfileRequest', +'DeletePrivateConnectionRequest', +'DeleteRouteRequest', +'DeleteStreamRequest', +'DestinationConfig', +'DiscoverConnectionProfileRequest', +'DiscoverConnectionProfileResponse', +'Error', +'FetchStaticIpsRequest', +'FetchStaticIpsResponse', +'ForwardSshTunnelConnectivity', +'GcsDestinationConfig', +'GcsProfile', +'GetConnectionProfileRequest', +'GetPrivateConnectionRequest', +'GetRouteRequest', +'GetStreamObjectRequest', +'GetStreamRequest', +'JsonFileFormat', +'ListConnectionProfilesRequest', +'ListConnectionProfilesResponse', +'ListPrivateConnectionsRequest', +'ListPrivateConnectionsResponse', +'ListRoutesRequest', +'ListRoutesResponse', +'ListStreamObjectsRequest', +'ListStreamObjectsResponse', +'ListStreamsRequest', +'ListStreamsResponse', +'LookupStreamObjectRequest', +'MysqlColumn', +'MysqlDatabase', +'MysqlProfile', +'MysqlRdbms', +'MysqlSourceConfig', +'MysqlSslConfig', +'MysqlTable', +'OperationMetadata', +'OracleColumn', +'OracleProfile', +'OracleRdbms', +'OracleSchema', +'OracleSourceConfig', +'OracleTable', +'PostgresqlColumn', +'PostgresqlProfile', +'PostgresqlRdbms', +'PostgresqlSchema', +'PostgresqlSourceConfig', +'PostgresqlTable', +'PrivateConnection', +'PrivateConnectivity', +'Route', +'SourceConfig', +'SourceObjectIdentifier', +'StartBackfillJobRequest', +'StartBackfillJobResponse', +'StaticServiceIpConnectivity', +'StopBackfillJobRequest', +'StopBackfillJobResponse', +'Stream', +'StreamObject', +'UpdateConnectionProfileRequest', +'UpdateStreamRequest', +'Validation', +'ValidationMessage', +'ValidationResult', +'VpcPeeringConfig', +) diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/gapic_metadata.json b/owl-bot-staging/v1/google/cloud/datastream_v1/gapic_metadata.json new file mode 100644 index 0000000..b6c5117 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/datastream_v1/gapic_metadata.json @@ -0,0 +1,273 @@ + { + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "python", + "libraryPackage": "google.cloud.datastream_v1", + "protoPackage": "google.cloud.datastream.v1", + "schema": "1.0", + "services": { + "Datastream": { + "clients": { + "grpc": { + "libraryClient": "DatastreamClient", + "rpcs": { + "CreateConnectionProfile": { + "methods": [ + "create_connection_profile" + ] + }, + "CreatePrivateConnection": { + "methods": [ + "create_private_connection" + ] + }, + "CreateRoute": { + "methods": [ + "create_route" + ] + }, + "CreateStream": { + "methods": [ + "create_stream" + ] + }, + "DeleteConnectionProfile": { + "methods": [ + "delete_connection_profile" + ] + }, + "DeletePrivateConnection": { + "methods": [ + "delete_private_connection" + ] + }, + "DeleteRoute": { + "methods": [ + "delete_route" + ] + }, + "DeleteStream": { + "methods": [ + "delete_stream" + ] + }, + "DiscoverConnectionProfile": { + "methods": [ + "discover_connection_profile" + ] + }, + "FetchStaticIps": { + "methods": [ + "fetch_static_ips" + ] + }, + "GetConnectionProfile": { + "methods": [ + "get_connection_profile" + ] + }, + "GetPrivateConnection": { + "methods": [ + "get_private_connection" + ] + }, + "GetRoute": { + "methods": [ + "get_route" + ] + }, + "GetStream": { + "methods": [ + "get_stream" + ] + }, + "GetStreamObject": { + "methods": [ + "get_stream_object" + ] + }, + "ListConnectionProfiles": { + "methods": [ + "list_connection_profiles" + ] + }, + "ListPrivateConnections": { + "methods": [ + "list_private_connections" + ] + }, + "ListRoutes": { + "methods": [ + "list_routes" + ] + }, + "ListStreamObjects": { + "methods": [ + "list_stream_objects" + ] + }, + "ListStreams": { + "methods": [ + "list_streams" + ] + }, + "LookupStreamObject": { + "methods": [ + "lookup_stream_object" + ] + }, + "StartBackfillJob": { + "methods": [ + "start_backfill_job" + ] + }, + "StopBackfillJob": { + "methods": [ + "stop_backfill_job" + ] + }, + "UpdateConnectionProfile": { + "methods": [ + "update_connection_profile" + ] + }, + "UpdateStream": { + "methods": [ + "update_stream" + ] + } + } + }, + "grpc-async": { + "libraryClient": "DatastreamAsyncClient", + "rpcs": { + "CreateConnectionProfile": { + "methods": [ + "create_connection_profile" + ] + }, + "CreatePrivateConnection": { + "methods": [ + "create_private_connection" + ] + }, + "CreateRoute": { + "methods": [ + "create_route" + ] + }, + "CreateStream": { + "methods": [ + "create_stream" + ] + }, + "DeleteConnectionProfile": { + "methods": [ + "delete_connection_profile" + ] + }, + "DeletePrivateConnection": { + "methods": [ + "delete_private_connection" + ] + }, + "DeleteRoute": { + "methods": [ + "delete_route" + ] + }, + "DeleteStream": { + "methods": [ + "delete_stream" + ] + }, + "DiscoverConnectionProfile": { + "methods": [ + "discover_connection_profile" + ] + }, + "FetchStaticIps": { + "methods": [ + "fetch_static_ips" + ] + }, + "GetConnectionProfile": { + "methods": [ + "get_connection_profile" + ] + }, + "GetPrivateConnection": { + "methods": [ + "get_private_connection" + ] + }, + "GetRoute": { + "methods": [ + "get_route" + ] + }, + "GetStream": { + "methods": [ + "get_stream" + ] + }, + "GetStreamObject": { + "methods": [ + "get_stream_object" + ] + }, + "ListConnectionProfiles": { + "methods": [ + "list_connection_profiles" + ] + }, + "ListPrivateConnections": { + "methods": [ + "list_private_connections" + ] + }, + "ListRoutes": { + "methods": [ + "list_routes" + ] + }, + "ListStreamObjects": { + "methods": [ + "list_stream_objects" + ] + }, + "ListStreams": { + "methods": [ + "list_streams" + ] + }, + "LookupStreamObject": { + "methods": [ + "lookup_stream_object" + ] + }, + "StartBackfillJob": { + "methods": [ + "start_backfill_job" + ] + }, + "StopBackfillJob": { + "methods": [ + "stop_backfill_job" + ] + }, + "UpdateConnectionProfile": { + "methods": [ + "update_connection_profile" + ] + }, + "UpdateStream": { + "methods": [ + "update_stream" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/gapic_version.py b/owl-bot-staging/v1/google/cloud/datastream_v1/gapic_version.py new file mode 100644 index 0000000..405b1ce --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/datastream_v1/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__version__ = "0.1.0" # {x-release-please-version} diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/py.typed b/owl-bot-staging/v1/google/cloud/datastream_v1/py.typed new file mode 100644 index 0000000..38ae0fa --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/datastream_v1/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-cloud-datastream package uses inline types. diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/services/__init__.py b/owl-bot-staging/v1/google/cloud/datastream_v1/services/__init__.py new file mode 100644 index 0000000..e8e1c38 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/datastream_v1/services/__init__.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/__init__.py b/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/__init__.py new file mode 100644 index 0000000..f03a8e0 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from .client import DatastreamClient +from .async_client import DatastreamAsyncClient + +__all__ = ( + 'DatastreamClient', + 'DatastreamAsyncClient', +) diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/async_client.py b/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/async_client.py new file mode 100644 index 0000000..0dcfc6c --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/async_client.py @@ -0,0 +1,3441 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from collections import OrderedDict +import functools +import re +from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union + +from google.cloud.datastream_v1 import gapic_version as package_version + +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.auth import credentials as ga_credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + +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.cloud.location import locations_pb2 # type: ignore +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore +from google.longrunning import operations_pb2 +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 .client import DatastreamClient + + +class DatastreamAsyncClient: + """Datastream service""" + + _client: DatastreamClient + + DEFAULT_ENDPOINT = DatastreamClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = DatastreamClient.DEFAULT_MTLS_ENDPOINT + + connection_profile_path = staticmethod(DatastreamClient.connection_profile_path) + parse_connection_profile_path = staticmethod(DatastreamClient.parse_connection_profile_path) + networks_path = staticmethod(DatastreamClient.networks_path) + parse_networks_path = staticmethod(DatastreamClient.parse_networks_path) + private_connection_path = staticmethod(DatastreamClient.private_connection_path) + parse_private_connection_path = staticmethod(DatastreamClient.parse_private_connection_path) + route_path = staticmethod(DatastreamClient.route_path) + parse_route_path = staticmethod(DatastreamClient.parse_route_path) + stream_path = staticmethod(DatastreamClient.stream_path) + parse_stream_path = staticmethod(DatastreamClient.parse_stream_path) + stream_object_path = staticmethod(DatastreamClient.stream_object_path) + parse_stream_object_path = staticmethod(DatastreamClient.parse_stream_object_path) + common_billing_account_path = staticmethod(DatastreamClient.common_billing_account_path) + parse_common_billing_account_path = staticmethod(DatastreamClient.parse_common_billing_account_path) + common_folder_path = staticmethod(DatastreamClient.common_folder_path) + parse_common_folder_path = staticmethod(DatastreamClient.parse_common_folder_path) + common_organization_path = staticmethod(DatastreamClient.common_organization_path) + parse_common_organization_path = staticmethod(DatastreamClient.parse_common_organization_path) + common_project_path = staticmethod(DatastreamClient.common_project_path) + parse_common_project_path = staticmethod(DatastreamClient.parse_common_project_path) + common_location_path = staticmethod(DatastreamClient.common_location_path) + parse_common_location_path = staticmethod(DatastreamClient.parse_common_location_path) + + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials + info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + DatastreamAsyncClient: The constructed client. + """ + return DatastreamClient.from_service_account_info.__func__(DatastreamAsyncClient, info, *args, **kwargs) # type: ignore + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + DatastreamAsyncClient: The constructed client. + """ + return DatastreamClient.from_service_account_file.__func__(DatastreamAsyncClient, filename, *args, **kwargs) # type: ignore + + from_service_account_json = from_service_account_file + + @classmethod + def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[ClientOptions] = None): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variable is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + return DatastreamClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore + + @property + def transport(self) -> DatastreamTransport: + """Returns the transport used by the client instance. + + Returns: + DatastreamTransport: The transport used by the client instance. + """ + return self._client.transport + + get_transport_class = functools.partial(type(DatastreamClient).get_transport_class, type(DatastreamClient)) + + def __init__(self, *, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Union[str, DatastreamTransport] = "grpc_asyncio", + client_options: Optional[ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiates the datastream client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.DatastreamTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + self._client = DatastreamClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + + ) + + async def list_connection_profiles(self, + request: Optional[Union[datastream.ListConnectionProfilesRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListConnectionProfilesAsyncPager: + r"""Use this method to list connection profiles created + in a project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_list_connection_profiles(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.ListConnectionProfilesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_connection_profiles(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.ListConnectionProfilesRequest, dict]]): + The request object. Request message for listing + connection profiles. + parent (:class:`str`): + Required. The parent that owns the + collection of connection profiles. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.services.datastream.pagers.ListConnectionProfilesAsyncPager: + Response message for listing + connection profiles. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.ListConnectionProfilesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_connection_profiles, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + async def get_connection_profile(self, + request: Optional[Union[datastream.GetConnectionProfileRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream_resources.ConnectionProfile: + r"""Use this method to get details about a connection + profile. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_get_connection_profile(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.GetConnectionProfileRequest( + name="name_value", + ) + + # Make the request + response = await client.get_connection_profile(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.GetConnectionProfileRequest, dict]]): + The request object. Request message for getting a + connection profile. + name (:class:`str`): + Required. The name of the connection + profile resource to get. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.types.ConnectionProfile: + A set of reusable connection + configurations to be used as a source or + destination for a stream. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.GetConnectionProfileRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_connection_profile, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def create_connection_profile(self, + request: Optional[Union[datastream.CreateConnectionProfileRequest, dict]] = None, + *, + parent: Optional[str] = None, + connection_profile: Optional[datastream_resources.ConnectionProfile] = None, + connection_profile_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Use this method to create a connection profile in a + project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_create_connection_profile(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + connection_profile = datastream_v1.ConnectionProfile() + connection_profile.oracle_profile.hostname = "hostname_value" + connection_profile.oracle_profile.username = "username_value" + connection_profile.oracle_profile.password = "password_value" + connection_profile.oracle_profile.database_service = "database_service_value" + connection_profile.display_name = "display_name_value" + + request = datastream_v1.CreateConnectionProfileRequest( + parent="parent_value", + connection_profile_id="connection_profile_id_value", + connection_profile=connection_profile, + ) + + # Make the request + operation = client.create_connection_profile(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.CreateConnectionProfileRequest, dict]]): + The request object. Request message for creating a + connection profile. + parent (:class:`str`): + Required. The parent that owns the + collection of ConnectionProfiles. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + connection_profile (:class:`google.cloud.datastream_v1.types.ConnectionProfile`): + Required. The connection profile + resource to create. + + This corresponds to the ``connection_profile`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + connection_profile_id (:class:`str`): + Required. The connection profile + identifier. + + This corresponds to the ``connection_profile_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.datastream_v1.types.ConnectionProfile` A set of reusable connection configurations to be used as a source or + destination for a stream. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, connection_profile, connection_profile_id]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.CreateConnectionProfileRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if connection_profile is not None: + request.connection_profile = connection_profile + if connection_profile_id is not None: + request.connection_profile_id = connection_profile_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_connection_profile, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + datastream_resources.ConnectionProfile, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + async def update_connection_profile(self, + request: Optional[Union[datastream.UpdateConnectionProfileRequest, dict]] = None, + *, + connection_profile: Optional[datastream_resources.ConnectionProfile] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Use this method to update the parameters of a + connection profile. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_update_connection_profile(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + connection_profile = datastream_v1.ConnectionProfile() + connection_profile.oracle_profile.hostname = "hostname_value" + connection_profile.oracle_profile.username = "username_value" + connection_profile.oracle_profile.password = "password_value" + connection_profile.oracle_profile.database_service = "database_service_value" + connection_profile.display_name = "display_name_value" + + request = datastream_v1.UpdateConnectionProfileRequest( + connection_profile=connection_profile, + ) + + # Make the request + operation = client.update_connection_profile(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.UpdateConnectionProfileRequest, dict]]): + The request object. Connection profile update message. + connection_profile (:class:`google.cloud.datastream_v1.types.ConnectionProfile`): + Required. The connection profile to + update. + + This corresponds to the ``connection_profile`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Optional. Field mask is used to specify the fields to be + overwritten in the ConnectionProfile resource by the + update. The fields specified in the update_mask are + relative to the resource, not the full request. A field + will be overwritten if it is in the mask. If the user + does not provide a mask then all fields will be + overwritten. + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.datastream_v1.types.ConnectionProfile` A set of reusable connection configurations to be used as a source or + destination for a stream. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([connection_profile, update_mask]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.UpdateConnectionProfileRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if connection_profile is not None: + request.connection_profile = connection_profile + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_connection_profile, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("connection_profile.name", request.connection_profile.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + datastream_resources.ConnectionProfile, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + async def delete_connection_profile(self, + request: Optional[Union[datastream.DeleteConnectionProfileRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Use this method to delete a connection profile. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_delete_connection_profile(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.DeleteConnectionProfileRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_connection_profile(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.DeleteConnectionProfileRequest, dict]]): + The request object. Request message for deleting a + connection profile. + name (:class:`str`): + Required. The name of the connection + profile resource to delete. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.DeleteConnectionProfileRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_connection_profile, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty_pb2.Empty, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + async def discover_connection_profile(self, + request: Optional[Union[datastream.DiscoverConnectionProfileRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream.DiscoverConnectionProfileResponse: + r"""Use this method to discover a connection profile. + The discover API call exposes the data objects and + metadata belonging to the profile. Typically, a request + returns children data objects of a parent data object + that's optionally supplied in the request. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_discover_connection_profile(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + connection_profile = datastream_v1.ConnectionProfile() + connection_profile.oracle_profile.hostname = "hostname_value" + connection_profile.oracle_profile.username = "username_value" + connection_profile.oracle_profile.password = "password_value" + connection_profile.oracle_profile.database_service = "database_service_value" + connection_profile.display_name = "display_name_value" + + request = datastream_v1.DiscoverConnectionProfileRequest( + connection_profile=connection_profile, + full_hierarchy=True, + parent="parent_value", + ) + + # Make the request + response = await client.discover_connection_profile(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.DiscoverConnectionProfileRequest, dict]]): + The request object. Request message for 'discover' + ConnectionProfile request. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.types.DiscoverConnectionProfileResponse: + Response from a discover request. + """ + # Create or coerce a protobuf request object. + request = datastream.DiscoverConnectionProfileRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.discover_connection_profile, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_streams(self, + request: Optional[Union[datastream.ListStreamsRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListStreamsAsyncPager: + r"""Use this method to list streams in a project and + location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_list_streams(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.ListStreamsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_streams(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.ListStreamsRequest, dict]]): + The request object. Request message for listing streams. + parent (:class:`str`): + Required. The parent that owns the + collection of streams. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.services.datastream.pagers.ListStreamsAsyncPager: + Response message for listing streams. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.ListStreamsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_streams, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + async def get_stream(self, + request: Optional[Union[datastream.GetStreamRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream_resources.Stream: + r"""Use this method to get details about a stream. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_get_stream(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.GetStreamRequest( + name="name_value", + ) + + # Make the request + response = await client.get_stream(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.GetStreamRequest, dict]]): + The request object. Request message for getting a + stream. + name (:class:`str`): + Required. The name of the stream + resource to get. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.types.Stream: + A resource representing streaming + data from a source to a destination. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.GetStreamRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_stream, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def create_stream(self, + request: Optional[Union[datastream.CreateStreamRequest, dict]] = None, + *, + parent: Optional[str] = None, + stream: Optional[datastream_resources.Stream] = None, + stream_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Use this method to create a stream. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_create_stream(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + stream = datastream_v1.Stream() + stream.display_name = "display_name_value" + stream.source_config.source_connection_profile = "source_connection_profile_value" + stream.destination_config.destination_connection_profile = "destination_connection_profile_value" + + request = datastream_v1.CreateStreamRequest( + parent="parent_value", + stream_id="stream_id_value", + stream=stream, + ) + + # Make the request + operation = client.create_stream(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.CreateStreamRequest, dict]]): + The request object. Request message for creating a + stream. + parent (:class:`str`): + Required. The parent that owns the + collection of streams. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + stream (:class:`google.cloud.datastream_v1.types.Stream`): + Required. The stream resource to + create. + + This corresponds to the ``stream`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + stream_id (:class:`str`): + Required. The stream identifier. + This corresponds to the ``stream_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.datastream_v1.types.Stream` A + resource representing streaming data from a source to a + destination. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, stream, stream_id]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.CreateStreamRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if stream is not None: + request.stream = stream + if stream_id is not None: + request.stream_id = stream_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_stream, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + datastream_resources.Stream, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + async def update_stream(self, + request: Optional[Union[datastream.UpdateStreamRequest, dict]] = None, + *, + stream: Optional[datastream_resources.Stream] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Use this method to update the configuration of a + stream. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_update_stream(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + stream = datastream_v1.Stream() + stream.display_name = "display_name_value" + stream.source_config.source_connection_profile = "source_connection_profile_value" + stream.destination_config.destination_connection_profile = "destination_connection_profile_value" + + request = datastream_v1.UpdateStreamRequest( + stream=stream, + ) + + # Make the request + operation = client.update_stream(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.UpdateStreamRequest, dict]]): + The request object. Request message for updating a + stream. + stream (:class:`google.cloud.datastream_v1.types.Stream`): + Required. The stream resource to + update. + + This corresponds to the ``stream`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Optional. Field mask is used to specify the fields to be + overwritten in the stream resource by the update. The + fields specified in the update_mask are relative to the + resource, not the full request. A field will be + overwritten if it is in the mask. If the user does not + provide a mask then all fields will be overwritten. + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.datastream_v1.types.Stream` A + resource representing streaming data from a source to a + destination. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([stream, update_mask]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.UpdateStreamRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if stream is not None: + request.stream = stream + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_stream, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("stream.name", request.stream.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + datastream_resources.Stream, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + async def delete_stream(self, + request: Optional[Union[datastream.DeleteStreamRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Use this method to delete a stream. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_delete_stream(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.DeleteStreamRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_stream(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.DeleteStreamRequest, dict]]): + The request object. Request message for deleting a + stream. + name (:class:`str`): + Required. The name of the stream + resource to delete. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.DeleteStreamRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_stream, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty_pb2.Empty, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + async def get_stream_object(self, + request: Optional[Union[datastream.GetStreamObjectRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream_resources.StreamObject: + r"""Use this method to get details about a stream object. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_get_stream_object(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.GetStreamObjectRequest( + name="name_value", + ) + + # Make the request + response = await client.get_stream_object(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.GetStreamObjectRequest, dict]]): + The request object. Request for fetching a specific + stream object. + name (:class:`str`): + Required. The name of the stream + object resource to get. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.types.StreamObject: + A specific stream object (e.g a + specific DB table). + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.GetStreamObjectRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_stream_object, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def lookup_stream_object(self, + request: Optional[Union[datastream.LookupStreamObjectRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream_resources.StreamObject: + r"""Use this method to look up a stream object by its + source object identifier. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_lookup_stream_object(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + source_object_identifier = datastream_v1.SourceObjectIdentifier() + source_object_identifier.oracle_identifier.schema = "schema_value" + source_object_identifier.oracle_identifier.table = "table_value" + + request = datastream_v1.LookupStreamObjectRequest( + parent="parent_value", + source_object_identifier=source_object_identifier, + ) + + # Make the request + response = await client.lookup_stream_object(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.LookupStreamObjectRequest, dict]]): + The request object. Request for looking up a specific + stream object by its source object identifier. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.types.StreamObject: + A specific stream object (e.g a + specific DB table). + + """ + # Create or coerce a protobuf request object. + request = datastream.LookupStreamObjectRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.lookup_stream_object, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_stream_objects(self, + request: Optional[Union[datastream.ListStreamObjectsRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListStreamObjectsAsyncPager: + r"""Use this method to list the objects of a specific + stream. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_list_stream_objects(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.ListStreamObjectsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_stream_objects(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.ListStreamObjectsRequest, dict]]): + The request object. Request for listing all objects for + a specific stream. + parent (:class:`str`): + Required. The parent stream that owns + the collection of objects. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.services.datastream.pagers.ListStreamObjectsAsyncPager: + Response containing the objects for a + stream. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.ListStreamObjectsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_stream_objects, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + async def start_backfill_job(self, + request: Optional[Union[datastream.StartBackfillJobRequest, dict]] = None, + *, + object_: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream.StartBackfillJobResponse: + r"""Use this method to start a backfill job for the + specified stream object. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_start_backfill_job(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.StartBackfillJobRequest( + object_="object__value", + ) + + # Make the request + response = await client.start_backfill_job(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.StartBackfillJobRequest, dict]]): + The request object. Request for manually initiating a + backfill job for a specific stream object. + object_ (:class:`str`): + Required. The name of the stream + object resource to start a backfill job + for. + + This corresponds to the ``object_`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.types.StartBackfillJobResponse: + Response for manually initiating a + backfill job for a specific stream + object. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([object_]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.StartBackfillJobRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if object_ is not None: + request.object_ = object_ + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.start_backfill_job, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("object", request.object_), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def stop_backfill_job(self, + request: Optional[Union[datastream.StopBackfillJobRequest, dict]] = None, + *, + object_: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream.StopBackfillJobResponse: + r"""Use this method to stop a backfill job for the + specified stream object. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_stop_backfill_job(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.StopBackfillJobRequest( + object_="object__value", + ) + + # Make the request + response = await client.stop_backfill_job(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.StopBackfillJobRequest, dict]]): + The request object. Request for manually stopping a + running backfill job for a specific stream object. + object_ (:class:`str`): + Required. The name of the stream + object resource to stop the backfill job + for. + + This corresponds to the ``object_`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.types.StopBackfillJobResponse: + Response for manually stop a backfill + job for a specific stream object. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([object_]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.StopBackfillJobRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if object_ is not None: + request.object_ = object_ + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.stop_backfill_job, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("object", request.object_), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def fetch_static_ips(self, + request: Optional[Union[datastream.FetchStaticIpsRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.FetchStaticIpsAsyncPager: + r"""The FetchStaticIps API call exposes the static IP + addresses used by Datastream. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_fetch_static_ips(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.FetchStaticIpsRequest( + name="name_value", + ) + + # Make the request + page_result = client.fetch_static_ips(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.FetchStaticIpsRequest, dict]]): + The request object. Request message for 'FetchStaticIps' + request. + name (:class:`str`): + Required. The resource name for the location for which + static IPs should be returned. Must be in the format + ``projects/*/locations/*``. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.services.datastream.pagers.FetchStaticIpsAsyncPager: + Response message for a + 'FetchStaticIps' response. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.FetchStaticIpsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.fetch_static_ips, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + async def create_private_connection(self, + request: Optional[Union[datastream.CreatePrivateConnectionRequest, dict]] = None, + *, + parent: Optional[str] = None, + private_connection: Optional[datastream_resources.PrivateConnection] = None, + private_connection_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Use this method to create a private connectivity + configuration. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_create_private_connection(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + private_connection = datastream_v1.PrivateConnection() + private_connection.display_name = "display_name_value" + + request = datastream_v1.CreatePrivateConnectionRequest( + parent="parent_value", + private_connection_id="private_connection_id_value", + private_connection=private_connection, + ) + + # Make the request + operation = client.create_private_connection(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.CreatePrivateConnectionRequest, dict]]): + The request object. Request for creating a private + connection. + parent (:class:`str`): + Required. The parent that owns the + collection of PrivateConnections. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + private_connection (:class:`google.cloud.datastream_v1.types.PrivateConnection`): + Required. The Private Connectivity + resource to create. + + This corresponds to the ``private_connection`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + private_connection_id (:class:`str`): + Required. The private connectivity + identifier. + + This corresponds to the ``private_connection_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.datastream_v1.types.PrivateConnection` The PrivateConnection resource is used to establish private connectivity + between Datastream and a customer's network. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, private_connection, private_connection_id]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.CreatePrivateConnectionRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if private_connection is not None: + request.private_connection = private_connection + if private_connection_id is not None: + request.private_connection_id = private_connection_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_private_connection, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + datastream_resources.PrivateConnection, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + async def get_private_connection(self, + request: Optional[Union[datastream.GetPrivateConnectionRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream_resources.PrivateConnection: + r"""Use this method to get details about a private + connectivity configuration. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_get_private_connection(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.GetPrivateConnectionRequest( + name="name_value", + ) + + # Make the request + response = await client.get_private_connection(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.GetPrivateConnectionRequest, dict]]): + The request object. Request to get a private connection + configuration. + name (:class:`str`): + Required. The name of the private + connectivity configuration to get. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.types.PrivateConnection: + The PrivateConnection resource is + used to establish private connectivity + between Datastream and a customer's + network. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.GetPrivateConnectionRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_private_connection, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_private_connections(self, + request: Optional[Union[datastream.ListPrivateConnectionsRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListPrivateConnectionsAsyncPager: + r"""Use this method to list private connectivity + configurations in a project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_list_private_connections(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.ListPrivateConnectionsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_private_connections(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.ListPrivateConnectionsRequest, dict]]): + The request object. Request for listing private + connections. + parent (:class:`str`): + Required. The parent that owns the + collection of private connectivity + configurations. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.services.datastream.pagers.ListPrivateConnectionsAsyncPager: + Response containing a list of private + connection configurations. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.ListPrivateConnectionsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_private_connections, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + async def delete_private_connection(self, + request: Optional[Union[datastream.DeletePrivateConnectionRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Use this method to delete a private connectivity + configuration. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_delete_private_connection(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.DeletePrivateConnectionRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_private_connection(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.DeletePrivateConnectionRequest, dict]]): + The request object. Request to delete a private + connection. + name (:class:`str`): + Required. The name of the private + connectivity configuration to delete. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.DeletePrivateConnectionRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_private_connection, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty_pb2.Empty, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + async def create_route(self, + request: Optional[Union[datastream.CreateRouteRequest, dict]] = None, + *, + parent: Optional[str] = None, + route: Optional[datastream_resources.Route] = None, + route_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Use this method to create a route for a private + connectivity configuration in a project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_create_route(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + route = datastream_v1.Route() + route.display_name = "display_name_value" + route.destination_address = "destination_address_value" + + request = datastream_v1.CreateRouteRequest( + parent="parent_value", + route_id="route_id_value", + route=route, + ) + + # Make the request + operation = client.create_route(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.CreateRouteRequest, dict]]): + The request object. Route creation request. + parent (:class:`str`): + Required. The parent that owns the + collection of Routes. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + route (:class:`google.cloud.datastream_v1.types.Route`): + Required. The Route resource to + create. + + This corresponds to the ``route`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + route_id (:class:`str`): + Required. The Route identifier. + This corresponds to the ``route_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.datastream_v1.types.Route` The route resource is the child of the private connection resource, + used for defining a route for a private connection. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, route, route_id]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.CreateRouteRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if route is not None: + request.route = route + if route_id is not None: + request.route_id = route_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_route, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + datastream_resources.Route, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + async def get_route(self, + request: Optional[Union[datastream.GetRouteRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream_resources.Route: + r"""Use this method to get details about a route. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_get_route(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.GetRouteRequest( + name="name_value", + ) + + # Make the request + response = await client.get_route(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.GetRouteRequest, dict]]): + The request object. Route get request. + name (:class:`str`): + Required. The name of the Route + resource to get. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.types.Route: + The route resource is the child of + the private connection resource, used + for defining a route for a private + connection. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.GetRouteRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_route, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_routes(self, + request: Optional[Union[datastream.ListRoutesRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListRoutesAsyncPager: + r"""Use this method to list routes created for a private + connectivity configuration in a project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_list_routes(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.ListRoutesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_routes(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.ListRoutesRequest, dict]]): + The request object. Route list request. + parent (:class:`str`): + Required. The parent that owns the + collection of Routess. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.services.datastream.pagers.ListRoutesAsyncPager: + Route list response. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.ListRoutesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_routes, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + async def delete_route(self, + request: Optional[Union[datastream.DeleteRouteRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Use this method to delete a route. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + async def sample_delete_route(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.DeleteRouteRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_route(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1.types.DeleteRouteRequest, dict]]): + The request object. Route deletion request. + name (:class:`str`): + Required. The name of the Route + resource to delete. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.DeleteRouteRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_route, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty_pb2.Empty, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + async def list_operations( + self, + request: Optional[operations_pb2.ListOperationsRequest] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.ListOperationsResponse: + r"""Lists operations that match the specified filter in the request. + + Args: + request (:class:`~.operations_pb2.ListOperationsRequest`): + The request object. Request message for + `ListOperations` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.operations_pb2.ListOperationsResponse: + Response message for ``ListOperations`` method. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.ListOperationsRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._client._transport.list_operations, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + response = await rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def get_operation( + self, + request: Optional[operations_pb2.GetOperationRequest] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.Operation: + r"""Gets the latest state of a long-running operation. + + Args: + request (:class:`~.operations_pb2.GetOperationRequest`): + The request object. Request message for + `GetOperation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.operations_pb2.Operation: + An ``Operation`` object. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.GetOperationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._client._transport.get_operation, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + response = await rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def delete_operation( + self, + request: Optional[operations_pb2.DeleteOperationRequest] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes a long-running operation. + + This method indicates that the client is no longer interested + in the operation result. It does not cancel the operation. + If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. + + Args: + request (:class:`~.operations_pb2.DeleteOperationRequest`): + The request object. Request message for + `DeleteOperation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + None + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.DeleteOperationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._client._transport.delete_operation, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + async def cancel_operation( + self, + request: Optional[operations_pb2.CancelOperationRequest] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Starts asynchronous cancellation on a long-running operation. + + The server makes a best effort to cancel the operation, but success + is not guaranteed. If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. + + Args: + request (:class:`~.operations_pb2.CancelOperationRequest`): + The request object. Request message for + `CancelOperation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + None + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.CancelOperationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._client._transport.cancel_operation, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + async def get_location( + self, + request: Optional[locations_pb2.GetLocationRequest] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> locations_pb2.Location: + r"""Gets information about a location. + + Args: + request (:class:`~.location_pb2.GetLocationRequest`): + The request object. Request message for + `GetLocation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.location_pb2.Location: + Location object. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = locations_pb2.GetLocationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._client._transport.get_location, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + response = await rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def list_locations( + self, + request: Optional[locations_pb2.ListLocationsRequest] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> locations_pb2.ListLocationsResponse: + r"""Lists information about the supported locations for this service. + + Args: + request (:class:`~.location_pb2.ListLocationsRequest`): + The request object. Request message for + `ListLocations` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.location_pb2.ListLocationsResponse: + Response message for ``ListLocations`` method. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = locations_pb2.ListLocationsRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._client._transport.list_locations, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + response = await rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc, tb): + await self.transport.close() + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) + + +__all__ = ( + "DatastreamAsyncClient", +) diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/client.py b/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/client.py new file mode 100644 index 0000000..cc2510d --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/client.py @@ -0,0 +1,3685 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from collections import OrderedDict +import os +import re +from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union, cast + +from google.cloud.datastream_v1 import gapic_version as package_version + +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.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 + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + +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.cloud.location import locations_pb2 # type: ignore +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore +from google.longrunning import operations_pb2 +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 import DatastreamGrpcTransport +from .transports.grpc_asyncio import DatastreamGrpcAsyncIOTransport + + +class DatastreamClientMeta(type): + """Metaclass for the Datastream client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + _transport_registry = OrderedDict() # type: Dict[str, Type[DatastreamTransport]] + _transport_registry["grpc"] = DatastreamGrpcTransport + _transport_registry["grpc_asyncio"] = DatastreamGrpcAsyncIOTransport + + def get_transport_class(cls, + label: Optional[str] = None, + ) -> Type[DatastreamTransport]: + """Returns an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class DatastreamClient(metaclass=DatastreamClientMeta): + """Datastream service""" + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Converts api endpoint to mTLS endpoint. + + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "datastream.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials + info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + DatastreamClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + DatastreamClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file( + filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> DatastreamTransport: + """Returns the transport used by the client instance. + + Returns: + DatastreamTransport: The transport used by the client + instance. + """ + return self._transport + + @staticmethod + def connection_profile_path(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, ) + + @staticmethod + def parse_connection_profile_path(path: str) -> Dict[str,str]: + """Parses a connection_profile path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/connectionProfiles/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + 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, ) + + @staticmethod + def parse_networks_path(path: str) -> Dict[str,str]: + """Parses a networks path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/global/networks/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def private_connection_path(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, ) + + @staticmethod + def parse_private_connection_path(path: str) -> Dict[str,str]: + """Parses a private_connection path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/privateConnections/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def route_path(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(project=project, location=location, private_connection=private_connection, route=route, ) + + @staticmethod + def parse_route_path(path: str) -> Dict[str,str]: + """Parses a route path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/privateConnections/(?P.+?)/routes/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + 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, ) + + @staticmethod + def parse_stream_path(path: str) -> Dict[str,str]: + """Parses a stream path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/streams/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def stream_object_path(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, ) + + @staticmethod + def parse_stream_object_path(path: str) -> Dict[str,str]: + """Parses a stream_object path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/streams/(?P.+?)/objects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + 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, ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str,str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path(folder: str, ) -> str: + """Returns a fully-qualified folder string.""" + return "folders/{folder}".format(folder=folder, ) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str,str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path(organization: str, ) -> str: + """Returns a fully-qualified organization string.""" + return "organizations/{organization}".format(organization=organization, ) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str,str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path(project: str, ) -> str: + """Returns a fully-qualified project string.""" + return "projects/{project}".format(project=project, ) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str,str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + 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, ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str,str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @classmethod + def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[client_options_lib.ClientOptions] = None): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variable is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + if client_options is None: + client_options = client_options_lib.ClientOptions() + use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") + use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_client_cert not in ("true", "false"): + raise ValueError("Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`") + if use_mtls_endpoint not in ("auto", "never", "always"): + raise MutualTLSChannelError("Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`") + + # Figure out the client cert source to use. + client_cert_source = None + if use_client_cert == "true": + if client_options.client_cert_source: + client_cert_source = client_options.client_cert_source + elif mtls.has_default_client_cert_source(): + client_cert_source = mtls.default_client_cert_source() + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + elif use_mtls_endpoint == "always" or (use_mtls_endpoint == "auto" and client_cert_source): + api_endpoint = cls.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = cls.DEFAULT_ENDPOINT + + return api_endpoint, client_cert_source + + def __init__(self, *, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Optional[Union[str, DatastreamTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiates the datastream client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, DatastreamTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) + + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source(client_options) + + api_key_value = getattr(client_options, "api_key", None) + if api_key_value and credentials: + raise ValueError("client_options.api_key and credentials are mutually exclusive") + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, DatastreamTransport): + # transport is a DatastreamTransport instance. + if credentials or client_options.credentials_file or api_key_value: + raise ValueError("When providing a transport instance, " + "provide its credentials directly.") + if client_options.scopes: + raise ValueError( + "When providing a transport instance, provide its scopes " + "directly." + ) + self._transport = transport + else: + import google.auth._default # type: ignore + + if api_key_value and hasattr(google.auth._default, "get_api_key_credentials"): + credentials = google.auth._default.get_api_key_credentials(api_key_value) + + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + client_cert_source_for_mtls=client_cert_source_func, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + always_use_jwt_access=True, + api_audience=client_options.api_audience, + ) + + def list_connection_profiles(self, + request: Optional[Union[datastream.ListConnectionProfilesRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListConnectionProfilesPager: + r"""Use this method to list connection profiles created + in a project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_list_connection_profiles(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.ListConnectionProfilesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_connection_profiles(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.ListConnectionProfilesRequest, dict]): + The request object. Request message for listing + connection profiles. + parent (str): + Required. The parent that owns the + collection of connection profiles. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.services.datastream.pagers.ListConnectionProfilesPager: + Response message for listing + connection profiles. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.ListConnectionProfilesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.ListConnectionProfilesRequest): + request = datastream.ListConnectionProfilesRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_connection_profiles] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + def get_connection_profile(self, + request: Optional[Union[datastream.GetConnectionProfileRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream_resources.ConnectionProfile: + r"""Use this method to get details about a connection + profile. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_get_connection_profile(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.GetConnectionProfileRequest( + name="name_value", + ) + + # Make the request + response = client.get_connection_profile(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.GetConnectionProfileRequest, dict]): + The request object. Request message for getting a + connection profile. + name (str): + Required. The name of the connection + profile resource to get. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.types.ConnectionProfile: + A set of reusable connection + configurations to be used as a source or + destination for a stream. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.GetConnectionProfileRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.GetConnectionProfileRequest): + request = datastream.GetConnectionProfileRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_connection_profile] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def create_connection_profile(self, + request: Optional[Union[datastream.CreateConnectionProfileRequest, dict]] = None, + *, + parent: Optional[str] = None, + connection_profile: Optional[datastream_resources.ConnectionProfile] = None, + connection_profile_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Use this method to create a connection profile in a + project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_create_connection_profile(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + connection_profile = datastream_v1.ConnectionProfile() + connection_profile.oracle_profile.hostname = "hostname_value" + connection_profile.oracle_profile.username = "username_value" + connection_profile.oracle_profile.password = "password_value" + connection_profile.oracle_profile.database_service = "database_service_value" + connection_profile.display_name = "display_name_value" + + request = datastream_v1.CreateConnectionProfileRequest( + parent="parent_value", + connection_profile_id="connection_profile_id_value", + connection_profile=connection_profile, + ) + + # Make the request + operation = client.create_connection_profile(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.CreateConnectionProfileRequest, dict]): + The request object. Request message for creating a + connection profile. + parent (str): + Required. The parent that owns the + collection of ConnectionProfiles. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + connection_profile (google.cloud.datastream_v1.types.ConnectionProfile): + Required. The connection profile + resource to create. + + This corresponds to the ``connection_profile`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + connection_profile_id (str): + Required. The connection profile + identifier. + + This corresponds to the ``connection_profile_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.datastream_v1.types.ConnectionProfile` A set of reusable connection configurations to be used as a source or + destination for a stream. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, connection_profile, connection_profile_id]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.CreateConnectionProfileRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.CreateConnectionProfileRequest): + request = datastream.CreateConnectionProfileRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if connection_profile is not None: + request.connection_profile = connection_profile + if connection_profile_id is not None: + request.connection_profile_id = connection_profile_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_connection_profile] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + datastream_resources.ConnectionProfile, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + def update_connection_profile(self, + request: Optional[Union[datastream.UpdateConnectionProfileRequest, dict]] = None, + *, + connection_profile: Optional[datastream_resources.ConnectionProfile] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Use this method to update the parameters of a + connection profile. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_update_connection_profile(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + connection_profile = datastream_v1.ConnectionProfile() + connection_profile.oracle_profile.hostname = "hostname_value" + connection_profile.oracle_profile.username = "username_value" + connection_profile.oracle_profile.password = "password_value" + connection_profile.oracle_profile.database_service = "database_service_value" + connection_profile.display_name = "display_name_value" + + request = datastream_v1.UpdateConnectionProfileRequest( + connection_profile=connection_profile, + ) + + # Make the request + operation = client.update_connection_profile(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.UpdateConnectionProfileRequest, dict]): + The request object. Connection profile update message. + connection_profile (google.cloud.datastream_v1.types.ConnectionProfile): + Required. The connection profile to + update. + + This corresponds to the ``connection_profile`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Optional. Field mask is used to specify the fields to be + overwritten in the ConnectionProfile resource by the + update. The fields specified in the update_mask are + relative to the resource, not the full request. A field + will be overwritten if it is in the mask. If the user + does not provide a mask then all fields will be + overwritten. + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.datastream_v1.types.ConnectionProfile` A set of reusable connection configurations to be used as a source or + destination for a stream. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([connection_profile, update_mask]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.UpdateConnectionProfileRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.UpdateConnectionProfileRequest): + request = datastream.UpdateConnectionProfileRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if connection_profile is not None: + request.connection_profile = connection_profile + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_connection_profile] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("connection_profile.name", request.connection_profile.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + datastream_resources.ConnectionProfile, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + def delete_connection_profile(self, + request: Optional[Union[datastream.DeleteConnectionProfileRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Use this method to delete a connection profile. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_delete_connection_profile(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.DeleteConnectionProfileRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_connection_profile(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.DeleteConnectionProfileRequest, dict]): + The request object. Request message for deleting a + connection profile. + name (str): + Required. The name of the connection + profile resource to delete. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.DeleteConnectionProfileRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.DeleteConnectionProfileRequest): + request = datastream.DeleteConnectionProfileRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_connection_profile] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty_pb2.Empty, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + def discover_connection_profile(self, + request: Optional[Union[datastream.DiscoverConnectionProfileRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream.DiscoverConnectionProfileResponse: + r"""Use this method to discover a connection profile. + The discover API call exposes the data objects and + metadata belonging to the profile. Typically, a request + returns children data objects of a parent data object + that's optionally supplied in the request. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_discover_connection_profile(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + connection_profile = datastream_v1.ConnectionProfile() + connection_profile.oracle_profile.hostname = "hostname_value" + connection_profile.oracle_profile.username = "username_value" + connection_profile.oracle_profile.password = "password_value" + connection_profile.oracle_profile.database_service = "database_service_value" + connection_profile.display_name = "display_name_value" + + request = datastream_v1.DiscoverConnectionProfileRequest( + connection_profile=connection_profile, + full_hierarchy=True, + parent="parent_value", + ) + + # Make the request + response = client.discover_connection_profile(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.DiscoverConnectionProfileRequest, dict]): + The request object. Request message for 'discover' + ConnectionProfile request. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.types.DiscoverConnectionProfileResponse: + Response from a discover request. + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a datastream.DiscoverConnectionProfileRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.DiscoverConnectionProfileRequest): + request = datastream.DiscoverConnectionProfileRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.discover_connection_profile] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_streams(self, + request: Optional[Union[datastream.ListStreamsRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListStreamsPager: + r"""Use this method to list streams in a project and + location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_list_streams(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.ListStreamsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_streams(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.ListStreamsRequest, dict]): + The request object. Request message for listing streams. + parent (str): + Required. The parent that owns the + collection of streams. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.services.datastream.pagers.ListStreamsPager: + Response message for listing streams. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.ListStreamsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.ListStreamsRequest): + request = datastream.ListStreamsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_streams] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + def get_stream(self, + request: Optional[Union[datastream.GetStreamRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream_resources.Stream: + r"""Use this method to get details about a stream. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_get_stream(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.GetStreamRequest( + name="name_value", + ) + + # Make the request + response = client.get_stream(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.GetStreamRequest, dict]): + The request object. Request message for getting a + stream. + name (str): + Required. The name of the stream + resource to get. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.types.Stream: + A resource representing streaming + data from a source to a destination. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.GetStreamRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.GetStreamRequest): + request = datastream.GetStreamRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_stream] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def create_stream(self, + request: Optional[Union[datastream.CreateStreamRequest, dict]] = None, + *, + parent: Optional[str] = None, + stream: Optional[datastream_resources.Stream] = None, + stream_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Use this method to create a stream. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_create_stream(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + stream = datastream_v1.Stream() + stream.display_name = "display_name_value" + stream.source_config.source_connection_profile = "source_connection_profile_value" + stream.destination_config.destination_connection_profile = "destination_connection_profile_value" + + request = datastream_v1.CreateStreamRequest( + parent="parent_value", + stream_id="stream_id_value", + stream=stream, + ) + + # Make the request + operation = client.create_stream(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.CreateStreamRequest, dict]): + The request object. Request message for creating a + stream. + parent (str): + Required. The parent that owns the + collection of streams. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + stream (google.cloud.datastream_v1.types.Stream): + Required. The stream resource to + create. + + This corresponds to the ``stream`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + stream_id (str): + Required. The stream identifier. + This corresponds to the ``stream_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.datastream_v1.types.Stream` A + resource representing streaming data from a source to a + destination. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, stream, stream_id]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.CreateStreamRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.CreateStreamRequest): + request = datastream.CreateStreamRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if stream is not None: + request.stream = stream + if stream_id is not None: + request.stream_id = stream_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_stream] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + datastream_resources.Stream, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + def update_stream(self, + request: Optional[Union[datastream.UpdateStreamRequest, dict]] = None, + *, + stream: Optional[datastream_resources.Stream] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Use this method to update the configuration of a + stream. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_update_stream(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + stream = datastream_v1.Stream() + stream.display_name = "display_name_value" + stream.source_config.source_connection_profile = "source_connection_profile_value" + stream.destination_config.destination_connection_profile = "destination_connection_profile_value" + + request = datastream_v1.UpdateStreamRequest( + stream=stream, + ) + + # Make the request + operation = client.update_stream(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.UpdateStreamRequest, dict]): + The request object. Request message for updating a + stream. + stream (google.cloud.datastream_v1.types.Stream): + Required. The stream resource to + update. + + This corresponds to the ``stream`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Optional. Field mask is used to specify the fields to be + overwritten in the stream resource by the update. The + fields specified in the update_mask are relative to the + resource, not the full request. A field will be + overwritten if it is in the mask. If the user does not + provide a mask then all fields will be overwritten. + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.datastream_v1.types.Stream` A + resource representing streaming data from a source to a + destination. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([stream, update_mask]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.UpdateStreamRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.UpdateStreamRequest): + request = datastream.UpdateStreamRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if stream is not None: + request.stream = stream + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_stream] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("stream.name", request.stream.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + datastream_resources.Stream, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + def delete_stream(self, + request: Optional[Union[datastream.DeleteStreamRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Use this method to delete a stream. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_delete_stream(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.DeleteStreamRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_stream(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.DeleteStreamRequest, dict]): + The request object. Request message for deleting a + stream. + name (str): + Required. The name of the stream + resource to delete. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.DeleteStreamRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.DeleteStreamRequest): + request = datastream.DeleteStreamRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_stream] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty_pb2.Empty, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + def get_stream_object(self, + request: Optional[Union[datastream.GetStreamObjectRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream_resources.StreamObject: + r"""Use this method to get details about a stream object. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_get_stream_object(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.GetStreamObjectRequest( + name="name_value", + ) + + # Make the request + response = client.get_stream_object(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.GetStreamObjectRequest, dict]): + The request object. Request for fetching a specific + stream object. + name (str): + Required. The name of the stream + object resource to get. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.types.StreamObject: + A specific stream object (e.g a + specific DB table). + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.GetStreamObjectRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.GetStreamObjectRequest): + request = datastream.GetStreamObjectRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_stream_object] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def lookup_stream_object(self, + request: Optional[Union[datastream.LookupStreamObjectRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream_resources.StreamObject: + r"""Use this method to look up a stream object by its + source object identifier. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_lookup_stream_object(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + source_object_identifier = datastream_v1.SourceObjectIdentifier() + source_object_identifier.oracle_identifier.schema = "schema_value" + source_object_identifier.oracle_identifier.table = "table_value" + + request = datastream_v1.LookupStreamObjectRequest( + parent="parent_value", + source_object_identifier=source_object_identifier, + ) + + # Make the request + response = client.lookup_stream_object(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.LookupStreamObjectRequest, dict]): + The request object. Request for looking up a specific + stream object by its source object identifier. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.types.StreamObject: + A specific stream object (e.g a + specific DB table). + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a datastream.LookupStreamObjectRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.LookupStreamObjectRequest): + request = datastream.LookupStreamObjectRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.lookup_stream_object] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_stream_objects(self, + request: Optional[Union[datastream.ListStreamObjectsRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListStreamObjectsPager: + r"""Use this method to list the objects of a specific + stream. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_list_stream_objects(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.ListStreamObjectsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_stream_objects(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.ListStreamObjectsRequest, dict]): + The request object. Request for listing all objects for + a specific stream. + parent (str): + Required. The parent stream that owns + the collection of objects. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.services.datastream.pagers.ListStreamObjectsPager: + Response containing the objects for a + stream. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.ListStreamObjectsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.ListStreamObjectsRequest): + request = datastream.ListStreamObjectsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_stream_objects] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + def start_backfill_job(self, + request: Optional[Union[datastream.StartBackfillJobRequest, dict]] = None, + *, + object_: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream.StartBackfillJobResponse: + r"""Use this method to start a backfill job for the + specified stream object. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_start_backfill_job(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.StartBackfillJobRequest( + object_="object__value", + ) + + # Make the request + response = client.start_backfill_job(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.StartBackfillJobRequest, dict]): + The request object. Request for manually initiating a + backfill job for a specific stream object. + object_ (str): + Required. The name of the stream + object resource to start a backfill job + for. + + This corresponds to the ``object_`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.types.StartBackfillJobResponse: + Response for manually initiating a + backfill job for a specific stream + object. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([object_]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.StartBackfillJobRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.StartBackfillJobRequest): + request = datastream.StartBackfillJobRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if object_ is not None: + request.object_ = object_ + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.start_backfill_job] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("object", request.object_), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def stop_backfill_job(self, + request: Optional[Union[datastream.StopBackfillJobRequest, dict]] = None, + *, + object_: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream.StopBackfillJobResponse: + r"""Use this method to stop a backfill job for the + specified stream object. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_stop_backfill_job(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.StopBackfillJobRequest( + object_="object__value", + ) + + # Make the request + response = client.stop_backfill_job(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.StopBackfillJobRequest, dict]): + The request object. Request for manually stopping a + running backfill job for a specific stream object. + object_ (str): + Required. The name of the stream + object resource to stop the backfill job + for. + + This corresponds to the ``object_`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.types.StopBackfillJobResponse: + Response for manually stop a backfill + job for a specific stream object. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([object_]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.StopBackfillJobRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.StopBackfillJobRequest): + request = datastream.StopBackfillJobRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if object_ is not None: + request.object_ = object_ + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.stop_backfill_job] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("object", request.object_), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def fetch_static_ips(self, + request: Optional[Union[datastream.FetchStaticIpsRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.FetchStaticIpsPager: + r"""The FetchStaticIps API call exposes the static IP + addresses used by Datastream. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_fetch_static_ips(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.FetchStaticIpsRequest( + name="name_value", + ) + + # Make the request + page_result = client.fetch_static_ips(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.FetchStaticIpsRequest, dict]): + The request object. Request message for 'FetchStaticIps' + request. + name (str): + Required. The resource name for the location for which + static IPs should be returned. Must be in the format + ``projects/*/locations/*``. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.services.datastream.pagers.FetchStaticIpsPager: + Response message for a + 'FetchStaticIps' response. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.FetchStaticIpsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.FetchStaticIpsRequest): + request = datastream.FetchStaticIpsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.fetch_static_ips] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + def create_private_connection(self, + request: Optional[Union[datastream.CreatePrivateConnectionRequest, dict]] = None, + *, + parent: Optional[str] = None, + private_connection: Optional[datastream_resources.PrivateConnection] = None, + private_connection_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Use this method to create a private connectivity + configuration. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_create_private_connection(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + private_connection = datastream_v1.PrivateConnection() + private_connection.display_name = "display_name_value" + + request = datastream_v1.CreatePrivateConnectionRequest( + parent="parent_value", + private_connection_id="private_connection_id_value", + private_connection=private_connection, + ) + + # Make the request + operation = client.create_private_connection(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.CreatePrivateConnectionRequest, dict]): + The request object. Request for creating a private + connection. + parent (str): + Required. The parent that owns the + collection of PrivateConnections. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + private_connection (google.cloud.datastream_v1.types.PrivateConnection): + Required. The Private Connectivity + resource to create. + + This corresponds to the ``private_connection`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + private_connection_id (str): + Required. The private connectivity + identifier. + + This corresponds to the ``private_connection_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.datastream_v1.types.PrivateConnection` The PrivateConnection resource is used to establish private connectivity + between Datastream and a customer's network. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, private_connection, private_connection_id]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.CreatePrivateConnectionRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.CreatePrivateConnectionRequest): + request = datastream.CreatePrivateConnectionRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if private_connection is not None: + request.private_connection = private_connection + if private_connection_id is not None: + request.private_connection_id = private_connection_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_private_connection] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + datastream_resources.PrivateConnection, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + def get_private_connection(self, + request: Optional[Union[datastream.GetPrivateConnectionRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream_resources.PrivateConnection: + r"""Use this method to get details about a private + connectivity configuration. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_get_private_connection(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.GetPrivateConnectionRequest( + name="name_value", + ) + + # Make the request + response = client.get_private_connection(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.GetPrivateConnectionRequest, dict]): + The request object. Request to get a private connection + configuration. + name (str): + Required. The name of the private + connectivity configuration to get. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.types.PrivateConnection: + The PrivateConnection resource is + used to establish private connectivity + between Datastream and a customer's + network. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.GetPrivateConnectionRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.GetPrivateConnectionRequest): + request = datastream.GetPrivateConnectionRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_private_connection] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_private_connections(self, + request: Optional[Union[datastream.ListPrivateConnectionsRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListPrivateConnectionsPager: + r"""Use this method to list private connectivity + configurations in a project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_list_private_connections(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.ListPrivateConnectionsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_private_connections(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.ListPrivateConnectionsRequest, dict]): + The request object. Request for listing private + connections. + parent (str): + Required. The parent that owns the + collection of private connectivity + configurations. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.services.datastream.pagers.ListPrivateConnectionsPager: + Response containing a list of private + connection configurations. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.ListPrivateConnectionsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.ListPrivateConnectionsRequest): + request = datastream.ListPrivateConnectionsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_private_connections] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + def delete_private_connection(self, + request: Optional[Union[datastream.DeletePrivateConnectionRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Use this method to delete a private connectivity + configuration. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_delete_private_connection(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.DeletePrivateConnectionRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_private_connection(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.DeletePrivateConnectionRequest, dict]): + The request object. Request to delete a private + connection. + name (str): + Required. The name of the private + connectivity configuration to delete. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.DeletePrivateConnectionRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.DeletePrivateConnectionRequest): + request = datastream.DeletePrivateConnectionRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_private_connection] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty_pb2.Empty, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + def create_route(self, + request: Optional[Union[datastream.CreateRouteRequest, dict]] = None, + *, + parent: Optional[str] = None, + route: Optional[datastream_resources.Route] = None, + route_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Use this method to create a route for a private + connectivity configuration in a project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_create_route(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + route = datastream_v1.Route() + route.display_name = "display_name_value" + route.destination_address = "destination_address_value" + + request = datastream_v1.CreateRouteRequest( + parent="parent_value", + route_id="route_id_value", + route=route, + ) + + # Make the request + operation = client.create_route(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.CreateRouteRequest, dict]): + The request object. Route creation request. + parent (str): + Required. The parent that owns the + collection of Routes. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + route (google.cloud.datastream_v1.types.Route): + Required. The Route resource to + create. + + This corresponds to the ``route`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + route_id (str): + Required. The Route identifier. + This corresponds to the ``route_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.datastream_v1.types.Route` The route resource is the child of the private connection resource, + used for defining a route for a private connection. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, route, route_id]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.CreateRouteRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.CreateRouteRequest): + request = datastream.CreateRouteRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if route is not None: + request.route = route + if route_id is not None: + request.route_id = route_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_route] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + datastream_resources.Route, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + def get_route(self, + request: Optional[Union[datastream.GetRouteRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream_resources.Route: + r"""Use this method to get details about a route. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_get_route(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.GetRouteRequest( + name="name_value", + ) + + # Make the request + response = client.get_route(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.GetRouteRequest, dict]): + The request object. Route get request. + name (str): + Required. The name of the Route + resource to get. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.types.Route: + The route resource is the child of + the private connection resource, used + for defining a route for a private + connection. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.GetRouteRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.GetRouteRequest): + request = datastream.GetRouteRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_route] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_routes(self, + request: Optional[Union[datastream.ListRoutesRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListRoutesPager: + r"""Use this method to list routes created for a private + connectivity configuration in a project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_list_routes(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.ListRoutesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_routes(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.ListRoutesRequest, dict]): + The request object. Route list request. + parent (str): + Required. The parent that owns the + collection of Routess. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1.services.datastream.pagers.ListRoutesPager: + Route list response. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.ListRoutesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.ListRoutesRequest): + request = datastream.ListRoutesRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_routes] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + def delete_route(self, + request: Optional[Union[datastream.DeleteRouteRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Use this method to delete a route. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1 + + def sample_delete_route(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.DeleteRouteRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_route(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1.types.DeleteRouteRequest, dict]): + The request object. Route deletion request. + name (str): + Required. The name of the Route + resource to delete. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.DeleteRouteRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.DeleteRouteRequest): + request = datastream.DeleteRouteRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_route] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty_pb2.Empty, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + def __enter__(self) -> "DatastreamClient": + return self + + def __exit__(self, type, value, traceback): + """Releases underlying transport's resources. + + .. warning:: + ONLY use as a context manager if the transport is NOT shared + with other clients! Exiting the with block will CLOSE the transport + and may cause errors in other clients! + """ + self.transport.close() + + def list_operations( + self, + request: Optional[operations_pb2.ListOperationsRequest] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.ListOperationsResponse: + r"""Lists operations that match the specified filter in the request. + + Args: + request (:class:`~.operations_pb2.ListOperationsRequest`): + The request object. Request message for + `ListOperations` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.operations_pb2.ListOperationsResponse: + Response message for ``ListOperations`` method. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.ListOperationsRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.list_operations, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def get_operation( + self, + request: Optional[operations_pb2.GetOperationRequest] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.Operation: + r"""Gets the latest state of a long-running operation. + + Args: + request (:class:`~.operations_pb2.GetOperationRequest`): + The request object. Request message for + `GetOperation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.operations_pb2.Operation: + An ``Operation`` object. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.GetOperationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.get_operation, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def delete_operation( + self, + request: Optional[operations_pb2.DeleteOperationRequest] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes a long-running operation. + + This method indicates that the client is no longer interested + in the operation result. It does not cancel the operation. + If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. + + Args: + request (:class:`~.operations_pb2.DeleteOperationRequest`): + The request object. Request message for + `DeleteOperation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + None + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.DeleteOperationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.delete_operation, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + def cancel_operation( + self, + request: Optional[operations_pb2.CancelOperationRequest] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Starts asynchronous cancellation on a long-running operation. + + The server makes a best effort to cancel the operation, but success + is not guaranteed. If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. + + Args: + request (:class:`~.operations_pb2.CancelOperationRequest`): + The request object. Request message for + `CancelOperation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + None + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.CancelOperationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.cancel_operation, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + def get_location( + self, + request: Optional[locations_pb2.GetLocationRequest] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> locations_pb2.Location: + r"""Gets information about a location. + + Args: + request (:class:`~.location_pb2.GetLocationRequest`): + The request object. Request message for + `GetLocation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.location_pb2.Location: + Location object. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = locations_pb2.GetLocationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.get_location, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def list_locations( + self, + request: Optional[locations_pb2.ListLocationsRequest] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> locations_pb2.ListLocationsResponse: + r"""Lists information about the supported locations for this service. + + Args: + request (:class:`~.location_pb2.ListLocationsRequest`): + The request object. Request message for + `ListLocations` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.location_pb2.ListLocationsResponse: + Response message for ``ListLocations`` method. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = locations_pb2.ListLocationsRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.list_locations, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) + + +__all__ = ( + "DatastreamClient", +) diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/pagers.py b/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/pagers.py new file mode 100644 index 0000000..87bf95d --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/pagers.py @@ -0,0 +1,745 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from typing import Any, AsyncIterator, Awaitable, Callable, Sequence, Tuple, Optional, Iterator + +from google.cloud.datastream_v1.types import datastream +from google.cloud.datastream_v1.types import datastream_resources + + +class ListConnectionProfilesPager: + """A pager for iterating through ``list_connection_profiles`` requests. + + This class thinly wraps an initial + :class:`google.cloud.datastream_v1.types.ListConnectionProfilesResponse` object, and + provides an ``__iter__`` method to iterate through its + ``connection_profiles`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListConnectionProfiles`` requests and continue to iterate + through the ``connection_profiles`` field on the + corresponding responses. + + All the usual :class:`google.cloud.datastream_v1.types.ListConnectionProfilesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., datastream.ListConnectionProfilesResponse], + request: datastream.ListConnectionProfilesRequest, + response: datastream.ListConnectionProfilesResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.datastream_v1.types.ListConnectionProfilesRequest): + The initial request object. + response (google.cloud.datastream_v1.types.ListConnectionProfilesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = datastream.ListConnectionProfilesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[datastream.ListConnectionProfilesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[datastream_resources.ConnectionProfile]: + for page in self.pages: + yield from page.connection_profiles + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListConnectionProfilesAsyncPager: + """A pager for iterating through ``list_connection_profiles`` requests. + + This class thinly wraps an initial + :class:`google.cloud.datastream_v1.types.ListConnectionProfilesResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``connection_profiles`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListConnectionProfiles`` requests and continue to iterate + through the ``connection_profiles`` field on the + corresponding responses. + + All the usual :class:`google.cloud.datastream_v1.types.ListConnectionProfilesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[datastream.ListConnectionProfilesResponse]], + request: datastream.ListConnectionProfilesRequest, + response: datastream.ListConnectionProfilesResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.datastream_v1.types.ListConnectionProfilesRequest): + The initial request object. + response (google.cloud.datastream_v1.types.ListConnectionProfilesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = datastream.ListConnectionProfilesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[datastream.ListConnectionProfilesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[datastream_resources.ConnectionProfile]: + async def async_generator(): + async for page in self.pages: + for response in page.connection_profiles: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListStreamsPager: + """A pager for iterating through ``list_streams`` requests. + + This class thinly wraps an initial + :class:`google.cloud.datastream_v1.types.ListStreamsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``streams`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListStreams`` requests and continue to iterate + through the ``streams`` field on the + corresponding responses. + + All the usual :class:`google.cloud.datastream_v1.types.ListStreamsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., datastream.ListStreamsResponse], + request: datastream.ListStreamsRequest, + response: datastream.ListStreamsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.datastream_v1.types.ListStreamsRequest): + The initial request object. + response (google.cloud.datastream_v1.types.ListStreamsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = datastream.ListStreamsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[datastream.ListStreamsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[datastream_resources.Stream]: + for page in self.pages: + yield from page.streams + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListStreamsAsyncPager: + """A pager for iterating through ``list_streams`` requests. + + This class thinly wraps an initial + :class:`google.cloud.datastream_v1.types.ListStreamsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``streams`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListStreams`` requests and continue to iterate + through the ``streams`` field on the + corresponding responses. + + All the usual :class:`google.cloud.datastream_v1.types.ListStreamsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[datastream.ListStreamsResponse]], + request: datastream.ListStreamsRequest, + response: datastream.ListStreamsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.datastream_v1.types.ListStreamsRequest): + The initial request object. + response (google.cloud.datastream_v1.types.ListStreamsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = datastream.ListStreamsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[datastream.ListStreamsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[datastream_resources.Stream]: + async def async_generator(): + async for page in self.pages: + for response in page.streams: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListStreamObjectsPager: + """A pager for iterating through ``list_stream_objects`` requests. + + This class thinly wraps an initial + :class:`google.cloud.datastream_v1.types.ListStreamObjectsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``stream_objects`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListStreamObjects`` requests and continue to iterate + through the ``stream_objects`` field on the + corresponding responses. + + All the usual :class:`google.cloud.datastream_v1.types.ListStreamObjectsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., datastream.ListStreamObjectsResponse], + request: datastream.ListStreamObjectsRequest, + response: datastream.ListStreamObjectsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.datastream_v1.types.ListStreamObjectsRequest): + The initial request object. + response (google.cloud.datastream_v1.types.ListStreamObjectsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = datastream.ListStreamObjectsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[datastream.ListStreamObjectsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[datastream_resources.StreamObject]: + for page in self.pages: + yield from page.stream_objects + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListStreamObjectsAsyncPager: + """A pager for iterating through ``list_stream_objects`` requests. + + This class thinly wraps an initial + :class:`google.cloud.datastream_v1.types.ListStreamObjectsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``stream_objects`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListStreamObjects`` requests and continue to iterate + through the ``stream_objects`` field on the + corresponding responses. + + All the usual :class:`google.cloud.datastream_v1.types.ListStreamObjectsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[datastream.ListStreamObjectsResponse]], + request: datastream.ListStreamObjectsRequest, + response: datastream.ListStreamObjectsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.datastream_v1.types.ListStreamObjectsRequest): + The initial request object. + response (google.cloud.datastream_v1.types.ListStreamObjectsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = datastream.ListStreamObjectsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[datastream.ListStreamObjectsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[datastream_resources.StreamObject]: + async def async_generator(): + async for page in self.pages: + for response in page.stream_objects: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class FetchStaticIpsPager: + """A pager for iterating through ``fetch_static_ips`` requests. + + This class thinly wraps an initial + :class:`google.cloud.datastream_v1.types.FetchStaticIpsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``static_ips`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``FetchStaticIps`` requests and continue to iterate + through the ``static_ips`` field on the + corresponding responses. + + All the usual :class:`google.cloud.datastream_v1.types.FetchStaticIpsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., datastream.FetchStaticIpsResponse], + request: datastream.FetchStaticIpsRequest, + response: datastream.FetchStaticIpsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.datastream_v1.types.FetchStaticIpsRequest): + The initial request object. + response (google.cloud.datastream_v1.types.FetchStaticIpsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = datastream.FetchStaticIpsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[datastream.FetchStaticIpsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[str]: + for page in self.pages: + yield from page.static_ips + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class FetchStaticIpsAsyncPager: + """A pager for iterating through ``fetch_static_ips`` requests. + + This class thinly wraps an initial + :class:`google.cloud.datastream_v1.types.FetchStaticIpsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``static_ips`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``FetchStaticIps`` requests and continue to iterate + through the ``static_ips`` field on the + corresponding responses. + + All the usual :class:`google.cloud.datastream_v1.types.FetchStaticIpsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[datastream.FetchStaticIpsResponse]], + request: datastream.FetchStaticIpsRequest, + response: datastream.FetchStaticIpsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.datastream_v1.types.FetchStaticIpsRequest): + The initial request object. + response (google.cloud.datastream_v1.types.FetchStaticIpsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = datastream.FetchStaticIpsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[datastream.FetchStaticIpsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[str]: + async def async_generator(): + async for page in self.pages: + for response in page.static_ips: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListPrivateConnectionsPager: + """A pager for iterating through ``list_private_connections`` requests. + + This class thinly wraps an initial + :class:`google.cloud.datastream_v1.types.ListPrivateConnectionsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``private_connections`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListPrivateConnections`` requests and continue to iterate + through the ``private_connections`` field on the + corresponding responses. + + All the usual :class:`google.cloud.datastream_v1.types.ListPrivateConnectionsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., datastream.ListPrivateConnectionsResponse], + request: datastream.ListPrivateConnectionsRequest, + response: datastream.ListPrivateConnectionsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.datastream_v1.types.ListPrivateConnectionsRequest): + The initial request object. + response (google.cloud.datastream_v1.types.ListPrivateConnectionsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = datastream.ListPrivateConnectionsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[datastream.ListPrivateConnectionsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[datastream_resources.PrivateConnection]: + for page in self.pages: + yield from page.private_connections + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListPrivateConnectionsAsyncPager: + """A pager for iterating through ``list_private_connections`` requests. + + This class thinly wraps an initial + :class:`google.cloud.datastream_v1.types.ListPrivateConnectionsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``private_connections`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListPrivateConnections`` requests and continue to iterate + through the ``private_connections`` field on the + corresponding responses. + + All the usual :class:`google.cloud.datastream_v1.types.ListPrivateConnectionsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[datastream.ListPrivateConnectionsResponse]], + request: datastream.ListPrivateConnectionsRequest, + response: datastream.ListPrivateConnectionsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.datastream_v1.types.ListPrivateConnectionsRequest): + The initial request object. + response (google.cloud.datastream_v1.types.ListPrivateConnectionsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = datastream.ListPrivateConnectionsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[datastream.ListPrivateConnectionsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[datastream_resources.PrivateConnection]: + async def async_generator(): + async for page in self.pages: + for response in page.private_connections: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListRoutesPager: + """A pager for iterating through ``list_routes`` requests. + + This class thinly wraps an initial + :class:`google.cloud.datastream_v1.types.ListRoutesResponse` object, and + provides an ``__iter__`` method to iterate through its + ``routes`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListRoutes`` requests and continue to iterate + through the ``routes`` field on the + corresponding responses. + + All the usual :class:`google.cloud.datastream_v1.types.ListRoutesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., datastream.ListRoutesResponse], + request: datastream.ListRoutesRequest, + response: datastream.ListRoutesResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.datastream_v1.types.ListRoutesRequest): + The initial request object. + response (google.cloud.datastream_v1.types.ListRoutesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = datastream.ListRoutesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[datastream.ListRoutesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[datastream_resources.Route]: + for page in self.pages: + yield from page.routes + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListRoutesAsyncPager: + """A pager for iterating through ``list_routes`` requests. + + This class thinly wraps an initial + :class:`google.cloud.datastream_v1.types.ListRoutesResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``routes`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListRoutes`` requests and continue to iterate + through the ``routes`` field on the + corresponding responses. + + All the usual :class:`google.cloud.datastream_v1.types.ListRoutesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[datastream.ListRoutesResponse]], + request: datastream.ListRoutesRequest, + response: datastream.ListRoutesResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.datastream_v1.types.ListRoutesRequest): + The initial request object. + response (google.cloud.datastream_v1.types.ListRoutesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = datastream.ListRoutesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[datastream.ListRoutesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[datastream_resources.Route]: + async def async_generator(): + async for page in self.pages: + for response in page.routes: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/__init__.py b/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/__init__.py new file mode 100644 index 0000000..02599a2 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/__init__.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from collections import OrderedDict +from typing import Dict, Type + +from .base import DatastreamTransport +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 +_transport_registry['grpc_asyncio'] = DatastreamGrpcAsyncIOTransport + +__all__ = ( + 'DatastreamTransport', + 'DatastreamGrpcTransport', + 'DatastreamGrpcAsyncIOTransport', +) diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/base.py b/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/base.py new file mode 100644 index 0000000..dea0e3b --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/base.py @@ -0,0 +1,548 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import abc +from typing import Awaitable, Callable, Dict, Optional, Sequence, Union + +from google.cloud.datastream_v1 import gapic_version as package_version + +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 retry as retries +from google.api_core import operations_v1 +from google.auth import credentials as ga_credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.datastream_v1.types import datastream +from google.cloud.datastream_v1.types import datastream_resources +from google.cloud.location import locations_pb2 # type: ignore +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore +from google.longrunning import operations_pb2 +from google.longrunning import operations_pb2 # type: ignore + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) + + +class DatastreamTransport(abc.ABC): + """Abstract transport class for Datastream.""" + + AUTH_SCOPES = ( + 'https://www.googleapis.com/auth/cloud-platform', + ) + + DEFAULT_HOST: str = 'datastream.googleapis.com' + def __init__( + self, *, + host: str = DEFAULT_HOST, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + """ + + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} + + # Save the scopes. + self._scopes = scopes + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise core_exceptions.DuplicateCredentialArgs("'credentials_file' and 'credentials' are mutually exclusive") + + if credentials_file is not None: + credentials, _ = google.auth.load_credentials_from_file( + credentials_file, + **scopes_kwargs, + quota_project_id=quota_project_id + ) + elif credentials is None: + credentials, _ = google.auth.default(**scopes_kwargs, quota_project_id=quota_project_id) + # Don't apply audience if the credentials file passed from user. + if hasattr(credentials, "with_gdch_audience"): + credentials = credentials.with_gdch_audience(api_audience if api_audience else host) + + # If the credentials are service account credentials, then always try to use self signed JWT. + if always_use_jwt_access and isinstance(credentials, service_account.Credentials) and hasattr(service_account.Credentials, "with_always_use_jwt_access"): + credentials = credentials.with_always_use_jwt_access(True) + + # Save the credentials. + self._credentials = credentials + + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ':' not in host: + host += ':443' + self._host = host + + def _prep_wrapped_messages(self, client_info): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.list_connection_profiles: gapic_v1.method.wrap_method( + self.list_connection_profiles, + default_timeout=None, + client_info=client_info, + ), + self.get_connection_profile: gapic_v1.method.wrap_method( + self.get_connection_profile, + default_timeout=None, + client_info=client_info, + ), + self.create_connection_profile: gapic_v1.method.wrap_method( + self.create_connection_profile, + default_timeout=60.0, + client_info=client_info, + ), + self.update_connection_profile: gapic_v1.method.wrap_method( + self.update_connection_profile, + default_timeout=60.0, + client_info=client_info, + ), + self.delete_connection_profile: gapic_v1.method.wrap_method( + self.delete_connection_profile, + default_timeout=60.0, + client_info=client_info, + ), + self.discover_connection_profile: gapic_v1.method.wrap_method( + self.discover_connection_profile, + default_timeout=None, + client_info=client_info, + ), + self.list_streams: gapic_v1.method.wrap_method( + 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.create_stream: gapic_v1.method.wrap_method( + 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.delete_stream: gapic_v1.method.wrap_method( + 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.lookup_stream_object: gapic_v1.method.wrap_method( + self.lookup_stream_object, + default_timeout=None, + 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.start_backfill_job: gapic_v1.method.wrap_method( + 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.fetch_static_ips: gapic_v1.method.wrap_method( + self.fetch_static_ips, + default_timeout=None, + client_info=client_info, + ), + self.create_private_connection: gapic_v1.method.wrap_method( + self.create_private_connection, + default_timeout=60.0, + client_info=client_info, + ), + self.get_private_connection: gapic_v1.method.wrap_method( + self.get_private_connection, + default_timeout=None, + client_info=client_info, + ), + self.list_private_connections: gapic_v1.method.wrap_method( + self.list_private_connections, + default_timeout=None, + client_info=client_info, + ), + self.delete_private_connection: gapic_v1.method.wrap_method( + self.delete_private_connection, + default_timeout=60.0, + client_info=client_info, + ), + self.create_route: gapic_v1.method.wrap_method( + 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.list_routes: gapic_v1.method.wrap_method( + 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, + ), + } + + 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! + """ + raise NotImplementedError() + + @property + def operations_client(self): + """Return the client designed to process long-running operations.""" + raise NotImplementedError() + + @property + def list_connection_profiles(self) -> Callable[ + [datastream.ListConnectionProfilesRequest], + Union[ + datastream.ListConnectionProfilesResponse, + Awaitable[datastream.ListConnectionProfilesResponse] + ]]: + raise NotImplementedError() + + @property + def get_connection_profile(self) -> Callable[ + [datastream.GetConnectionProfileRequest], + Union[ + datastream_resources.ConnectionProfile, + Awaitable[datastream_resources.ConnectionProfile] + ]]: + raise NotImplementedError() + + @property + def create_connection_profile(self) -> Callable[ + [datastream.CreateConnectionProfileRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def update_connection_profile(self) -> Callable[ + [datastream.UpdateConnectionProfileRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def delete_connection_profile(self) -> Callable[ + [datastream.DeleteConnectionProfileRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def discover_connection_profile(self) -> Callable[ + [datastream.DiscoverConnectionProfileRequest], + Union[ + datastream.DiscoverConnectionProfileResponse, + Awaitable[datastream.DiscoverConnectionProfileResponse] + ]]: + raise NotImplementedError() + + @property + def list_streams(self) -> Callable[ + [datastream.ListStreamsRequest], + Union[ + datastream.ListStreamsResponse, + Awaitable[datastream.ListStreamsResponse] + ]]: + raise NotImplementedError() + + @property + def get_stream(self) -> Callable[ + [datastream.GetStreamRequest], + Union[ + datastream_resources.Stream, + Awaitable[datastream_resources.Stream] + ]]: + raise NotImplementedError() + + @property + def create_stream(self) -> Callable[ + [datastream.CreateStreamRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def update_stream(self) -> Callable[ + [datastream.UpdateStreamRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def delete_stream(self) -> Callable[ + [datastream.DeleteStreamRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def get_stream_object(self) -> Callable[ + [datastream.GetStreamObjectRequest], + Union[ + datastream_resources.StreamObject, + Awaitable[datastream_resources.StreamObject] + ]]: + raise NotImplementedError() + + @property + def lookup_stream_object(self) -> Callable[ + [datastream.LookupStreamObjectRequest], + Union[ + datastream_resources.StreamObject, + Awaitable[datastream_resources.StreamObject] + ]]: + raise NotImplementedError() + + @property + def list_stream_objects(self) -> Callable[ + [datastream.ListStreamObjectsRequest], + Union[ + datastream.ListStreamObjectsResponse, + Awaitable[datastream.ListStreamObjectsResponse] + ]]: + raise NotImplementedError() + + @property + def start_backfill_job(self) -> Callable[ + [datastream.StartBackfillJobRequest], + Union[ + datastream.StartBackfillJobResponse, + Awaitable[datastream.StartBackfillJobResponse] + ]]: + raise NotImplementedError() + + @property + def stop_backfill_job(self) -> Callable[ + [datastream.StopBackfillJobRequest], + Union[ + datastream.StopBackfillJobResponse, + Awaitable[datastream.StopBackfillJobResponse] + ]]: + raise NotImplementedError() + + @property + def fetch_static_ips(self) -> Callable[ + [datastream.FetchStaticIpsRequest], + Union[ + datastream.FetchStaticIpsResponse, + Awaitable[datastream.FetchStaticIpsResponse] + ]]: + raise NotImplementedError() + + @property + def create_private_connection(self) -> Callable[ + [datastream.CreatePrivateConnectionRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def get_private_connection(self) -> Callable[ + [datastream.GetPrivateConnectionRequest], + Union[ + datastream_resources.PrivateConnection, + Awaitable[datastream_resources.PrivateConnection] + ]]: + raise NotImplementedError() + + @property + def list_private_connections(self) -> Callable[ + [datastream.ListPrivateConnectionsRequest], + Union[ + datastream.ListPrivateConnectionsResponse, + Awaitable[datastream.ListPrivateConnectionsResponse] + ]]: + raise NotImplementedError() + + @property + def delete_private_connection(self) -> Callable[ + [datastream.DeletePrivateConnectionRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def create_route(self) -> Callable[ + [datastream.CreateRouteRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def get_route(self) -> Callable[ + [datastream.GetRouteRequest], + Union[ + datastream_resources.Route, + Awaitable[datastream_resources.Route] + ]]: + raise NotImplementedError() + + @property + def list_routes(self) -> Callable[ + [datastream.ListRoutesRequest], + Union[ + datastream.ListRoutesResponse, + Awaitable[datastream.ListRoutesResponse] + ]]: + raise NotImplementedError() + + @property + def delete_route(self) -> Callable[ + [datastream.DeleteRouteRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def list_operations( + self, + ) -> Callable[ + [operations_pb2.ListOperationsRequest], + Union[operations_pb2.ListOperationsResponse, Awaitable[operations_pb2.ListOperationsResponse]], + ]: + raise NotImplementedError() + + @property + def get_operation( + self, + ) -> Callable[ + [operations_pb2.GetOperationRequest], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], + ]: + raise NotImplementedError() + + @property + def cancel_operation( + self, + ) -> Callable[ + [operations_pb2.CancelOperationRequest], + None, + ]: + raise NotImplementedError() + + @property + def delete_operation( + self, + ) -> Callable[ + [operations_pb2.DeleteOperationRequest], + None, + ]: + raise NotImplementedError() + + @property + def get_location(self, + ) -> Callable[ + [locations_pb2.GetLocationRequest], + Union[locations_pb2.Location, Awaitable[locations_pb2.Location]], + ]: + raise NotImplementedError() + + @property + def list_locations(self, + ) -> Callable[ + [locations_pb2.ListLocationsRequest], + Union[locations_pb2.ListLocationsResponse, Awaitable[locations_pb2.ListLocationsResponse]], + ]: + raise NotImplementedError() + + @property + def kind(self) -> str: + raise NotImplementedError() + + +__all__ = ( + 'DatastreamTransport', +) diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/grpc.py b/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/grpc.py new file mode 100644 index 0000000..f9799be --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/grpc.py @@ -0,0 +1,1041 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple, Union + +from google.api_core import grpc_helpers +from google.api_core import operations_v1 +from google.api_core import gapic_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 + +import grpc # type: ignore + +from google.cloud.datastream_v1.types import datastream +from google.cloud.datastream_v1.types import datastream_resources +from google.cloud.location import locations_pb2 # type: ignore +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore +from google.longrunning import operations_pb2 +from google.longrunning import operations_pb2 # type: ignore +from .base import DatastreamTransport, DEFAULT_CLIENT_INFO + + +class DatastreamGrpcTransport(DatastreamTransport): + """gRPC backend transport for Datastream. + + Datastream service + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + _stubs: Dict[str, Callable] + + def __init__(self, *, + host: str = 'datastream.googleapis.com', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or application default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for the grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure a mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._grpc_channel = None + self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} + self._operations_client: Optional[operations_v1.OperationsClient] = None + + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + + if channel: + # Ignore credentials if a channel was passed. + credentials = False + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + + else: + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials + + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, + ) + + if not self._grpc_channel: + self._grpc_channel = type(self).create_channel( + self._host, + # use the credentials which are saved + credentials=self._credentials, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, + scopes=self._scopes, + ssl_credentials=self._ssl_channel_credentials, + quota_project_id=quota_project_id, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) + + @classmethod + def create_channel(cls, + host: str = 'datastream.googleapis.com', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + host (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + quota_project_id=quota_project_id, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, + **kwargs + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Return the channel designed to connect to this service. + """ + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Quick check: Only create a new client if we do not already have one. + if self._operations_client is None: + self._operations_client = operations_v1.OperationsClient( + self.grpc_channel + ) + + # Return the client from cache. + return self._operations_client + + @property + def list_connection_profiles(self) -> Callable[ + [datastream.ListConnectionProfilesRequest], + datastream.ListConnectionProfilesResponse]: + r"""Return a callable for the list connection profiles method over gRPC. + + Use this method to list connection profiles created + in a project and location. + + Returns: + Callable[[~.ListConnectionProfilesRequest], + ~.ListConnectionProfilesResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_connection_profiles' not in self._stubs: + self._stubs['list_connection_profiles'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/ListConnectionProfiles', + request_serializer=datastream.ListConnectionProfilesRequest.serialize, + response_deserializer=datastream.ListConnectionProfilesResponse.deserialize, + ) + return self._stubs['list_connection_profiles'] + + @property + def get_connection_profile(self) -> Callable[ + [datastream.GetConnectionProfileRequest], + datastream_resources.ConnectionProfile]: + r"""Return a callable for the get connection profile method over gRPC. + + Use this method to get details about a connection + profile. + + Returns: + Callable[[~.GetConnectionProfileRequest], + ~.ConnectionProfile]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_connection_profile' not in self._stubs: + self._stubs['get_connection_profile'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/GetConnectionProfile', + request_serializer=datastream.GetConnectionProfileRequest.serialize, + response_deserializer=datastream_resources.ConnectionProfile.deserialize, + ) + return self._stubs['get_connection_profile'] + + @property + def create_connection_profile(self) -> Callable[ + [datastream.CreateConnectionProfileRequest], + operations_pb2.Operation]: + r"""Return a callable for the create connection profile method over gRPC. + + Use this method to create a connection profile in a + project and location. + + Returns: + Callable[[~.CreateConnectionProfileRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_connection_profile' not in self._stubs: + self._stubs['create_connection_profile'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/CreateConnectionProfile', + request_serializer=datastream.CreateConnectionProfileRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_connection_profile'] + + @property + def update_connection_profile(self) -> Callable[ + [datastream.UpdateConnectionProfileRequest], + operations_pb2.Operation]: + r"""Return a callable for the update connection profile method over gRPC. + + Use this method to update the parameters of a + connection profile. + + Returns: + Callable[[~.UpdateConnectionProfileRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_connection_profile' not in self._stubs: + self._stubs['update_connection_profile'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/UpdateConnectionProfile', + request_serializer=datastream.UpdateConnectionProfileRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['update_connection_profile'] + + @property + def delete_connection_profile(self) -> Callable[ + [datastream.DeleteConnectionProfileRequest], + operations_pb2.Operation]: + r"""Return a callable for the delete connection profile method over gRPC. + + Use this method to delete a connection profile. + + Returns: + Callable[[~.DeleteConnectionProfileRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_connection_profile' not in self._stubs: + self._stubs['delete_connection_profile'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/DeleteConnectionProfile', + request_serializer=datastream.DeleteConnectionProfileRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['delete_connection_profile'] + + @property + def discover_connection_profile(self) -> Callable[ + [datastream.DiscoverConnectionProfileRequest], + datastream.DiscoverConnectionProfileResponse]: + r"""Return a callable for the discover connection profile method over gRPC. + + Use this method to discover a connection profile. + The discover API call exposes the data objects and + metadata belonging to the profile. Typically, a request + returns children data objects of a parent data object + that's optionally supplied in the request. + + Returns: + Callable[[~.DiscoverConnectionProfileRequest], + ~.DiscoverConnectionProfileResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'discover_connection_profile' not in self._stubs: + self._stubs['discover_connection_profile'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/DiscoverConnectionProfile', + request_serializer=datastream.DiscoverConnectionProfileRequest.serialize, + response_deserializer=datastream.DiscoverConnectionProfileResponse.deserialize, + ) + return self._stubs['discover_connection_profile'] + + @property + def list_streams(self) -> Callable[ + [datastream.ListStreamsRequest], + datastream.ListStreamsResponse]: + r"""Return a callable for the list streams method over gRPC. + + Use this method to list streams in a project and + location. + + Returns: + Callable[[~.ListStreamsRequest], + ~.ListStreamsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_streams' not in self._stubs: + self._stubs['list_streams'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/ListStreams', + request_serializer=datastream.ListStreamsRequest.serialize, + response_deserializer=datastream.ListStreamsResponse.deserialize, + ) + return self._stubs['list_streams'] + + @property + def get_stream(self) -> Callable[ + [datastream.GetStreamRequest], + datastream_resources.Stream]: + r"""Return a callable for the get stream method over gRPC. + + Use this method to get details about a stream. + + Returns: + Callable[[~.GetStreamRequest], + ~.Stream]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_stream' not in self._stubs: + self._stubs['get_stream'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/GetStream', + request_serializer=datastream.GetStreamRequest.serialize, + response_deserializer=datastream_resources.Stream.deserialize, + ) + return self._stubs['get_stream'] + + @property + def create_stream(self) -> Callable[ + [datastream.CreateStreamRequest], + operations_pb2.Operation]: + r"""Return a callable for the create stream method over gRPC. + + Use this method to create a stream. + + Returns: + Callable[[~.CreateStreamRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_stream' not in self._stubs: + self._stubs['create_stream'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/CreateStream', + request_serializer=datastream.CreateStreamRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_stream'] + + @property + def update_stream(self) -> Callable[ + [datastream.UpdateStreamRequest], + operations_pb2.Operation]: + r"""Return a callable for the update stream method over gRPC. + + Use this method to update the configuration of a + stream. + + Returns: + Callable[[~.UpdateStreamRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_stream' not in self._stubs: + self._stubs['update_stream'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/UpdateStream', + request_serializer=datastream.UpdateStreamRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['update_stream'] + + @property + def delete_stream(self) -> Callable[ + [datastream.DeleteStreamRequest], + operations_pb2.Operation]: + r"""Return a callable for the delete stream method over gRPC. + + Use this method to delete a stream. + + Returns: + Callable[[~.DeleteStreamRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_stream' not in self._stubs: + self._stubs['delete_stream'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/DeleteStream', + request_serializer=datastream.DeleteStreamRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['delete_stream'] + + @property + def get_stream_object(self) -> Callable[ + [datastream.GetStreamObjectRequest], + datastream_resources.StreamObject]: + r"""Return a callable for the get stream object method over gRPC. + + Use this method to get details about a stream object. + + Returns: + Callable[[~.GetStreamObjectRequest], + ~.StreamObject]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_stream_object' not in self._stubs: + self._stubs['get_stream_object'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/GetStreamObject', + request_serializer=datastream.GetStreamObjectRequest.serialize, + response_deserializer=datastream_resources.StreamObject.deserialize, + ) + return self._stubs['get_stream_object'] + + @property + def lookup_stream_object(self) -> Callable[ + [datastream.LookupStreamObjectRequest], + datastream_resources.StreamObject]: + r"""Return a callable for the lookup stream object method over gRPC. + + Use this method to look up a stream object by its + source object identifier. + + Returns: + Callable[[~.LookupStreamObjectRequest], + ~.StreamObject]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'lookup_stream_object' not in self._stubs: + self._stubs['lookup_stream_object'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/LookupStreamObject', + request_serializer=datastream.LookupStreamObjectRequest.serialize, + response_deserializer=datastream_resources.StreamObject.deserialize, + ) + return self._stubs['lookup_stream_object'] + + @property + def list_stream_objects(self) -> Callable[ + [datastream.ListStreamObjectsRequest], + datastream.ListStreamObjectsResponse]: + r"""Return a callable for the list stream objects method over gRPC. + + Use this method to list the objects of a specific + stream. + + Returns: + Callable[[~.ListStreamObjectsRequest], + ~.ListStreamObjectsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_stream_objects' not in self._stubs: + self._stubs['list_stream_objects'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/ListStreamObjects', + request_serializer=datastream.ListStreamObjectsRequest.serialize, + response_deserializer=datastream.ListStreamObjectsResponse.deserialize, + ) + return self._stubs['list_stream_objects'] + + @property + def start_backfill_job(self) -> Callable[ + [datastream.StartBackfillJobRequest], + datastream.StartBackfillJobResponse]: + r"""Return a callable for the start backfill job method over gRPC. + + Use this method to start a backfill job for the + specified stream object. + + Returns: + Callable[[~.StartBackfillJobRequest], + ~.StartBackfillJobResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'start_backfill_job' not in self._stubs: + self._stubs['start_backfill_job'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/StartBackfillJob', + request_serializer=datastream.StartBackfillJobRequest.serialize, + response_deserializer=datastream.StartBackfillJobResponse.deserialize, + ) + return self._stubs['start_backfill_job'] + + @property + def stop_backfill_job(self) -> Callable[ + [datastream.StopBackfillJobRequest], + datastream.StopBackfillJobResponse]: + r"""Return a callable for the stop backfill job method over gRPC. + + Use this method to stop a backfill job for the + specified stream object. + + Returns: + Callable[[~.StopBackfillJobRequest], + ~.StopBackfillJobResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'stop_backfill_job' not in self._stubs: + self._stubs['stop_backfill_job'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/StopBackfillJob', + request_serializer=datastream.StopBackfillJobRequest.serialize, + response_deserializer=datastream.StopBackfillJobResponse.deserialize, + ) + return self._stubs['stop_backfill_job'] + + @property + def fetch_static_ips(self) -> Callable[ + [datastream.FetchStaticIpsRequest], + datastream.FetchStaticIpsResponse]: + r"""Return a callable for the fetch static ips method over gRPC. + + The FetchStaticIps API call exposes the static IP + addresses used by Datastream. + + Returns: + Callable[[~.FetchStaticIpsRequest], + ~.FetchStaticIpsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'fetch_static_ips' not in self._stubs: + self._stubs['fetch_static_ips'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/FetchStaticIps', + request_serializer=datastream.FetchStaticIpsRequest.serialize, + response_deserializer=datastream.FetchStaticIpsResponse.deserialize, + ) + return self._stubs['fetch_static_ips'] + + @property + def create_private_connection(self) -> Callable[ + [datastream.CreatePrivateConnectionRequest], + operations_pb2.Operation]: + r"""Return a callable for the create private connection method over gRPC. + + Use this method to create a private connectivity + configuration. + + Returns: + Callable[[~.CreatePrivateConnectionRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_private_connection' not in self._stubs: + self._stubs['create_private_connection'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/CreatePrivateConnection', + request_serializer=datastream.CreatePrivateConnectionRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_private_connection'] + + @property + def get_private_connection(self) -> Callable[ + [datastream.GetPrivateConnectionRequest], + datastream_resources.PrivateConnection]: + r"""Return a callable for the get private connection method over gRPC. + + Use this method to get details about a private + connectivity configuration. + + Returns: + Callable[[~.GetPrivateConnectionRequest], + ~.PrivateConnection]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_private_connection' not in self._stubs: + self._stubs['get_private_connection'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/GetPrivateConnection', + request_serializer=datastream.GetPrivateConnectionRequest.serialize, + response_deserializer=datastream_resources.PrivateConnection.deserialize, + ) + return self._stubs['get_private_connection'] + + @property + def list_private_connections(self) -> Callable[ + [datastream.ListPrivateConnectionsRequest], + datastream.ListPrivateConnectionsResponse]: + r"""Return a callable for the list private connections method over gRPC. + + Use this method to list private connectivity + configurations in a project and location. + + Returns: + Callable[[~.ListPrivateConnectionsRequest], + ~.ListPrivateConnectionsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_private_connections' not in self._stubs: + self._stubs['list_private_connections'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/ListPrivateConnections', + request_serializer=datastream.ListPrivateConnectionsRequest.serialize, + response_deserializer=datastream.ListPrivateConnectionsResponse.deserialize, + ) + return self._stubs['list_private_connections'] + + @property + def delete_private_connection(self) -> Callable[ + [datastream.DeletePrivateConnectionRequest], + operations_pb2.Operation]: + r"""Return a callable for the delete private connection method over gRPC. + + Use this method to delete a private connectivity + configuration. + + Returns: + Callable[[~.DeletePrivateConnectionRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_private_connection' not in self._stubs: + self._stubs['delete_private_connection'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/DeletePrivateConnection', + request_serializer=datastream.DeletePrivateConnectionRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['delete_private_connection'] + + @property + def create_route(self) -> Callable[ + [datastream.CreateRouteRequest], + operations_pb2.Operation]: + r"""Return a callable for the create route method over gRPC. + + Use this method to create a route for a private + connectivity configuration in a project and location. + + Returns: + Callable[[~.CreateRouteRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_route' not in self._stubs: + self._stubs['create_route'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/CreateRoute', + request_serializer=datastream.CreateRouteRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_route'] + + @property + def get_route(self) -> Callable[ + [datastream.GetRouteRequest], + datastream_resources.Route]: + r"""Return a callable for the get route method over gRPC. + + Use this method to get details about a route. + + Returns: + Callable[[~.GetRouteRequest], + ~.Route]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_route' not in self._stubs: + self._stubs['get_route'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/GetRoute', + request_serializer=datastream.GetRouteRequest.serialize, + response_deserializer=datastream_resources.Route.deserialize, + ) + return self._stubs['get_route'] + + @property + def list_routes(self) -> Callable[ + [datastream.ListRoutesRequest], + datastream.ListRoutesResponse]: + r"""Return a callable for the list routes method over gRPC. + + Use this method to list routes created for a private + connectivity configuration in a project and location. + + Returns: + Callable[[~.ListRoutesRequest], + ~.ListRoutesResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_routes' not in self._stubs: + self._stubs['list_routes'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/ListRoutes', + request_serializer=datastream.ListRoutesRequest.serialize, + response_deserializer=datastream.ListRoutesResponse.deserialize, + ) + return self._stubs['list_routes'] + + @property + def delete_route(self) -> Callable[ + [datastream.DeleteRouteRequest], + operations_pb2.Operation]: + r"""Return a callable for the delete route method over gRPC. + + Use this method to delete a route. + + Returns: + Callable[[~.DeleteRouteRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_route' not in self._stubs: + self._stubs['delete_route'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/DeleteRoute', + request_serializer=datastream.DeleteRouteRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['delete_route'] + + def close(self): + self.grpc_channel.close() + + @property + def delete_operation( + self, + ) -> Callable[[operations_pb2.DeleteOperationRequest], None]: + r"""Return a callable for the delete_operation method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_operation" not in self._stubs: + self._stubs["delete_operation"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/DeleteOperation", + request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString, + response_deserializer=None, + ) + return self._stubs["delete_operation"] + + @property + def cancel_operation( + self, + ) -> Callable[[operations_pb2.CancelOperationRequest], None]: + r"""Return a callable for the cancel_operation method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "cancel_operation" not in self._stubs: + self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/CancelOperation", + request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, + response_deserializer=None, + ) + return self._stubs["cancel_operation"] + + @property + def get_operation( + self, + ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]: + r"""Return a callable for the get_operation method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_operation" not in self._stubs: + self._stubs["get_operation"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/GetOperation", + request_serializer=operations_pb2.GetOperationRequest.SerializeToString, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs["get_operation"] + + @property + def list_operations( + self, + ) -> Callable[[operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse]: + r"""Return a callable for the list_operations method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_operations" not in self._stubs: + self._stubs["list_operations"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/ListOperations", + request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, + response_deserializer=operations_pb2.ListOperationsResponse.FromString, + ) + return self._stubs["list_operations"] + + @property + def list_locations( + self, + ) -> Callable[[locations_pb2.ListLocationsRequest], locations_pb2.ListLocationsResponse]: + r"""Return a callable for the list locations method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_locations" not in self._stubs: + self._stubs["list_locations"] = self.grpc_channel.unary_unary( + "/google.cloud.location.Locations/ListLocations", + request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, + response_deserializer=locations_pb2.ListLocationsResponse.FromString, + ) + return self._stubs["list_locations"] + + @property + def get_location( + self, + ) -> Callable[[locations_pb2.GetLocationRequest], locations_pb2.Location]: + r"""Return a callable for the list locations method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_location" not in self._stubs: + self._stubs["get_location"] = self.grpc_channel.unary_unary( + "/google.cloud.location.Locations/GetLocation", + request_serializer=locations_pb2.GetLocationRequest.SerializeToString, + response_deserializer=locations_pb2.Location.FromString, + ) + return self._stubs["get_location"] + + @property + def kind(self) -> str: + return "grpc" + + +__all__ = ( + 'DatastreamGrpcTransport', +) diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/grpc_asyncio.py b/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/grpc_asyncio.py new file mode 100644 index 0000000..e61c3a2 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/grpc_asyncio.py @@ -0,0 +1,1040 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import warnings +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union + +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async +from google.api_core import operations_v1 +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # 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.cloud.location import locations_pb2 # type: ignore +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore +from google.longrunning import operations_pb2 +from google.longrunning import operations_pb2 # type: ignore +from .base import DatastreamTransport, DEFAULT_CLIENT_INFO +from .grpc import DatastreamGrpcTransport + + +class DatastreamGrpcAsyncIOTransport(DatastreamTransport): + """gRPC AsyncIO backend transport for Datastream. + + Datastream service + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel(cls, + host: str = 'datastream.googleapis.com', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + host (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + quota_project_id=quota_project_id, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, + **kwargs + ) + + def __init__(self, *, + host: str = 'datastream.googleapis.com', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or application default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for the grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure a mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._grpc_channel = None + self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} + self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None + + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + + if channel: + # Ignore credentials if a channel was passed. + credentials = False + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + else: + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials + + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, + ) + + if not self._grpc_channel: + self._grpc_channel = type(self).create_channel( + self._host, + # use the credentials which are saved + credentials=self._credentials, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, + scopes=self._scopes, + ssl_credentials=self._ssl_channel_credentials, + quota_project_id=quota_project_id, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Return the channel from cache. + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsAsyncClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Quick check: Only create a new client if we do not already have one. + if self._operations_client is None: + self._operations_client = operations_v1.OperationsAsyncClient( + self.grpc_channel + ) + + # Return the client from cache. + return self._operations_client + + @property + def list_connection_profiles(self) -> Callable[ + [datastream.ListConnectionProfilesRequest], + Awaitable[datastream.ListConnectionProfilesResponse]]: + r"""Return a callable for the list connection profiles method over gRPC. + + Use this method to list connection profiles created + in a project and location. + + Returns: + Callable[[~.ListConnectionProfilesRequest], + Awaitable[~.ListConnectionProfilesResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_connection_profiles' not in self._stubs: + self._stubs['list_connection_profiles'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/ListConnectionProfiles', + request_serializer=datastream.ListConnectionProfilesRequest.serialize, + response_deserializer=datastream.ListConnectionProfilesResponse.deserialize, + ) + return self._stubs['list_connection_profiles'] + + @property + def get_connection_profile(self) -> Callable[ + [datastream.GetConnectionProfileRequest], + Awaitable[datastream_resources.ConnectionProfile]]: + r"""Return a callable for the get connection profile method over gRPC. + + Use this method to get details about a connection + profile. + + Returns: + Callable[[~.GetConnectionProfileRequest], + Awaitable[~.ConnectionProfile]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_connection_profile' not in self._stubs: + self._stubs['get_connection_profile'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/GetConnectionProfile', + request_serializer=datastream.GetConnectionProfileRequest.serialize, + response_deserializer=datastream_resources.ConnectionProfile.deserialize, + ) + return self._stubs['get_connection_profile'] + + @property + def create_connection_profile(self) -> Callable[ + [datastream.CreateConnectionProfileRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the create connection profile method over gRPC. + + Use this method to create a connection profile in a + project and location. + + Returns: + Callable[[~.CreateConnectionProfileRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_connection_profile' not in self._stubs: + self._stubs['create_connection_profile'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/CreateConnectionProfile', + request_serializer=datastream.CreateConnectionProfileRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_connection_profile'] + + @property + def update_connection_profile(self) -> Callable[ + [datastream.UpdateConnectionProfileRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the update connection profile method over gRPC. + + Use this method to update the parameters of a + connection profile. + + Returns: + Callable[[~.UpdateConnectionProfileRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_connection_profile' not in self._stubs: + self._stubs['update_connection_profile'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/UpdateConnectionProfile', + request_serializer=datastream.UpdateConnectionProfileRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['update_connection_profile'] + + @property + def delete_connection_profile(self) -> Callable[ + [datastream.DeleteConnectionProfileRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the delete connection profile method over gRPC. + + Use this method to delete a connection profile. + + Returns: + Callable[[~.DeleteConnectionProfileRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_connection_profile' not in self._stubs: + self._stubs['delete_connection_profile'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/DeleteConnectionProfile', + request_serializer=datastream.DeleteConnectionProfileRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['delete_connection_profile'] + + @property + def discover_connection_profile(self) -> Callable[ + [datastream.DiscoverConnectionProfileRequest], + Awaitable[datastream.DiscoverConnectionProfileResponse]]: + r"""Return a callable for the discover connection profile method over gRPC. + + Use this method to discover a connection profile. + The discover API call exposes the data objects and + metadata belonging to the profile. Typically, a request + returns children data objects of a parent data object + that's optionally supplied in the request. + + Returns: + Callable[[~.DiscoverConnectionProfileRequest], + Awaitable[~.DiscoverConnectionProfileResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'discover_connection_profile' not in self._stubs: + self._stubs['discover_connection_profile'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/DiscoverConnectionProfile', + request_serializer=datastream.DiscoverConnectionProfileRequest.serialize, + response_deserializer=datastream.DiscoverConnectionProfileResponse.deserialize, + ) + return self._stubs['discover_connection_profile'] + + @property + def list_streams(self) -> Callable[ + [datastream.ListStreamsRequest], + Awaitable[datastream.ListStreamsResponse]]: + r"""Return a callable for the list streams method over gRPC. + + Use this method to list streams in a project and + location. + + Returns: + Callable[[~.ListStreamsRequest], + Awaitable[~.ListStreamsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_streams' not in self._stubs: + self._stubs['list_streams'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/ListStreams', + request_serializer=datastream.ListStreamsRequest.serialize, + response_deserializer=datastream.ListStreamsResponse.deserialize, + ) + return self._stubs['list_streams'] + + @property + def get_stream(self) -> Callable[ + [datastream.GetStreamRequest], + Awaitable[datastream_resources.Stream]]: + r"""Return a callable for the get stream method over gRPC. + + Use this method to get details about a stream. + + Returns: + Callable[[~.GetStreamRequest], + Awaitable[~.Stream]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_stream' not in self._stubs: + self._stubs['get_stream'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/GetStream', + request_serializer=datastream.GetStreamRequest.serialize, + response_deserializer=datastream_resources.Stream.deserialize, + ) + return self._stubs['get_stream'] + + @property + def create_stream(self) -> Callable[ + [datastream.CreateStreamRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the create stream method over gRPC. + + Use this method to create a stream. + + Returns: + Callable[[~.CreateStreamRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_stream' not in self._stubs: + self._stubs['create_stream'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/CreateStream', + request_serializer=datastream.CreateStreamRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_stream'] + + @property + def update_stream(self) -> Callable[ + [datastream.UpdateStreamRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the update stream method over gRPC. + + Use this method to update the configuration of a + stream. + + Returns: + Callable[[~.UpdateStreamRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_stream' not in self._stubs: + self._stubs['update_stream'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/UpdateStream', + request_serializer=datastream.UpdateStreamRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['update_stream'] + + @property + def delete_stream(self) -> Callable[ + [datastream.DeleteStreamRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the delete stream method over gRPC. + + Use this method to delete a stream. + + Returns: + Callable[[~.DeleteStreamRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_stream' not in self._stubs: + self._stubs['delete_stream'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/DeleteStream', + request_serializer=datastream.DeleteStreamRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['delete_stream'] + + @property + def get_stream_object(self) -> Callable[ + [datastream.GetStreamObjectRequest], + Awaitable[datastream_resources.StreamObject]]: + r"""Return a callable for the get stream object method over gRPC. + + Use this method to get details about a stream object. + + Returns: + Callable[[~.GetStreamObjectRequest], + Awaitable[~.StreamObject]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_stream_object' not in self._stubs: + self._stubs['get_stream_object'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/GetStreamObject', + request_serializer=datastream.GetStreamObjectRequest.serialize, + response_deserializer=datastream_resources.StreamObject.deserialize, + ) + return self._stubs['get_stream_object'] + + @property + def lookup_stream_object(self) -> Callable[ + [datastream.LookupStreamObjectRequest], + Awaitable[datastream_resources.StreamObject]]: + r"""Return a callable for the lookup stream object method over gRPC. + + Use this method to look up a stream object by its + source object identifier. + + Returns: + Callable[[~.LookupStreamObjectRequest], + Awaitable[~.StreamObject]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'lookup_stream_object' not in self._stubs: + self._stubs['lookup_stream_object'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/LookupStreamObject', + request_serializer=datastream.LookupStreamObjectRequest.serialize, + response_deserializer=datastream_resources.StreamObject.deserialize, + ) + return self._stubs['lookup_stream_object'] + + @property + def list_stream_objects(self) -> Callable[ + [datastream.ListStreamObjectsRequest], + Awaitable[datastream.ListStreamObjectsResponse]]: + r"""Return a callable for the list stream objects method over gRPC. + + Use this method to list the objects of a specific + stream. + + Returns: + Callable[[~.ListStreamObjectsRequest], + Awaitable[~.ListStreamObjectsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_stream_objects' not in self._stubs: + self._stubs['list_stream_objects'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/ListStreamObjects', + request_serializer=datastream.ListStreamObjectsRequest.serialize, + response_deserializer=datastream.ListStreamObjectsResponse.deserialize, + ) + return self._stubs['list_stream_objects'] + + @property + def start_backfill_job(self) -> Callable[ + [datastream.StartBackfillJobRequest], + Awaitable[datastream.StartBackfillJobResponse]]: + r"""Return a callable for the start backfill job method over gRPC. + + Use this method to start a backfill job for the + specified stream object. + + Returns: + Callable[[~.StartBackfillJobRequest], + Awaitable[~.StartBackfillJobResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'start_backfill_job' not in self._stubs: + self._stubs['start_backfill_job'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/StartBackfillJob', + request_serializer=datastream.StartBackfillJobRequest.serialize, + response_deserializer=datastream.StartBackfillJobResponse.deserialize, + ) + return self._stubs['start_backfill_job'] + + @property + def stop_backfill_job(self) -> Callable[ + [datastream.StopBackfillJobRequest], + Awaitable[datastream.StopBackfillJobResponse]]: + r"""Return a callable for the stop backfill job method over gRPC. + + Use this method to stop a backfill job for the + specified stream object. + + Returns: + Callable[[~.StopBackfillJobRequest], + Awaitable[~.StopBackfillJobResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'stop_backfill_job' not in self._stubs: + self._stubs['stop_backfill_job'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/StopBackfillJob', + request_serializer=datastream.StopBackfillJobRequest.serialize, + response_deserializer=datastream.StopBackfillJobResponse.deserialize, + ) + return self._stubs['stop_backfill_job'] + + @property + def fetch_static_ips(self) -> Callable[ + [datastream.FetchStaticIpsRequest], + Awaitable[datastream.FetchStaticIpsResponse]]: + r"""Return a callable for the fetch static ips method over gRPC. + + The FetchStaticIps API call exposes the static IP + addresses used by Datastream. + + Returns: + Callable[[~.FetchStaticIpsRequest], + Awaitable[~.FetchStaticIpsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'fetch_static_ips' not in self._stubs: + self._stubs['fetch_static_ips'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/FetchStaticIps', + request_serializer=datastream.FetchStaticIpsRequest.serialize, + response_deserializer=datastream.FetchStaticIpsResponse.deserialize, + ) + return self._stubs['fetch_static_ips'] + + @property + def create_private_connection(self) -> Callable[ + [datastream.CreatePrivateConnectionRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the create private connection method over gRPC. + + Use this method to create a private connectivity + configuration. + + Returns: + Callable[[~.CreatePrivateConnectionRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_private_connection' not in self._stubs: + self._stubs['create_private_connection'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/CreatePrivateConnection', + request_serializer=datastream.CreatePrivateConnectionRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_private_connection'] + + @property + def get_private_connection(self) -> Callable[ + [datastream.GetPrivateConnectionRequest], + Awaitable[datastream_resources.PrivateConnection]]: + r"""Return a callable for the get private connection method over gRPC. + + Use this method to get details about a private + connectivity configuration. + + Returns: + Callable[[~.GetPrivateConnectionRequest], + Awaitable[~.PrivateConnection]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_private_connection' not in self._stubs: + self._stubs['get_private_connection'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/GetPrivateConnection', + request_serializer=datastream.GetPrivateConnectionRequest.serialize, + response_deserializer=datastream_resources.PrivateConnection.deserialize, + ) + return self._stubs['get_private_connection'] + + @property + def list_private_connections(self) -> Callable[ + [datastream.ListPrivateConnectionsRequest], + Awaitable[datastream.ListPrivateConnectionsResponse]]: + r"""Return a callable for the list private connections method over gRPC. + + Use this method to list private connectivity + configurations in a project and location. + + Returns: + Callable[[~.ListPrivateConnectionsRequest], + Awaitable[~.ListPrivateConnectionsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_private_connections' not in self._stubs: + self._stubs['list_private_connections'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/ListPrivateConnections', + request_serializer=datastream.ListPrivateConnectionsRequest.serialize, + response_deserializer=datastream.ListPrivateConnectionsResponse.deserialize, + ) + return self._stubs['list_private_connections'] + + @property + def delete_private_connection(self) -> Callable[ + [datastream.DeletePrivateConnectionRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the delete private connection method over gRPC. + + Use this method to delete a private connectivity + configuration. + + Returns: + Callable[[~.DeletePrivateConnectionRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_private_connection' not in self._stubs: + self._stubs['delete_private_connection'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/DeletePrivateConnection', + request_serializer=datastream.DeletePrivateConnectionRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['delete_private_connection'] + + @property + def create_route(self) -> Callable[ + [datastream.CreateRouteRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the create route method over gRPC. + + Use this method to create a route for a private + connectivity configuration in a project and location. + + Returns: + Callable[[~.CreateRouteRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_route' not in self._stubs: + self._stubs['create_route'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/CreateRoute', + request_serializer=datastream.CreateRouteRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_route'] + + @property + def get_route(self) -> Callable[ + [datastream.GetRouteRequest], + Awaitable[datastream_resources.Route]]: + r"""Return a callable for the get route method over gRPC. + + Use this method to get details about a route. + + Returns: + Callable[[~.GetRouteRequest], + Awaitable[~.Route]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_route' not in self._stubs: + self._stubs['get_route'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/GetRoute', + request_serializer=datastream.GetRouteRequest.serialize, + response_deserializer=datastream_resources.Route.deserialize, + ) + return self._stubs['get_route'] + + @property + def list_routes(self) -> Callable[ + [datastream.ListRoutesRequest], + Awaitable[datastream.ListRoutesResponse]]: + r"""Return a callable for the list routes method over gRPC. + + Use this method to list routes created for a private + connectivity configuration in a project and location. + + Returns: + Callable[[~.ListRoutesRequest], + Awaitable[~.ListRoutesResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_routes' not in self._stubs: + self._stubs['list_routes'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/ListRoutes', + request_serializer=datastream.ListRoutesRequest.serialize, + response_deserializer=datastream.ListRoutesResponse.deserialize, + ) + return self._stubs['list_routes'] + + @property + def delete_route(self) -> Callable[ + [datastream.DeleteRouteRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the delete route method over gRPC. + + Use this method to delete a route. + + Returns: + Callable[[~.DeleteRouteRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_route' not in self._stubs: + self._stubs['delete_route'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1.Datastream/DeleteRoute', + request_serializer=datastream.DeleteRouteRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['delete_route'] + + def close(self): + return self.grpc_channel.close() + + @property + def delete_operation( + self, + ) -> Callable[[operations_pb2.DeleteOperationRequest], None]: + r"""Return a callable for the delete_operation method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_operation" not in self._stubs: + self._stubs["delete_operation"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/DeleteOperation", + request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString, + response_deserializer=None, + ) + return self._stubs["delete_operation"] + + @property + def cancel_operation( + self, + ) -> Callable[[operations_pb2.CancelOperationRequest], None]: + r"""Return a callable for the cancel_operation method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "cancel_operation" not in self._stubs: + self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/CancelOperation", + request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, + response_deserializer=None, + ) + return self._stubs["cancel_operation"] + + @property + def get_operation( + self, + ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]: + r"""Return a callable for the get_operation method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_operation" not in self._stubs: + self._stubs["get_operation"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/GetOperation", + request_serializer=operations_pb2.GetOperationRequest.SerializeToString, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs["get_operation"] + + @property + def list_operations( + self, + ) -> Callable[[operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse]: + r"""Return a callable for the list_operations method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_operations" not in self._stubs: + self._stubs["list_operations"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/ListOperations", + request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, + response_deserializer=operations_pb2.ListOperationsResponse.FromString, + ) + return self._stubs["list_operations"] + + @property + def list_locations( + self, + ) -> Callable[[locations_pb2.ListLocationsRequest], locations_pb2.ListLocationsResponse]: + r"""Return a callable for the list locations method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_locations" not in self._stubs: + self._stubs["list_locations"] = self.grpc_channel.unary_unary( + "/google.cloud.location.Locations/ListLocations", + request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, + response_deserializer=locations_pb2.ListLocationsResponse.FromString, + ) + return self._stubs["list_locations"] + + @property + def get_location( + self, + ) -> Callable[[locations_pb2.GetLocationRequest], locations_pb2.Location]: + r"""Return a callable for the list locations method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_location" not in self._stubs: + self._stubs["get_location"] = self.grpc_channel.unary_unary( + "/google.cloud.location.Locations/GetLocation", + request_serializer=locations_pb2.GetLocationRequest.SerializeToString, + response_deserializer=locations_pb2.Location.FromString, + ) + return self._stubs["get_location"] + + +__all__ = ( + 'DatastreamGrpcAsyncIOTransport', +) diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/types/__init__.py b/owl-bot-staging/v1/google/cloud/datastream_v1/types/__init__.py new file mode 100644 index 0000000..54abed0 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/datastream_v1/types/__init__.py @@ -0,0 +1,176 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from .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 .datastream_resources import ( + AvroFileFormat, + BackfillJob, + BigQueryDestinationConfig, + BigQueryProfile, + ConnectionProfile, + DestinationConfig, + Error, + ForwardSshTunnelConnectivity, + GcsDestinationConfig, + GcsProfile, + JsonFileFormat, + MysqlColumn, + MysqlDatabase, + MysqlProfile, + MysqlRdbms, + MysqlSourceConfig, + MysqlSslConfig, + MysqlTable, + OracleColumn, + OracleProfile, + OracleRdbms, + OracleSchema, + OracleSourceConfig, + OracleTable, + PostgresqlColumn, + PostgresqlProfile, + PostgresqlRdbms, + PostgresqlSchema, + PostgresqlSourceConfig, + PostgresqlTable, + PrivateConnection, + PrivateConnectivity, + Route, + SourceConfig, + SourceObjectIdentifier, + StaticServiceIpConnectivity, + Stream, + StreamObject, + Validation, + ValidationMessage, + ValidationResult, + VpcPeeringConfig, +) + +__all__ = ( + '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', + 'AvroFileFormat', + 'BackfillJob', + 'BigQueryDestinationConfig', + 'BigQueryProfile', + 'ConnectionProfile', + 'DestinationConfig', + 'Error', + 'ForwardSshTunnelConnectivity', + 'GcsDestinationConfig', + 'GcsProfile', + 'JsonFileFormat', + 'MysqlColumn', + 'MysqlDatabase', + 'MysqlProfile', + 'MysqlRdbms', + 'MysqlSourceConfig', + 'MysqlSslConfig', + 'MysqlTable', + 'OracleColumn', + 'OracleProfile', + 'OracleRdbms', + 'OracleSchema', + 'OracleSourceConfig', + 'OracleTable', + 'PostgresqlColumn', + 'PostgresqlProfile', + 'PostgresqlRdbms', + 'PostgresqlSchema', + 'PostgresqlSourceConfig', + 'PostgresqlTable', + 'PrivateConnection', + 'PrivateConnectivity', + 'Route', + 'SourceConfig', + 'SourceObjectIdentifier', + 'StaticServiceIpConnectivity', + 'Stream', + 'StreamObject', + 'Validation', + 'ValidationMessage', + 'ValidationResult', + 'VpcPeeringConfig', +) diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/types/datastream.py b/owl-bot-staging/v1/google/cloud/datastream_v1/types/datastream.py new file mode 100644 index 0000000..d4214ab --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/datastream_v1/types/datastream.py @@ -0,0 +1,1401 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from typing import MutableMapping, MutableSequence + +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 + + +__protobuf__ = proto.module( + package='google.cloud.datastream.v1', + manifest={ + 'DiscoverConnectionProfileRequest', + 'DiscoverConnectionProfileResponse', + 'FetchStaticIpsRequest', + 'FetchStaticIpsResponse', + 'ListConnectionProfilesRequest', + 'ListConnectionProfilesResponse', + 'GetConnectionProfileRequest', + 'CreateConnectionProfileRequest', + 'UpdateConnectionProfileRequest', + 'DeleteConnectionProfileRequest', + 'ListStreamsRequest', + 'ListStreamsResponse', + 'GetStreamRequest', + 'CreateStreamRequest', + 'UpdateStreamRequest', + 'DeleteStreamRequest', + 'GetStreamObjectRequest', + 'LookupStreamObjectRequest', + 'StartBackfillJobRequest', + 'StartBackfillJobResponse', + 'StopBackfillJobRequest', + 'StopBackfillJobResponse', + 'ListStreamObjectsRequest', + 'ListStreamObjectsResponse', + 'OperationMetadata', + 'CreatePrivateConnectionRequest', + 'ListPrivateConnectionsRequest', + 'ListPrivateConnectionsResponse', + 'DeletePrivateConnectionRequest', + 'GetPrivateConnectionRequest', + 'CreateRouteRequest', + 'ListRoutesRequest', + 'ListRoutesResponse', + 'DeleteRouteRequest', + 'GetRouteRequest', + }, +) + + +class DiscoverConnectionProfileRequest(proto.Message): + r"""Request message for 'discover' ConnectionProfile request. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + parent (str): + Required. The parent resource of the connection profile + type. Must be in the format ``projects/*/locations/*``. + connection_profile (google.cloud.datastream_v1.types.ConnectionProfile): + An ad-hoc connection profile configuration. + + This field is a member of `oneof`_ ``target``. + connection_profile_name (str): + A reference to an existing connection + profile. + + This field is a member of `oneof`_ ``target``. + full_hierarchy (bool): + Whether to retrieve the full hierarchy of + data objects (TRUE) or only the current level + (FALSE). + + This field is a member of `oneof`_ ``hierarchy``. + hierarchy_depth (int): + The number of hierarchy levels below the + current level to be retrieved. + + This field is a member of `oneof`_ ``hierarchy``. + oracle_rdbms (google.cloud.datastream_v1.types.OracleRdbms): + Oracle RDBMS to enrich with child data + objects and metadata. + + This field is a member of `oneof`_ ``data_object``. + mysql_rdbms (google.cloud.datastream_v1.types.MysqlRdbms): + MySQL RDBMS to enrich with child data objects + and metadata. + + This field is a member of `oneof`_ ``data_object``. + postgresql_rdbms (google.cloud.datastream_v1.types.PostgresqlRdbms): + PostgreSQL RDBMS to enrich with child data + objects and metadata. + + This field is a member of `oneof`_ ``data_object``. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + connection_profile: datastream_resources.ConnectionProfile = proto.Field( + proto.MESSAGE, + number=200, + oneof='target', + message=datastream_resources.ConnectionProfile, + ) + connection_profile_name: str = proto.Field( + proto.STRING, + number=201, + oneof='target', + ) + full_hierarchy: bool = proto.Field( + proto.BOOL, + number=3, + oneof='hierarchy', + ) + hierarchy_depth: int = proto.Field( + proto.INT32, + number=4, + oneof='hierarchy', + ) + oracle_rdbms: datastream_resources.OracleRdbms = proto.Field( + proto.MESSAGE, + number=100, + oneof='data_object', + message=datastream_resources.OracleRdbms, + ) + mysql_rdbms: datastream_resources.MysqlRdbms = proto.Field( + proto.MESSAGE, + number=101, + oneof='data_object', + message=datastream_resources.MysqlRdbms, + ) + postgresql_rdbms: datastream_resources.PostgresqlRdbms = proto.Field( + proto.MESSAGE, + number=102, + oneof='data_object', + message=datastream_resources.PostgresqlRdbms, + ) + + +class DiscoverConnectionProfileResponse(proto.Message): + r"""Response from a discover request. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + oracle_rdbms (google.cloud.datastream_v1.types.OracleRdbms): + Enriched Oracle RDBMS object. + + This field is a member of `oneof`_ ``data_object``. + mysql_rdbms (google.cloud.datastream_v1.types.MysqlRdbms): + Enriched MySQL RDBMS object. + + This field is a member of `oneof`_ ``data_object``. + postgresql_rdbms (google.cloud.datastream_v1.types.PostgresqlRdbms): + Enriched PostgreSQL RDBMS object. + + This field is a member of `oneof`_ ``data_object``. + """ + + oracle_rdbms: datastream_resources.OracleRdbms = proto.Field( + proto.MESSAGE, + number=100, + oneof='data_object', + message=datastream_resources.OracleRdbms, + ) + mysql_rdbms: datastream_resources.MysqlRdbms = proto.Field( + proto.MESSAGE, + number=101, + oneof='data_object', + message=datastream_resources.MysqlRdbms, + ) + postgresql_rdbms: datastream_resources.PostgresqlRdbms = proto.Field( + proto.MESSAGE, + number=102, + oneof='data_object', + message=datastream_resources.PostgresqlRdbms, + ) + + +class FetchStaticIpsRequest(proto.Message): + r"""Request message for 'FetchStaticIps' request. + + Attributes: + name (str): + Required. The resource name for the location for which + static IPs should be returned. Must be in the format + ``projects/*/locations/*``. + page_size (int): + Maximum number of Ips to return, will likely + not be specified. + page_token (str): + A page token, received from a previous ``ListStaticIps`` + call. will likely not be specified. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + page_size: int = proto.Field( + proto.INT32, + number=2, + ) + page_token: str = proto.Field( + proto.STRING, + number=3, + ) + + +class FetchStaticIpsResponse(proto.Message): + r"""Response message for a 'FetchStaticIps' response. + + Attributes: + static_ips (MutableSequence[str]): + list of static ips by account + next_page_token (str): + A token that can be sent as ``page_token`` to retrieve the + next page. If this field is omitted, there are no subsequent + pages. + """ + + @property + def raw_page(self): + return self + + static_ips: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=1, + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + + +class ListConnectionProfilesRequest(proto.Message): + r"""Request message for listing connection profiles. + + Attributes: + parent (str): + Required. The parent that owns the collection + of connection profiles. + page_size (int): + Maximum number of connection profiles to + return. If unspecified, at most 50 connection + profiles will be returned. The maximum value is + 1000; values above 1000 will be coerced to 1000. + page_token (str): + Page token received from a previous + ``ListConnectionProfiles`` call. Provide this to retrieve + the subsequent page. + + When paginating, all other parameters provided to + ``ListConnectionProfiles`` must match the call that provided + the page token. + filter (str): + Filter request. + order_by (str): + Order by fields for the result. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + page_size: int = proto.Field( + proto.INT32, + number=2, + ) + page_token: str = proto.Field( + proto.STRING, + number=3, + ) + filter: str = proto.Field( + proto.STRING, + number=4, + ) + order_by: str = proto.Field( + proto.STRING, + number=5, + ) + + +class ListConnectionProfilesResponse(proto.Message): + r"""Response message for listing connection profiles. + + Attributes: + connection_profiles (MutableSequence[google.cloud.datastream_v1.types.ConnectionProfile]): + List of connection profiles. + next_page_token (str): + A token, which can be sent as ``page_token`` to retrieve the + next page. If this field is omitted, there are no subsequent + pages. + unreachable (MutableSequence[str]): + Locations that could not be reached. + """ + + @property + def raw_page(self): + return self + + connection_profiles: MutableSequence[datastream_resources.ConnectionProfile] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=datastream_resources.ConnectionProfile, + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + unreachable: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + + +class GetConnectionProfileRequest(proto.Message): + r"""Request message for getting a connection profile. + + Attributes: + name (str): + Required. The name of the connection profile + resource to get. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class CreateConnectionProfileRequest(proto.Message): + r"""Request message for creating a connection profile. + + Attributes: + parent (str): + Required. The parent that owns the collection + of ConnectionProfiles. + connection_profile_id (str): + Required. The connection profile identifier. + connection_profile (google.cloud.datastream_v1.types.ConnectionProfile): + Required. The connection profile resource to + create. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes since the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + validate_only (bool): + Optional. Only validate the connection + profile, but don't create any resources. The + default is false. + force (bool): + Optional. Create the connection profile + without validating it. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + connection_profile_id: str = proto.Field( + proto.STRING, + number=2, + ) + connection_profile: datastream_resources.ConnectionProfile = proto.Field( + proto.MESSAGE, + number=3, + message=datastream_resources.ConnectionProfile, + ) + request_id: str = proto.Field( + proto.STRING, + number=4, + ) + validate_only: bool = proto.Field( + proto.BOOL, + number=5, + ) + force: bool = proto.Field( + proto.BOOL, + number=6, + ) + + +class UpdateConnectionProfileRequest(proto.Message): + r"""Connection profile update message. + + Attributes: + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Optional. Field mask is used to specify the fields to be + overwritten in the ConnectionProfile resource by the update. + The fields specified in the update_mask are relative to the + resource, not the full request. A field will be overwritten + if it is in the mask. If the user does not provide a mask + then all fields will be overwritten. + connection_profile (google.cloud.datastream_v1.types.ConnectionProfile): + Required. The connection profile to update. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes since the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + validate_only (bool): + Optional. Only validate the connection + profile, but don't update any resources. The + default is false. + force (bool): + Optional. Update the connection profile + without validating it. + """ + + update_mask: field_mask_pb2.FieldMask = proto.Field( + proto.MESSAGE, + number=1, + message=field_mask_pb2.FieldMask, + ) + connection_profile: datastream_resources.ConnectionProfile = proto.Field( + proto.MESSAGE, + number=2, + message=datastream_resources.ConnectionProfile, + ) + request_id: str = proto.Field( + proto.STRING, + number=3, + ) + validate_only: bool = proto.Field( + proto.BOOL, + number=4, + ) + force: bool = proto.Field( + proto.BOOL, + number=5, + ) + + +class DeleteConnectionProfileRequest(proto.Message): + r"""Request message for deleting a connection profile. + + Attributes: + name (str): + Required. The name of the connection profile + resource to delete. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes after the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + request_id: str = proto.Field( + proto.STRING, + number=2, + ) + + +class ListStreamsRequest(proto.Message): + r"""Request message for listing streams. + + Attributes: + parent (str): + Required. The parent that owns the collection + of streams. + page_size (int): + Maximum number of streams to return. + If unspecified, at most 50 streams will be + returned. The maximum value is 1000; values + above 1000 will be coerced to 1000. + page_token (str): + Page token received from a previous ``ListStreams`` call. + Provide this to retrieve the subsequent page. + + When paginating, all other parameters provided to + ``ListStreams`` must match the call that provided the page + token. + filter (str): + Filter request. + order_by (str): + Order by fields for the result. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + page_size: int = proto.Field( + proto.INT32, + number=2, + ) + page_token: str = proto.Field( + proto.STRING, + number=3, + ) + filter: str = proto.Field( + proto.STRING, + number=4, + ) + order_by: str = proto.Field( + proto.STRING, + number=5, + ) + + +class ListStreamsResponse(proto.Message): + r"""Response message for listing streams. + + Attributes: + streams (MutableSequence[google.cloud.datastream_v1.types.Stream]): + List of streams + next_page_token (str): + A token, which can be sent as ``page_token`` to retrieve the + next page. If this field is omitted, there are no subsequent + pages. + unreachable (MutableSequence[str]): + Locations that could not be reached. + """ + + @property + def raw_page(self): + return self + + streams: MutableSequence[datastream_resources.Stream] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=datastream_resources.Stream, + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + unreachable: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + + +class GetStreamRequest(proto.Message): + r"""Request message for getting a stream. + + Attributes: + name (str): + Required. The name of the stream resource to + get. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class CreateStreamRequest(proto.Message): + r"""Request message for creating a stream. + + Attributes: + parent (str): + Required. The parent that owns the collection + of streams. + stream_id (str): + Required. The stream identifier. + stream (google.cloud.datastream_v1.types.Stream): + Required. The stream resource to create. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes since the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + validate_only (bool): + Optional. Only validate the stream, but don't + create any resources. The default is false. + force (bool): + Optional. Create the stream without + validating it. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + stream_id: str = proto.Field( + proto.STRING, + number=2, + ) + stream: datastream_resources.Stream = proto.Field( + proto.MESSAGE, + number=3, + message=datastream_resources.Stream, + ) + request_id: str = proto.Field( + proto.STRING, + number=4, + ) + validate_only: bool = proto.Field( + proto.BOOL, + number=5, + ) + force: bool = proto.Field( + proto.BOOL, + number=6, + ) + + +class UpdateStreamRequest(proto.Message): + r"""Request message for updating a stream. + + Attributes: + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Optional. Field mask is used to specify the fields to be + overwritten in the stream resource by the update. The fields + specified in the update_mask are relative to the resource, + not the full request. A field will be overwritten if it is + in the mask. If the user does not provide a mask then all + fields will be overwritten. + stream (google.cloud.datastream_v1.types.Stream): + Required. The stream resource to update. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes since the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + validate_only (bool): + Optional. Only validate the stream with the + changes, without actually updating it. The + default is false. + force (bool): + Optional. Update the stream without + validating it. + """ + + update_mask: field_mask_pb2.FieldMask = proto.Field( + proto.MESSAGE, + number=1, + message=field_mask_pb2.FieldMask, + ) + stream: datastream_resources.Stream = proto.Field( + proto.MESSAGE, + number=2, + message=datastream_resources.Stream, + ) + request_id: str = proto.Field( + proto.STRING, + number=3, + ) + validate_only: bool = proto.Field( + proto.BOOL, + number=4, + ) + force: bool = proto.Field( + proto.BOOL, + number=5, + ) + + +class DeleteStreamRequest(proto.Message): + r"""Request message for deleting a stream. + + Attributes: + name (str): + Required. The name of the stream resource to + delete. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes after the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + request_id: str = proto.Field( + proto.STRING, + number=2, + ) + + +class GetStreamObjectRequest(proto.Message): + r"""Request for fetching a specific stream object. + + Attributes: + name (str): + Required. The name of the stream object + resource to get. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class LookupStreamObjectRequest(proto.Message): + r"""Request for looking up a specific stream object by its source + object identifier. + + Attributes: + parent (str): + Required. The parent stream that owns the + collection of objects. + source_object_identifier (google.cloud.datastream_v1.types.SourceObjectIdentifier): + Required. The source object identifier which + maps to the stream object. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + source_object_identifier: datastream_resources.SourceObjectIdentifier = proto.Field( + proto.MESSAGE, + number=2, + message=datastream_resources.SourceObjectIdentifier, + ) + + +class StartBackfillJobRequest(proto.Message): + r"""Request for manually initiating a backfill job for a specific + stream object. + + Attributes: + object_ (str): + Required. The name of the stream object + resource to start a backfill job for. + """ + + object_: str = proto.Field( + proto.STRING, + number=1, + ) + + +class StartBackfillJobResponse(proto.Message): + r"""Response for manually initiating a backfill job for a + specific stream object. + + Attributes: + object_ (google.cloud.datastream_v1.types.StreamObject): + The stream object resource a backfill job was + started for. + """ + + object_: datastream_resources.StreamObject = proto.Field( + proto.MESSAGE, + number=1, + message=datastream_resources.StreamObject, + ) + + +class StopBackfillJobRequest(proto.Message): + r"""Request for manually stopping a running backfill job for a + specific stream object. + + Attributes: + object_ (str): + Required. The name of the stream object + resource to stop the backfill job for. + """ + + object_: str = proto.Field( + proto.STRING, + number=1, + ) + + +class StopBackfillJobResponse(proto.Message): + r"""Response for manually stop a backfill job for a specific + stream object. + + Attributes: + object_ (google.cloud.datastream_v1.types.StreamObject): + The stream object resource the backfill job + was stopped for. + """ + + object_: datastream_resources.StreamObject = proto.Field( + proto.MESSAGE, + number=1, + message=datastream_resources.StreamObject, + ) + + +class ListStreamObjectsRequest(proto.Message): + r"""Request for listing all objects for a specific stream. + + Attributes: + parent (str): + Required. The parent stream that owns the + collection of objects. + page_size (int): + Maximum number of objects to return. Default + is 50. The maximum value is 1000; values above + 1000 will be coerced to 1000. + page_token (str): + Page token received from a previous + ``ListStreamObjectsRequest`` call. Provide this to retrieve + the subsequent page. + + When paginating, all other parameters provided to + ``ListStreamObjectsRequest`` must match the call that + provided the page token. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + page_size: int = proto.Field( + proto.INT32, + number=2, + ) + page_token: str = proto.Field( + proto.STRING, + number=3, + ) + + +class ListStreamObjectsResponse(proto.Message): + r"""Response containing the objects for a stream. + + Attributes: + stream_objects (MutableSequence[google.cloud.datastream_v1.types.StreamObject]): + List of stream objects. + next_page_token (str): + A token, which can be sent as ``page_token`` to retrieve the + next page. + """ + + @property + def raw_page(self): + return self + + stream_objects: MutableSequence[datastream_resources.StreamObject] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=datastream_resources.StreamObject, + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + + +class OperationMetadata(proto.Message): + r"""Represents the metadata of the long-running operation. + + Attributes: + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time the operation was + created. + end_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time the operation finished + running. + target (str): + Output only. Server-defined resource path for + the target of the operation. + verb (str): + Output only. Name of the verb executed by the + operation. + status_message (str): + Output only. Human-readable status of the + operation, if any. + requested_cancellation (bool): + Output only. Identifies whether the user has requested + cancellation of the operation. Operations that have + successfully been cancelled have [Operation.error][] value + with a [google.rpc.Status.code][google.rpc.Status.code] of + 1, corresponding to ``Code.CANCELLED``. + api_version (str): + Output only. API version used to start the + operation. + validation_result (google.cloud.datastream_v1.types.ValidationResult): + Output only. Results of executed validations + if there are any. + """ + + create_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + end_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + target: str = proto.Field( + proto.STRING, + number=3, + ) + verb: str = proto.Field( + proto.STRING, + number=4, + ) + status_message: str = proto.Field( + proto.STRING, + number=5, + ) + requested_cancellation: bool = proto.Field( + proto.BOOL, + number=6, + ) + api_version: str = proto.Field( + proto.STRING, + number=7, + ) + validation_result: datastream_resources.ValidationResult = proto.Field( + proto.MESSAGE, + number=8, + message=datastream_resources.ValidationResult, + ) + + +class CreatePrivateConnectionRequest(proto.Message): + r"""Request for creating a private connection. + + Attributes: + parent (str): + Required. The parent that owns the collection + of PrivateConnections. + private_connection_id (str): + Required. The private connectivity + identifier. + private_connection (google.cloud.datastream_v1.types.PrivateConnection): + Required. The Private Connectivity resource + to create. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes since the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + private_connection_id: str = proto.Field( + proto.STRING, + number=2, + ) + private_connection: datastream_resources.PrivateConnection = proto.Field( + proto.MESSAGE, + number=3, + message=datastream_resources.PrivateConnection, + ) + request_id: str = proto.Field( + proto.STRING, + number=4, + ) + + +class ListPrivateConnectionsRequest(proto.Message): + r"""Request for listing private connections. + + Attributes: + parent (str): + Required. The parent that owns the collection + of private connectivity configurations. + page_size (int): + Maximum number of private connectivity + configurations to return. If unspecified, at + most 50 private connectivity configurations that + will be returned. The maximum value is 1000; + values above 1000 will be coerced to 1000. + page_token (str): + Page token received from a previous + ``ListPrivateConnections`` call. Provide this to retrieve + the subsequent page. + + When paginating, all other parameters provided to + ``ListPrivateConnections`` must match the call that provided + the page token. + filter (str): + Filter request. + order_by (str): + Order by fields for the result. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + page_size: int = proto.Field( + proto.INT32, + number=2, + ) + page_token: str = proto.Field( + proto.STRING, + number=3, + ) + filter: str = proto.Field( + proto.STRING, + number=4, + ) + order_by: str = proto.Field( + proto.STRING, + number=5, + ) + + +class ListPrivateConnectionsResponse(proto.Message): + r"""Response containing a list of private connection + configurations. + + Attributes: + private_connections (MutableSequence[google.cloud.datastream_v1.types.PrivateConnection]): + List of private connectivity configurations. + next_page_token (str): + A token, which can be sent as ``page_token`` to retrieve the + next page. If this field is omitted, there are no subsequent + pages. + unreachable (MutableSequence[str]): + Locations that could not be reached. + """ + + @property + def raw_page(self): + return self + + private_connections: MutableSequence[datastream_resources.PrivateConnection] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=datastream_resources.PrivateConnection, + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + unreachable: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + + +class DeletePrivateConnectionRequest(proto.Message): + r"""Request to delete a private connection. + + Attributes: + name (str): + Required. The name of the private + connectivity configuration to delete. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes after the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + force (bool): + Optional. If set to true, any child routes + that belong to this PrivateConnection will also + be deleted. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + request_id: str = proto.Field( + proto.STRING, + number=2, + ) + force: bool = proto.Field( + proto.BOOL, + number=3, + ) + + +class GetPrivateConnectionRequest(proto.Message): + r"""Request to get a private connection configuration. + + Attributes: + name (str): + Required. The name of the private + connectivity configuration to get. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class CreateRouteRequest(proto.Message): + r"""Route creation request. + + Attributes: + parent (str): + Required. The parent that owns the collection + of Routes. + route_id (str): + Required. The Route identifier. + route (google.cloud.datastream_v1.types.Route): + Required. The Route resource to create. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes since the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + route_id: str = proto.Field( + proto.STRING, + number=2, + ) + route: datastream_resources.Route = proto.Field( + proto.MESSAGE, + number=3, + message=datastream_resources.Route, + ) + request_id: str = proto.Field( + proto.STRING, + number=4, + ) + + +class ListRoutesRequest(proto.Message): + r"""Route list request. + + Attributes: + parent (str): + Required. The parent that owns the collection + of Routess. + page_size (int): + Maximum number of Routes to return. The + service may return fewer than this value. If + unspecified, at most 50 Routes will be returned. + The maximum value is 1000; values above 1000 + will be coerced to 1000. + page_token (str): + Page token received from a previous ``ListRoutes`` call. + Provide this to retrieve the subsequent page. + + When paginating, all other parameters provided to + ``ListRoutes`` must match the call that provided the page + token. + filter (str): + Filter request. + order_by (str): + Order by fields for the result. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + page_size: int = proto.Field( + proto.INT32, + number=2, + ) + page_token: str = proto.Field( + proto.STRING, + number=3, + ) + filter: str = proto.Field( + proto.STRING, + number=4, + ) + order_by: str = proto.Field( + proto.STRING, + number=5, + ) + + +class ListRoutesResponse(proto.Message): + r"""Route list response. + + Attributes: + routes (MutableSequence[google.cloud.datastream_v1.types.Route]): + List of Routes. + next_page_token (str): + A token, which can be sent as ``page_token`` to retrieve the + next page. If this field is omitted, there are no subsequent + pages. + unreachable (MutableSequence[str]): + Locations that could not be reached. + """ + + @property + def raw_page(self): + return self + + routes: MutableSequence[datastream_resources.Route] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=datastream_resources.Route, + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + unreachable: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + + +class DeleteRouteRequest(proto.Message): + r"""Route deletion request. + + Attributes: + name (str): + Required. The name of the Route resource to + delete. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes after the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + request_id: str = proto.Field( + proto.STRING, + number=2, + ) + + +class GetRouteRequest(proto.Message): + r"""Route get request. + + Attributes: + name (str): + Required. The name of the Route resource to + get. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/types/datastream_resources.py b/owl-bot-staging/v1/google/cloud/datastream_v1/types/datastream_resources.py new file mode 100644 index 0000000..23530ba --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/datastream_v1/types/datastream_resources.py @@ -0,0 +1,2091 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from typing import MutableMapping, MutableSequence + +import proto # type: ignore + +from google.protobuf import duration_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore + + +__protobuf__ = proto.module( + package='google.cloud.datastream.v1', + manifest={ + 'OracleProfile', + 'MysqlProfile', + 'PostgresqlProfile', + 'GcsProfile', + 'BigQueryProfile', + 'StaticServiceIpConnectivity', + 'ForwardSshTunnelConnectivity', + 'VpcPeeringConfig', + 'PrivateConnection', + 'PrivateConnectivity', + 'Route', + 'MysqlSslConfig', + 'ConnectionProfile', + 'OracleColumn', + 'OracleTable', + 'OracleSchema', + 'OracleRdbms', + 'OracleSourceConfig', + 'PostgresqlColumn', + 'PostgresqlTable', + 'PostgresqlSchema', + 'PostgresqlRdbms', + 'PostgresqlSourceConfig', + 'MysqlColumn', + 'MysqlTable', + 'MysqlDatabase', + 'MysqlRdbms', + 'MysqlSourceConfig', + 'SourceConfig', + 'AvroFileFormat', + 'JsonFileFormat', + 'GcsDestinationConfig', + 'BigQueryDestinationConfig', + 'DestinationConfig', + 'Stream', + 'StreamObject', + 'SourceObjectIdentifier', + 'BackfillJob', + 'Error', + 'ValidationResult', + 'Validation', + 'ValidationMessage', + }, +) + + +class OracleProfile(proto.Message): + r"""Oracle database profile. + + Attributes: + hostname (str): + Required. Hostname for the Oracle connection. + port (int): + Port for the Oracle connection, default value + is 1521. + username (str): + Required. Username for the Oracle connection. + password (str): + Required. Password for the Oracle connection. + database_service (str): + Required. Database for the Oracle connection. + connection_attributes (MutableMapping[str, str]): + Connection string attributes + """ + + hostname: str = proto.Field( + proto.STRING, + number=1, + ) + port: int = proto.Field( + proto.INT32, + number=2, + ) + username: str = proto.Field( + proto.STRING, + number=3, + ) + password: str = proto.Field( + proto.STRING, + number=4, + ) + database_service: str = proto.Field( + proto.STRING, + number=5, + ) + connection_attributes: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=6, + ) + + +class MysqlProfile(proto.Message): + r"""MySQL database profile. + + Attributes: + hostname (str): + Required. Hostname for the MySQL connection. + port (int): + Port for the MySQL connection, default value + is 3306. + username (str): + Required. Username for the MySQL connection. + password (str): + Required. Input only. Password for the MySQL + connection. + ssl_config (google.cloud.datastream_v1.types.MysqlSslConfig): + SSL configuration for the MySQL connection. + """ + + hostname: str = proto.Field( + proto.STRING, + number=1, + ) + port: int = proto.Field( + proto.INT32, + number=2, + ) + username: str = proto.Field( + proto.STRING, + number=3, + ) + password: str = proto.Field( + proto.STRING, + number=4, + ) + ssl_config: 'MysqlSslConfig' = proto.Field( + proto.MESSAGE, + number=5, + message='MysqlSslConfig', + ) + + +class PostgresqlProfile(proto.Message): + r"""PostgreSQL database profile. + + Attributes: + hostname (str): + Required. Hostname for the PostgreSQL + connection. + port (int): + Port for the PostgreSQL connection, default + value is 5432. + username (str): + Required. Username for the PostgreSQL + connection. + password (str): + Required. Password for the PostgreSQL + connection. + database (str): + Required. Database for the PostgreSQL + connection. + """ + + hostname: str = proto.Field( + proto.STRING, + number=1, + ) + port: int = proto.Field( + proto.INT32, + number=2, + ) + username: str = proto.Field( + proto.STRING, + number=3, + ) + password: str = proto.Field( + proto.STRING, + number=4, + ) + database: str = proto.Field( + proto.STRING, + number=5, + ) + + +class GcsProfile(proto.Message): + r"""Cloud Storage bucket profile. + + Attributes: + bucket (str): + Required. The Cloud Storage bucket name. + root_path (str): + The root path inside the Cloud Storage + bucket. + """ + + bucket: str = proto.Field( + proto.STRING, + number=1, + ) + root_path: str = proto.Field( + proto.STRING, + number=2, + ) + + +class BigQueryProfile(proto.Message): + r"""BigQuery warehouse profile. + """ + + +class StaticServiceIpConnectivity(proto.Message): + r"""Static IP address connectivity. + """ + + +class ForwardSshTunnelConnectivity(proto.Message): + r"""Forward SSH Tunnel connectivity. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + hostname (str): + Required. Hostname for the SSH tunnel. + username (str): + Required. Username for the SSH tunnel. + port (int): + Port for the SSH tunnel, default value is 22. + password (str): + Input only. SSH password. + + This field is a member of `oneof`_ ``authentication_method``. + private_key (str): + Input only. SSH private key. + + This field is a member of `oneof`_ ``authentication_method``. + """ + + hostname: str = proto.Field( + proto.STRING, + number=1, + ) + username: str = proto.Field( + proto.STRING, + number=2, + ) + port: int = proto.Field( + proto.INT32, + number=3, + ) + password: str = proto.Field( + proto.STRING, + number=100, + oneof='authentication_method', + ) + private_key: str = proto.Field( + proto.STRING, + number=101, + oneof='authentication_method', + ) + + +class VpcPeeringConfig(proto.Message): + r"""The VPC Peering configuration is used to create VPC peering + between Datastream and the consumer's VPC. + + Attributes: + vpc (str): + Required. Fully qualified name of the VPC that Datastream + will peer to. Format: + ``projects/{project}/global/{networks}/{name}`` + subnet (str): + Required. A free subnet for peering. (CIDR of + /29) + """ + + vpc: str = proto.Field( + proto.STRING, + number=1, + ) + subnet: str = proto.Field( + proto.STRING, + number=2, + ) + + +class PrivateConnection(proto.Message): + r"""The PrivateConnection resource is used to establish private + connectivity between Datastream and a customer's network. + + Attributes: + name (str): + Output only. The resource's name. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The create time of the resource. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The update time of the resource. + labels (MutableMapping[str, str]): + Labels. + display_name (str): + Required. Display name. + state (google.cloud.datastream_v1.types.PrivateConnection.State): + Output only. The state of the Private + Connection. + error (google.cloud.datastream_v1.types.Error): + Output only. In case of error, the details of + the error in a user-friendly format. + vpc_peering_config (google.cloud.datastream_v1.types.VpcPeeringConfig): + VPC Peering Config. + """ + class State(proto.Enum): + r"""Private Connection state. + + Values: + STATE_UNSPECIFIED (0): + Unspecified state. + CREATING (1): + The private connection is in creation state - + creating resources. + CREATED (2): + The private connection has been created with + all of its resources. + FAILED (3): + The private connection creation has failed. + DELETING (4): + The private connection is being deleted. + FAILED_TO_DELETE (5): + Delete request has failed, resource is in + invalid state. + """ + STATE_UNSPECIFIED = 0 + CREATING = 1 + CREATED = 2 + FAILED = 3 + DELETING = 4 + FAILED_TO_DELETE = 5 + + name: str = proto.Field( + proto.STRING, + number=1, + ) + create_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + update_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + display_name: str = proto.Field( + proto.STRING, + number=5, + ) + state: State = proto.Field( + proto.ENUM, + number=6, + enum=State, + ) + error: 'Error' = proto.Field( + proto.MESSAGE, + number=7, + message='Error', + ) + vpc_peering_config: 'VpcPeeringConfig' = proto.Field( + proto.MESSAGE, + number=100, + message='VpcPeeringConfig', + ) + + +class PrivateConnectivity(proto.Message): + r"""Private Connectivity + + Attributes: + private_connection (str): + Required. A reference to a private connection resource. + Format: + ``projects/{project}/locations/{location}/privateConnections/{name}`` + """ + + private_connection: str = proto.Field( + proto.STRING, + number=1, + ) + + +class Route(proto.Message): + r"""The route resource is the child of the private connection + resource, used for defining a route for a private connection. + + Attributes: + name (str): + Output only. The resource's name. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The create time of the resource. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The update time of the resource. + labels (MutableMapping[str, str]): + Labels. + display_name (str): + Required. Display name. + destination_address (str): + Required. Destination address for connection + destination_port (int): + Destination port for connection + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + create_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + update_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + display_name: str = proto.Field( + proto.STRING, + number=5, + ) + destination_address: str = proto.Field( + proto.STRING, + number=6, + ) + destination_port: int = proto.Field( + proto.INT32, + number=7, + ) + + +class MysqlSslConfig(proto.Message): + r"""MySQL SSL configuration information. + + Attributes: + client_key (str): + Input only. PEM-encoded private key associated with the + Client Certificate. If this field is used then the + 'client_certificate' and the 'ca_certificate' fields are + mandatory. + client_key_set (bool): + Output only. Indicates whether the client_key field is set. + client_certificate (str): + Input only. PEM-encoded certificate that will be used by the + replica to authenticate against the source database server. + If this field is used then the 'client_key' and the + 'ca_certificate' fields are mandatory. + client_certificate_set (bool): + Output only. Indicates whether the client_certificate field + is set. + ca_certificate (str): + Input only. PEM-encoded certificate of the CA + that signed the source database server's + certificate. + ca_certificate_set (bool): + Output only. Indicates whether the ca_certificate field is + set. + """ + + client_key: str = proto.Field( + proto.STRING, + number=1, + ) + client_key_set: bool = proto.Field( + proto.BOOL, + number=2, + ) + client_certificate: str = proto.Field( + proto.STRING, + number=3, + ) + client_certificate_set: bool = proto.Field( + proto.BOOL, + number=4, + ) + ca_certificate: str = proto.Field( + proto.STRING, + number=5, + ) + ca_certificate_set: bool = proto.Field( + proto.BOOL, + number=6, + ) + + +class ConnectionProfile(proto.Message): + r"""A set of reusable connection configurations to be used as a + source or destination for a stream. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + name (str): + Output only. The resource's name. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The create time of the resource. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The update time of the resource. + labels (MutableMapping[str, str]): + Labels. + display_name (str): + Required. Display name. + oracle_profile (google.cloud.datastream_v1.types.OracleProfile): + Oracle ConnectionProfile configuration. + + This field is a member of `oneof`_ ``profile``. + gcs_profile (google.cloud.datastream_v1.types.GcsProfile): + Cloud Storage ConnectionProfile + configuration. + + This field is a member of `oneof`_ ``profile``. + mysql_profile (google.cloud.datastream_v1.types.MysqlProfile): + MySQL ConnectionProfile configuration. + + This field is a member of `oneof`_ ``profile``. + bigquery_profile (google.cloud.datastream_v1.types.BigQueryProfile): + BigQuery Connection Profile configuration. + + This field is a member of `oneof`_ ``profile``. + postgresql_profile (google.cloud.datastream_v1.types.PostgresqlProfile): + PostgreSQL Connection Profile configuration. + + This field is a member of `oneof`_ ``profile``. + static_service_ip_connectivity (google.cloud.datastream_v1.types.StaticServiceIpConnectivity): + Static Service IP connectivity. + + This field is a member of `oneof`_ ``connectivity``. + forward_ssh_connectivity (google.cloud.datastream_v1.types.ForwardSshTunnelConnectivity): + Forward SSH tunnel connectivity. + + This field is a member of `oneof`_ ``connectivity``. + private_connectivity (google.cloud.datastream_v1.types.PrivateConnectivity): + Private connectivity. + + This field is a member of `oneof`_ ``connectivity``. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + create_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + update_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + display_name: str = proto.Field( + proto.STRING, + number=5, + ) + oracle_profile: 'OracleProfile' = proto.Field( + proto.MESSAGE, + number=100, + oneof='profile', + message='OracleProfile', + ) + gcs_profile: 'GcsProfile' = proto.Field( + proto.MESSAGE, + number=101, + oneof='profile', + message='GcsProfile', + ) + mysql_profile: 'MysqlProfile' = proto.Field( + proto.MESSAGE, + number=102, + oneof='profile', + message='MysqlProfile', + ) + bigquery_profile: 'BigQueryProfile' = proto.Field( + proto.MESSAGE, + number=103, + oneof='profile', + message='BigQueryProfile', + ) + postgresql_profile: 'PostgresqlProfile' = proto.Field( + proto.MESSAGE, + number=104, + oneof='profile', + message='PostgresqlProfile', + ) + static_service_ip_connectivity: 'StaticServiceIpConnectivity' = proto.Field( + proto.MESSAGE, + number=200, + oneof='connectivity', + message='StaticServiceIpConnectivity', + ) + forward_ssh_connectivity: 'ForwardSshTunnelConnectivity' = proto.Field( + proto.MESSAGE, + number=201, + oneof='connectivity', + message='ForwardSshTunnelConnectivity', + ) + private_connectivity: 'PrivateConnectivity' = proto.Field( + proto.MESSAGE, + number=202, + oneof='connectivity', + message='PrivateConnectivity', + ) + + +class OracleColumn(proto.Message): + r"""Oracle Column. + + Attributes: + column (str): + Column name. + data_type (str): + The Oracle data type. + length (int): + Column length. + precision (int): + Column precision. + scale (int): + Column scale. + encoding (str): + Column encoding. + primary_key (bool): + Whether or not the column represents a + primary key. + nullable (bool): + Whether or not the column can accept a null + value. + ordinal_position (int): + The ordinal position of the column in the + table. + """ + + column: str = proto.Field( + proto.STRING, + number=1, + ) + data_type: str = proto.Field( + proto.STRING, + number=2, + ) + length: int = proto.Field( + proto.INT32, + number=3, + ) + precision: int = proto.Field( + proto.INT32, + number=4, + ) + scale: int = proto.Field( + proto.INT32, + number=5, + ) + encoding: str = proto.Field( + proto.STRING, + number=6, + ) + primary_key: bool = proto.Field( + proto.BOOL, + number=7, + ) + nullable: bool = proto.Field( + proto.BOOL, + number=8, + ) + ordinal_position: int = proto.Field( + proto.INT32, + number=9, + ) + + +class OracleTable(proto.Message): + r"""Oracle table. + + Attributes: + table (str): + Table name. + oracle_columns (MutableSequence[google.cloud.datastream_v1.types.OracleColumn]): + Oracle columns in the schema. + When unspecified as part of include/exclude + objects, includes/excludes everything. + """ + + table: str = proto.Field( + proto.STRING, + number=1, + ) + oracle_columns: MutableSequence['OracleColumn'] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message='OracleColumn', + ) + + +class OracleSchema(proto.Message): + r"""Oracle schema. + + Attributes: + schema (str): + Schema name. + oracle_tables (MutableSequence[google.cloud.datastream_v1.types.OracleTable]): + Tables in the schema. + """ + + schema: str = proto.Field( + proto.STRING, + number=1, + ) + oracle_tables: MutableSequence['OracleTable'] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message='OracleTable', + ) + + +class OracleRdbms(proto.Message): + r"""Oracle database structure. + + Attributes: + oracle_schemas (MutableSequence[google.cloud.datastream_v1.types.OracleSchema]): + Oracle schemas/databases in the database + server. + """ + + oracle_schemas: MutableSequence['OracleSchema'] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='OracleSchema', + ) + + +class OracleSourceConfig(proto.Message): + r"""Oracle data source configuration + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + include_objects (google.cloud.datastream_v1.types.OracleRdbms): + Oracle objects to include in the stream. + exclude_objects (google.cloud.datastream_v1.types.OracleRdbms): + Oracle objects to exclude from the stream. + max_concurrent_cdc_tasks (int): + Maximum number of concurrent CDC tasks. The + number should be non negative. If not set (or + set to 0), the system's default value will be + used. + drop_large_objects (google.cloud.datastream_v1.types.OracleSourceConfig.DropLargeObjects): + Drop large object values. + + This field is a member of `oneof`_ ``large_objects_handling``. + stream_large_objects (google.cloud.datastream_v1.types.OracleSourceConfig.StreamLargeObjects): + Stream large object values. + + This field is a member of `oneof`_ ``large_objects_handling``. + """ + + class DropLargeObjects(proto.Message): + r"""Configuration to drop large object values. + """ + + class StreamLargeObjects(proto.Message): + r"""Configuration to stream large object values. + """ + + include_objects: 'OracleRdbms' = proto.Field( + proto.MESSAGE, + number=1, + message='OracleRdbms', + ) + exclude_objects: 'OracleRdbms' = proto.Field( + proto.MESSAGE, + number=2, + message='OracleRdbms', + ) + max_concurrent_cdc_tasks: int = proto.Field( + proto.INT32, + number=3, + ) + drop_large_objects: DropLargeObjects = proto.Field( + proto.MESSAGE, + number=100, + oneof='large_objects_handling', + message=DropLargeObjects, + ) + stream_large_objects: StreamLargeObjects = proto.Field( + proto.MESSAGE, + number=102, + oneof='large_objects_handling', + message=StreamLargeObjects, + ) + + +class PostgresqlColumn(proto.Message): + r"""PostgreSQL Column. + + Attributes: + column (str): + Column name. + data_type (str): + The PostgreSQL data type. + length (int): + Column length. + precision (int): + Column precision. + scale (int): + Column scale. + primary_key (bool): + Whether or not the column represents a + primary key. + nullable (bool): + Whether or not the column can accept a null + value. + ordinal_position (int): + The ordinal position of the column in the + table. + """ + + column: str = proto.Field( + proto.STRING, + number=1, + ) + data_type: str = proto.Field( + proto.STRING, + number=2, + ) + length: int = proto.Field( + proto.INT32, + number=3, + ) + precision: int = proto.Field( + proto.INT32, + number=4, + ) + scale: int = proto.Field( + proto.INT32, + number=5, + ) + primary_key: bool = proto.Field( + proto.BOOL, + number=7, + ) + nullable: bool = proto.Field( + proto.BOOL, + number=8, + ) + ordinal_position: int = proto.Field( + proto.INT32, + number=9, + ) + + +class PostgresqlTable(proto.Message): + r"""PostgreSQL table. + + Attributes: + table (str): + Table name. + postgresql_columns (MutableSequence[google.cloud.datastream_v1.types.PostgresqlColumn]): + PostgreSQL columns in the schema. + When unspecified as part of include/exclude + objects, includes/excludes everything. + """ + + table: str = proto.Field( + proto.STRING, + number=1, + ) + postgresql_columns: MutableSequence['PostgresqlColumn'] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message='PostgresqlColumn', + ) + + +class PostgresqlSchema(proto.Message): + r"""PostgreSQL schema. + + Attributes: + schema (str): + Schema name. + postgresql_tables (MutableSequence[google.cloud.datastream_v1.types.PostgresqlTable]): + Tables in the schema. + """ + + schema: str = proto.Field( + proto.STRING, + number=1, + ) + postgresql_tables: MutableSequence['PostgresqlTable'] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message='PostgresqlTable', + ) + + +class PostgresqlRdbms(proto.Message): + r"""PostgreSQL database structure. + + Attributes: + postgresql_schemas (MutableSequence[google.cloud.datastream_v1.types.PostgresqlSchema]): + PostgreSQL schemas in the database server. + """ + + postgresql_schemas: MutableSequence['PostgresqlSchema'] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='PostgresqlSchema', + ) + + +class PostgresqlSourceConfig(proto.Message): + r"""PostgreSQL data source configuration + + Attributes: + include_objects (google.cloud.datastream_v1.types.PostgresqlRdbms): + PostgreSQL objects to include in the stream. + exclude_objects (google.cloud.datastream_v1.types.PostgresqlRdbms): + PostgreSQL objects to exclude from the + stream. + replication_slot (str): + Required. The name of the logical replication + slot that's configured with the pgoutput plugin. + publication (str): + Required. The name of the publication that includes the set + of all tables that are defined in the stream's + include_objects. + """ + + include_objects: 'PostgresqlRdbms' = proto.Field( + proto.MESSAGE, + number=1, + message='PostgresqlRdbms', + ) + exclude_objects: 'PostgresqlRdbms' = proto.Field( + proto.MESSAGE, + number=2, + message='PostgresqlRdbms', + ) + replication_slot: str = proto.Field( + proto.STRING, + number=3, + ) + publication: str = proto.Field( + proto.STRING, + number=4, + ) + + +class MysqlColumn(proto.Message): + r"""MySQL Column. + + Attributes: + column (str): + Column name. + data_type (str): + The MySQL data type. Full data types list can + be found here: + https://dev.mysql.com/doc/refman/8.0/en/data-types.html + length (int): + Column length. + collation (str): + Column collation. + primary_key (bool): + Whether or not the column represents a + primary key. + nullable (bool): + Whether or not the column can accept a null + value. + ordinal_position (int): + The ordinal position of the column in the + table. + """ + + column: str = proto.Field( + proto.STRING, + number=1, + ) + data_type: str = proto.Field( + proto.STRING, + number=2, + ) + length: int = proto.Field( + proto.INT32, + number=3, + ) + collation: str = proto.Field( + proto.STRING, + number=4, + ) + primary_key: bool = proto.Field( + proto.BOOL, + number=5, + ) + nullable: bool = proto.Field( + proto.BOOL, + number=6, + ) + ordinal_position: int = proto.Field( + proto.INT32, + number=7, + ) + + +class MysqlTable(proto.Message): + r"""MySQL table. + + Attributes: + table (str): + Table name. + mysql_columns (MutableSequence[google.cloud.datastream_v1.types.MysqlColumn]): + MySQL columns in the database. + When unspecified as part of include/exclude + objects, includes/excludes everything. + """ + + table: str = proto.Field( + proto.STRING, + number=1, + ) + mysql_columns: MutableSequence['MysqlColumn'] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message='MysqlColumn', + ) + + +class MysqlDatabase(proto.Message): + r"""MySQL database. + + Attributes: + database (str): + Database name. + mysql_tables (MutableSequence[google.cloud.datastream_v1.types.MysqlTable]): + Tables in the database. + """ + + database: str = proto.Field( + proto.STRING, + number=1, + ) + mysql_tables: MutableSequence['MysqlTable'] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message='MysqlTable', + ) + + +class MysqlRdbms(proto.Message): + r"""MySQL database structure + + Attributes: + mysql_databases (MutableSequence[google.cloud.datastream_v1.types.MysqlDatabase]): + Mysql databases on the server + """ + + mysql_databases: MutableSequence['MysqlDatabase'] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='MysqlDatabase', + ) + + +class MysqlSourceConfig(proto.Message): + r"""MySQL source configuration + + Attributes: + include_objects (google.cloud.datastream_v1.types.MysqlRdbms): + MySQL objects to retrieve from the source. + exclude_objects (google.cloud.datastream_v1.types.MysqlRdbms): + MySQL objects to exclude from the stream. + max_concurrent_cdc_tasks (int): + Maximum number of concurrent CDC tasks. The + number should be non negative. If not set (or + set to 0), the system's default value will be + used. + """ + + include_objects: 'MysqlRdbms' = proto.Field( + proto.MESSAGE, + number=1, + message='MysqlRdbms', + ) + exclude_objects: 'MysqlRdbms' = proto.Field( + proto.MESSAGE, + number=2, + message='MysqlRdbms', + ) + max_concurrent_cdc_tasks: int = proto.Field( + proto.INT32, + number=3, + ) + + +class SourceConfig(proto.Message): + r"""The configuration of the stream source. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + source_connection_profile (str): + Required. Source connection profile resoource. Format: + ``projects/{project}/locations/{location}/connectionProfiles/{name}`` + oracle_source_config (google.cloud.datastream_v1.types.OracleSourceConfig): + Oracle data source configuration. + + This field is a member of `oneof`_ ``source_stream_config``. + mysql_source_config (google.cloud.datastream_v1.types.MysqlSourceConfig): + MySQL data source configuration. + + This field is a member of `oneof`_ ``source_stream_config``. + postgresql_source_config (google.cloud.datastream_v1.types.PostgresqlSourceConfig): + PostgreSQL data source configuration. + + This field is a member of `oneof`_ ``source_stream_config``. + """ + + source_connection_profile: str = proto.Field( + proto.STRING, + number=1, + ) + oracle_source_config: 'OracleSourceConfig' = proto.Field( + proto.MESSAGE, + number=100, + oneof='source_stream_config', + message='OracleSourceConfig', + ) + mysql_source_config: 'MysqlSourceConfig' = proto.Field( + proto.MESSAGE, + number=101, + oneof='source_stream_config', + message='MysqlSourceConfig', + ) + postgresql_source_config: 'PostgresqlSourceConfig' = proto.Field( + proto.MESSAGE, + number=102, + oneof='source_stream_config', + message='PostgresqlSourceConfig', + ) + + +class AvroFileFormat(proto.Message): + r"""AVRO file format configuration. + """ + + +class JsonFileFormat(proto.Message): + r"""JSON file format configuration. + + Attributes: + schema_file_format (google.cloud.datastream_v1.types.JsonFileFormat.SchemaFileFormat): + The schema file format along JSON data files. + compression (google.cloud.datastream_v1.types.JsonFileFormat.JsonCompression): + Compression of the loaded JSON file. + """ + class SchemaFileFormat(proto.Enum): + r"""Schema file format. + + Values: + SCHEMA_FILE_FORMAT_UNSPECIFIED (0): + Unspecified schema file format. + NO_SCHEMA_FILE (1): + Do not attach schema file. + AVRO_SCHEMA_FILE (2): + Avro schema format. + """ + SCHEMA_FILE_FORMAT_UNSPECIFIED = 0 + NO_SCHEMA_FILE = 1 + AVRO_SCHEMA_FILE = 2 + + class JsonCompression(proto.Enum): + r"""Json file compression. + + Values: + JSON_COMPRESSION_UNSPECIFIED (0): + Unspecified json file compression. + NO_COMPRESSION (1): + Do not compress JSON file. + GZIP (2): + Gzip compression. + """ + JSON_COMPRESSION_UNSPECIFIED = 0 + NO_COMPRESSION = 1 + GZIP = 2 + + schema_file_format: SchemaFileFormat = proto.Field( + proto.ENUM, + number=1, + enum=SchemaFileFormat, + ) + compression: JsonCompression = proto.Field( + proto.ENUM, + number=2, + enum=JsonCompression, + ) + + +class GcsDestinationConfig(proto.Message): + r"""Google Cloud Storage destination configuration + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + path (str): + Path inside the Cloud Storage bucket to write + data to. + file_rotation_mb (int): + The maximum file size to be saved in the + bucket. + file_rotation_interval (google.protobuf.duration_pb2.Duration): + The maximum duration for which new events are + added before a file is closed and a new file is + created. + avro_file_format (google.cloud.datastream_v1.types.AvroFileFormat): + AVRO file format configuration. + + This field is a member of `oneof`_ ``file_format``. + json_file_format (google.cloud.datastream_v1.types.JsonFileFormat): + JSON file format configuration. + + This field is a member of `oneof`_ ``file_format``. + """ + + path: str = proto.Field( + proto.STRING, + number=1, + ) + file_rotation_mb: int = proto.Field( + proto.INT32, + number=2, + ) + file_rotation_interval: duration_pb2.Duration = proto.Field( + proto.MESSAGE, + number=3, + message=duration_pb2.Duration, + ) + avro_file_format: 'AvroFileFormat' = proto.Field( + proto.MESSAGE, + number=100, + oneof='file_format', + message='AvroFileFormat', + ) + json_file_format: 'JsonFileFormat' = proto.Field( + proto.MESSAGE, + number=101, + oneof='file_format', + message='JsonFileFormat', + ) + + +class BigQueryDestinationConfig(proto.Message): + r""" + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + single_target_dataset (google.cloud.datastream_v1.types.BigQueryDestinationConfig.SingleTargetDataset): + Single destination dataset. + + This field is a member of `oneof`_ ``dataset_config``. + source_hierarchy_datasets (google.cloud.datastream_v1.types.BigQueryDestinationConfig.SourceHierarchyDatasets): + Source hierarchy datasets. + + This field is a member of `oneof`_ ``dataset_config``. + data_freshness (google.protobuf.duration_pb2.Duration): + The guaranteed data freshness (in seconds) + when querying tables created by the stream. + Editing this field will only affect new tables + created in the future, but existing tables will + not be impacted. Lower values mean that queries + will return fresher data, but may result in + higher cost. + """ + + class SingleTargetDataset(proto.Message): + r"""A single target dataset to which all data will be streamed. + + Attributes: + dataset_id (str): + + """ + + dataset_id: str = proto.Field( + proto.STRING, + number=1, + ) + + class SourceHierarchyDatasets(proto.Message): + r"""Destination datasets are created so that hierarchy of the + destination data objects matches the source hierarchy. + + Attributes: + dataset_template (google.cloud.datastream_v1.types.BigQueryDestinationConfig.SourceHierarchyDatasets.DatasetTemplate): + + """ + + class DatasetTemplate(proto.Message): + r"""Dataset template used for dynamic dataset creation. + + Attributes: + location (str): + Required. The geographic location where the + dataset should reside. See + https://cloud.google.com/bigquery/docs/locations + for supported locations. + dataset_id_prefix (str): + If supplied, every created dataset will have its name + prefixed by the provided value. The prefix and name will be + separated by an underscore. i.e. \_. + kms_key_name (str): + Describes the Cloud KMS encryption key that will be used to + protect destination BigQuery table. The BigQuery Service + Account associated with your project requires access to this + encryption key. i.e. + projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{cryptoKey}. + See + https://cloud.google.com/bigquery/docs/customer-managed-encryption + for more information. + """ + + location: str = proto.Field( + proto.STRING, + number=1, + ) + dataset_id_prefix: str = proto.Field( + proto.STRING, + number=2, + ) + kms_key_name: str = proto.Field( + proto.STRING, + number=3, + ) + + dataset_template: 'BigQueryDestinationConfig.SourceHierarchyDatasets.DatasetTemplate' = proto.Field( + proto.MESSAGE, + number=2, + message='BigQueryDestinationConfig.SourceHierarchyDatasets.DatasetTemplate', + ) + + single_target_dataset: SingleTargetDataset = proto.Field( + proto.MESSAGE, + number=201, + oneof='dataset_config', + message=SingleTargetDataset, + ) + source_hierarchy_datasets: SourceHierarchyDatasets = proto.Field( + proto.MESSAGE, + number=202, + oneof='dataset_config', + message=SourceHierarchyDatasets, + ) + data_freshness: duration_pb2.Duration = proto.Field( + proto.MESSAGE, + number=300, + message=duration_pb2.Duration, + ) + + +class DestinationConfig(proto.Message): + r"""The configuration of the stream destination. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + destination_connection_profile (str): + Required. Destination connection profile resource. Format: + ``projects/{project}/locations/{location}/connectionProfiles/{name}`` + gcs_destination_config (google.cloud.datastream_v1.types.GcsDestinationConfig): + A configuration for how data should be loaded + to Cloud Storage. + + This field is a member of `oneof`_ ``destination_stream_config``. + bigquery_destination_config (google.cloud.datastream_v1.types.BigQueryDestinationConfig): + BigQuery destination configuration. + + This field is a member of `oneof`_ ``destination_stream_config``. + """ + + destination_connection_profile: str = proto.Field( + proto.STRING, + number=1, + ) + gcs_destination_config: 'GcsDestinationConfig' = proto.Field( + proto.MESSAGE, + number=100, + oneof='destination_stream_config', + message='GcsDestinationConfig', + ) + bigquery_destination_config: 'BigQueryDestinationConfig' = proto.Field( + proto.MESSAGE, + number=101, + oneof='destination_stream_config', + message='BigQueryDestinationConfig', + ) + + +class Stream(proto.Message): + r"""A resource representing streaming data from a source to a + destination. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + name (str): + Output only. The stream's name. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The creation time of the stream. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The last update time of the + stream. + labels (MutableMapping[str, str]): + Labels. + display_name (str): + Required. Display name. + source_config (google.cloud.datastream_v1.types.SourceConfig): + Required. Source connection profile + configuration. + destination_config (google.cloud.datastream_v1.types.DestinationConfig): + Required. Destination connection profile + configuration. + state (google.cloud.datastream_v1.types.Stream.State): + The state of the stream. + backfill_all (google.cloud.datastream_v1.types.Stream.BackfillAllStrategy): + Automatically backfill objects included in + the stream source configuration. Specific + objects can be excluded. + + This field is a member of `oneof`_ ``backfill_strategy``. + backfill_none (google.cloud.datastream_v1.types.Stream.BackfillNoneStrategy): + Do not automatically backfill any objects. + + This field is a member of `oneof`_ ``backfill_strategy``. + errors (MutableSequence[google.cloud.datastream_v1.types.Error]): + Output only. Errors on the Stream. + customer_managed_encryption_key (str): + Immutable. A reference to a KMS encryption + key. If provided, it will be used to encrypt the + data. If left blank, data will be encrypted + using an internal Stream-specific encryption key + provisioned through KMS. + + This field is a member of `oneof`_ ``_customer_managed_encryption_key``. + """ + class State(proto.Enum): + r"""Stream state. + + Values: + STATE_UNSPECIFIED (0): + Unspecified stream state. + NOT_STARTED (1): + The stream has been created but has not yet + started streaming data. + RUNNING (2): + The stream is running. + PAUSED (3): + The stream is paused. + MAINTENANCE (4): + The stream is in maintenance mode. + Updates are rejected on the resource in this + state. + FAILED (5): + The stream is experiencing an error that is + preventing data from being streamed. + FAILED_PERMANENTLY (6): + The stream has experienced a terminal + failure. + STARTING (7): + The stream is starting, but not yet running. + DRAINING (8): + The Stream is no longer reading new events, + but still writing events in the buffer. + """ + STATE_UNSPECIFIED = 0 + NOT_STARTED = 1 + RUNNING = 2 + PAUSED = 3 + MAINTENANCE = 4 + FAILED = 5 + FAILED_PERMANENTLY = 6 + STARTING = 7 + DRAINING = 8 + + class BackfillAllStrategy(proto.Message): + r"""Backfill strategy to automatically backfill the Stream's + objects. Specific objects can be excluded. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + oracle_excluded_objects (google.cloud.datastream_v1.types.OracleRdbms): + Oracle data source objects to avoid + backfilling. + + This field is a member of `oneof`_ ``excluded_objects``. + mysql_excluded_objects (google.cloud.datastream_v1.types.MysqlRdbms): + MySQL data source objects to avoid + backfilling. + + This field is a member of `oneof`_ ``excluded_objects``. + postgresql_excluded_objects (google.cloud.datastream_v1.types.PostgresqlRdbms): + PostgreSQL data source objects to avoid + backfilling. + + This field is a member of `oneof`_ ``excluded_objects``. + """ + + oracle_excluded_objects: 'OracleRdbms' = proto.Field( + proto.MESSAGE, + number=1, + oneof='excluded_objects', + message='OracleRdbms', + ) + mysql_excluded_objects: 'MysqlRdbms' = proto.Field( + proto.MESSAGE, + number=2, + oneof='excluded_objects', + message='MysqlRdbms', + ) + postgresql_excluded_objects: 'PostgresqlRdbms' = proto.Field( + proto.MESSAGE, + number=3, + oneof='excluded_objects', + message='PostgresqlRdbms', + ) + + class BackfillNoneStrategy(proto.Message): + r"""Backfill strategy to disable automatic backfill for the + Stream's objects. + + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + create_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + update_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + display_name: str = proto.Field( + proto.STRING, + number=5, + ) + source_config: 'SourceConfig' = proto.Field( + proto.MESSAGE, + number=6, + message='SourceConfig', + ) + destination_config: 'DestinationConfig' = proto.Field( + proto.MESSAGE, + number=7, + message='DestinationConfig', + ) + state: State = proto.Field( + proto.ENUM, + number=8, + enum=State, + ) + backfill_all: BackfillAllStrategy = proto.Field( + proto.MESSAGE, + number=101, + oneof='backfill_strategy', + message=BackfillAllStrategy, + ) + backfill_none: BackfillNoneStrategy = proto.Field( + proto.MESSAGE, + number=102, + oneof='backfill_strategy', + message=BackfillNoneStrategy, + ) + errors: MutableSequence['Error'] = proto.RepeatedField( + proto.MESSAGE, + number=9, + message='Error', + ) + customer_managed_encryption_key: str = proto.Field( + proto.STRING, + number=10, + optional=True, + ) + + +class StreamObject(proto.Message): + r"""A specific stream object (e.g a specific DB table). + + Attributes: + name (str): + Output only. The object resource's name. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The creation time of the object. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The last update time of the + object. + display_name (str): + Required. Display name. + errors (MutableSequence[google.cloud.datastream_v1.types.Error]): + Output only. Active errors on the object. + backfill_job (google.cloud.datastream_v1.types.BackfillJob): + The latest backfill job that was initiated + for the stream object. + source_object (google.cloud.datastream_v1.types.SourceObjectIdentifier): + The object identifier in the data source. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + create_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + update_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + display_name: str = proto.Field( + proto.STRING, + number=5, + ) + errors: MutableSequence['Error'] = proto.RepeatedField( + proto.MESSAGE, + number=6, + message='Error', + ) + backfill_job: 'BackfillJob' = proto.Field( + proto.MESSAGE, + number=7, + message='BackfillJob', + ) + source_object: 'SourceObjectIdentifier' = proto.Field( + proto.MESSAGE, + number=8, + message='SourceObjectIdentifier', + ) + + +class SourceObjectIdentifier(proto.Message): + r"""Represents an identifier of an object in the data source. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + oracle_identifier (google.cloud.datastream_v1.types.SourceObjectIdentifier.OracleObjectIdentifier): + Oracle data source object identifier. + + This field is a member of `oneof`_ ``source_identifier``. + mysql_identifier (google.cloud.datastream_v1.types.SourceObjectIdentifier.MysqlObjectIdentifier): + Mysql data source object identifier. + + This field is a member of `oneof`_ ``source_identifier``. + postgresql_identifier (google.cloud.datastream_v1.types.SourceObjectIdentifier.PostgresqlObjectIdentifier): + PostgreSQL data source object identifier. + + This field is a member of `oneof`_ ``source_identifier``. + """ + + class OracleObjectIdentifier(proto.Message): + r"""Oracle data source object identifier. + + Attributes: + schema (str): + Required. The schema name. + table (str): + Required. The table name. + """ + + schema: str = proto.Field( + proto.STRING, + number=1, + ) + table: str = proto.Field( + proto.STRING, + number=2, + ) + + class PostgresqlObjectIdentifier(proto.Message): + r"""PostgreSQL data source object identifier. + + Attributes: + schema (str): + Required. The schema name. + table (str): + Required. The table name. + """ + + schema: str = proto.Field( + proto.STRING, + number=1, + ) + table: str = proto.Field( + proto.STRING, + number=2, + ) + + class MysqlObjectIdentifier(proto.Message): + r"""Mysql data source object identifier. + + Attributes: + database (str): + Required. The database name. + table (str): + Required. The table name. + """ + + database: str = proto.Field( + proto.STRING, + number=1, + ) + table: str = proto.Field( + proto.STRING, + number=2, + ) + + oracle_identifier: OracleObjectIdentifier = proto.Field( + proto.MESSAGE, + number=1, + oneof='source_identifier', + message=OracleObjectIdentifier, + ) + mysql_identifier: MysqlObjectIdentifier = proto.Field( + proto.MESSAGE, + number=2, + oneof='source_identifier', + message=MysqlObjectIdentifier, + ) + postgresql_identifier: PostgresqlObjectIdentifier = proto.Field( + proto.MESSAGE, + number=3, + oneof='source_identifier', + message=PostgresqlObjectIdentifier, + ) + + +class BackfillJob(proto.Message): + r"""Represents a backfill job on a specific stream object. + + Attributes: + state (google.cloud.datastream_v1.types.BackfillJob.State): + Backfill job state. + trigger (google.cloud.datastream_v1.types.BackfillJob.Trigger): + Backfill job's triggering reason. + last_start_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Backfill job's start time. + last_end_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Backfill job's end time. + errors (MutableSequence[google.cloud.datastream_v1.types.Error]): + Output only. Errors which caused the backfill + job to fail. + """ + class State(proto.Enum): + r"""State of the stream object's backfill job. + + Values: + STATE_UNSPECIFIED (0): + Default value. + NOT_STARTED (1): + Backfill job was never started for the stream + object (stream has backfill strategy defined as + manual or object was explicitly excluded from + automatic backfill). + PENDING (2): + Backfill job will start pending available + resources. + ACTIVE (3): + Backfill job is running. + STOPPED (4): + Backfill job stopped (next job run will start + from beginning). + FAILED (5): + Backfill job failed (due to an error). + COMPLETED (6): + Backfill completed successfully. + UNSUPPORTED (7): + Backfill job failed since the table structure + is currently unsupported for backfill. + """ + STATE_UNSPECIFIED = 0 + NOT_STARTED = 1 + PENDING = 2 + ACTIVE = 3 + STOPPED = 4 + FAILED = 5 + COMPLETED = 6 + UNSUPPORTED = 7 + + class Trigger(proto.Enum): + r"""Triggering reason for a backfill job. + + Values: + TRIGGER_UNSPECIFIED (0): + Default value. + AUTOMATIC (1): + Object backfill job was triggered + automatically according to the stream's backfill + strategy. + MANUAL (2): + Object backfill job was triggered manually + using the dedicated API. + """ + TRIGGER_UNSPECIFIED = 0 + AUTOMATIC = 1 + MANUAL = 2 + + state: State = proto.Field( + proto.ENUM, + number=1, + enum=State, + ) + trigger: Trigger = proto.Field( + proto.ENUM, + number=2, + enum=Trigger, + ) + last_start_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + last_end_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) + errors: MutableSequence['Error'] = proto.RepeatedField( + proto.MESSAGE, + number=5, + message='Error', + ) + + +class Error(proto.Message): + r"""Represent a user-facing Error. + + Attributes: + reason (str): + A title that explains the reason for the + error. + error_uuid (str): + A unique identifier for this specific error, + allowing it to be traced throughout the system + in logs and API responses. + message (str): + A message containing more information about + the error that occurred. + error_time (google.protobuf.timestamp_pb2.Timestamp): + The time when the error occurred. + details (MutableMapping[str, str]): + Additional information about the error. + """ + + reason: str = proto.Field( + proto.STRING, + number=1, + ) + error_uuid: str = proto.Field( + proto.STRING, + number=2, + ) + message: str = proto.Field( + proto.STRING, + number=3, + ) + error_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) + details: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=5, + ) + + +class ValidationResult(proto.Message): + r"""Contains the current validation results. + + Attributes: + validations (MutableSequence[google.cloud.datastream_v1.types.Validation]): + A list of validations (includes both executed + as well as not executed validations). + """ + + validations: MutableSequence['Validation'] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='Validation', + ) + + +class Validation(proto.Message): + r"""A validation to perform on a stream. + + Attributes: + description (str): + A short description of the validation. + state (google.cloud.datastream_v1.types.Validation.State): + Validation execution status. + message (MutableSequence[google.cloud.datastream_v1.types.ValidationMessage]): + Messages reflecting the validation results. + code (str): + A custom code identifying this validation. + """ + class State(proto.Enum): + r"""Validation execution state. + + Values: + STATE_UNSPECIFIED (0): + Unspecified state. + NOT_EXECUTED (1): + Validation did not execute. + FAILED (2): + Validation failed. + PASSED (3): + Validation passed. + """ + STATE_UNSPECIFIED = 0 + NOT_EXECUTED = 1 + FAILED = 2 + PASSED = 3 + + description: str = proto.Field( + proto.STRING, + number=1, + ) + state: State = proto.Field( + proto.ENUM, + number=2, + enum=State, + ) + message: MutableSequence['ValidationMessage'] = proto.RepeatedField( + proto.MESSAGE, + number=3, + message='ValidationMessage', + ) + code: str = proto.Field( + proto.STRING, + number=4, + ) + + +class ValidationMessage(proto.Message): + r"""Represent user-facing validation result message. + + Attributes: + message (str): + The result of the validation. + level (google.cloud.datastream_v1.types.ValidationMessage.Level): + Message severity level (warning or error). + metadata (MutableMapping[str, str]): + Additional metadata related to the result. + code (str): + A custom code identifying this specific + message. + """ + class Level(proto.Enum): + r"""Validation message level. + + Values: + LEVEL_UNSPECIFIED (0): + Unspecified level. + WARNING (1): + Potentially cause issues with the Stream. + ERROR (2): + Definitely cause issues with the Stream. + """ + LEVEL_UNSPECIFIED = 0 + WARNING = 1 + ERROR = 2 + + message: str = proto.Field( + proto.STRING, + number=1, + ) + level: Level = proto.Field( + proto.ENUM, + number=2, + enum=Level, + ) + metadata: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=3, + ) + code: str = proto.Field( + proto.STRING, + number=4, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/mypy.ini b/owl-bot-staging/v1/mypy.ini new file mode 100644 index 0000000..574c5ae --- /dev/null +++ b/owl-bot-staging/v1/mypy.ini @@ -0,0 +1,3 @@ +[mypy] +python_version = 3.7 +namespace_packages = True diff --git a/owl-bot-staging/v1/noxfile.py b/owl-bot-staging/v1/noxfile.py new file mode 100644 index 0000000..aa2ee41 --- /dev/null +++ b/owl-bot-staging/v1/noxfile.py @@ -0,0 +1,184 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import os +import pathlib +import shutil +import subprocess +import sys + + +import nox # type: ignore + +ALL_PYTHON = [ + "3.7", + "3.8", + "3.9", + "3.10", + "3.11", +] + +CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() + +LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" +PACKAGE_NAME = subprocess.check_output([sys.executable, "setup.py", "--name"], encoding="utf-8") + +BLACK_VERSION = "black==22.3.0" +BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"] +DEFAULT_PYTHON_VERSION = "3.11" + +nox.sessions = [ + "unit", + "cover", + "mypy", + "check_lower_bounds" + # exclude update_lower_bounds from default + "docs", + "blacken", + "lint", + "lint_setup_py", +] + +@nox.session(python=ALL_PYTHON) +def unit(session): + """Run the unit test suite.""" + + session.install('coverage', 'pytest', 'pytest-cov', 'pytest-asyncio', 'asyncmock; python_version < "3.8"') + session.install('-e', '.') + + session.run( + 'py.test', + '--quiet', + '--cov=google/cloud/datastream_v1/', + '--cov=tests/', + '--cov-config=.coveragerc', + '--cov-report=term', + '--cov-report=html', + os.path.join('tests', 'unit', ''.join(session.posargs)) + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def cover(session): + """Run the final coverage report. + This outputs the coverage report aggregating coverage from the unit + test runs (not system test runs), and then erases coverage data. + """ + session.install("coverage", "pytest-cov") + session.run("coverage", "report", "--show-missing", "--fail-under=100") + + session.run("coverage", "erase") + + +@nox.session(python=ALL_PYTHON) +def mypy(session): + """Run the type checker.""" + session.install( + 'mypy', + 'types-requests', + 'types-protobuf' + ) + session.install('.') + session.run( + 'mypy', + '--explicit-package-bases', + 'google', + ) + + +@nox.session +def update_lower_bounds(session): + """Update lower bounds in constraints.txt to match setup.py""" + session.install('google-cloud-testutils') + session.install('.') + + session.run( + 'lower-bound-checker', + 'update', + '--package-name', + PACKAGE_NAME, + '--constraints-file', + str(LOWER_BOUND_CONSTRAINTS_FILE), + ) + + +@nox.session +def check_lower_bounds(session): + """Check lower bounds in setup.py are reflected in constraints file""" + session.install('google-cloud-testutils') + session.install('.') + + session.run( + 'lower-bound-checker', + 'check', + '--package-name', + PACKAGE_NAME, + '--constraints-file', + str(LOWER_BOUND_CONSTRAINTS_FILE), + ) + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def docs(session): + """Build the docs for this library.""" + + session.install("-e", ".") + session.install("sphinx==4.0.1", "alabaster", "recommonmark") + + shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) + session.run( + "sphinx-build", + "-W", # warnings as errors + "-T", # show full traceback on exception + "-N", # no colors + "-b", + "html", + "-d", + os.path.join("docs", "_build", "doctrees", ""), + os.path.join("docs", ""), + os.path.join("docs", "_build", "html", ""), + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def lint(session): + """Run linters. + + Returns a failure if the linters find linting errors or sufficiently + serious code quality issues. + """ + session.install("flake8", BLACK_VERSION) + session.run( + "black", + "--check", + *BLACK_PATHS, + ) + session.run("flake8", "google", "tests", "samples") + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def blacken(session): + """Run black. Format code to uniform standard.""" + session.install(BLACK_VERSION) + session.run( + "black", + *BLACK_PATHS, + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def lint_setup_py(session): + """Verify that setup.py is valid (including RST check).""" + session.install("docutils", "pygments") + session.run("python", "setup.py", "check", "--restructuredtext", "--strict") diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_connection_profile_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_connection_profile_async.py new file mode 100644 index 0000000..4b29f91 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_connection_profile_async.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateConnectionProfile +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_CreateConnectionProfile_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_create_connection_profile(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + connection_profile = datastream_v1.ConnectionProfile() + connection_profile.oracle_profile.hostname = "hostname_value" + connection_profile.oracle_profile.username = "username_value" + connection_profile.oracle_profile.password = "password_value" + connection_profile.oracle_profile.database_service = "database_service_value" + connection_profile.display_name = "display_name_value" + + request = datastream_v1.CreateConnectionProfileRequest( + parent="parent_value", + connection_profile_id="connection_profile_id_value", + connection_profile=connection_profile, + ) + + # Make the request + operation = client.create_connection_profile(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_CreateConnectionProfile_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_connection_profile_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_connection_profile_sync.py new file mode 100644 index 0000000..a2e67c1 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_connection_profile_sync.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateConnectionProfile +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_CreateConnectionProfile_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_create_connection_profile(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + connection_profile = datastream_v1.ConnectionProfile() + connection_profile.oracle_profile.hostname = "hostname_value" + connection_profile.oracle_profile.username = "username_value" + connection_profile.oracle_profile.password = "password_value" + connection_profile.oracle_profile.database_service = "database_service_value" + connection_profile.display_name = "display_name_value" + + request = datastream_v1.CreateConnectionProfileRequest( + parent="parent_value", + connection_profile_id="connection_profile_id_value", + connection_profile=connection_profile, + ) + + # Make the request + operation = client.create_connection_profile(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_CreateConnectionProfile_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_private_connection_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_private_connection_async.py new file mode 100644 index 0000000..c47b666 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_private_connection_async.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreatePrivateConnection +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_CreatePrivateConnection_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_create_private_connection(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + private_connection = datastream_v1.PrivateConnection() + private_connection.display_name = "display_name_value" + + request = datastream_v1.CreatePrivateConnectionRequest( + parent="parent_value", + private_connection_id="private_connection_id_value", + private_connection=private_connection, + ) + + # Make the request + operation = client.create_private_connection(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_CreatePrivateConnection_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_private_connection_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_private_connection_sync.py new file mode 100644 index 0000000..d0430be --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_private_connection_sync.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreatePrivateConnection +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_CreatePrivateConnection_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_create_private_connection(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + private_connection = datastream_v1.PrivateConnection() + private_connection.display_name = "display_name_value" + + request = datastream_v1.CreatePrivateConnectionRequest( + parent="parent_value", + private_connection_id="private_connection_id_value", + private_connection=private_connection, + ) + + # Make the request + operation = client.create_private_connection(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_CreatePrivateConnection_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_route_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_route_async.py new file mode 100644 index 0000000..d22e7bc --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_route_async.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateRoute +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_CreateRoute_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_create_route(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + route = datastream_v1.Route() + route.display_name = "display_name_value" + route.destination_address = "destination_address_value" + + request = datastream_v1.CreateRouteRequest( + parent="parent_value", + route_id="route_id_value", + route=route, + ) + + # Make the request + operation = client.create_route(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_CreateRoute_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_route_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_route_sync.py new file mode 100644 index 0000000..b9c7fb0 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_route_sync.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateRoute +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_CreateRoute_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_create_route(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + route = datastream_v1.Route() + route.display_name = "display_name_value" + route.destination_address = "destination_address_value" + + request = datastream_v1.CreateRouteRequest( + parent="parent_value", + route_id="route_id_value", + route=route, + ) + + # Make the request + operation = client.create_route(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_CreateRoute_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_stream_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_stream_async.py new file mode 100644 index 0000000..c2ed711 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_stream_async.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateStream +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_CreateStream_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_create_stream(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + stream = datastream_v1.Stream() + stream.display_name = "display_name_value" + stream.source_config.source_connection_profile = "source_connection_profile_value" + stream.destination_config.destination_connection_profile = "destination_connection_profile_value" + + request = datastream_v1.CreateStreamRequest( + parent="parent_value", + stream_id="stream_id_value", + stream=stream, + ) + + # Make the request + operation = client.create_stream(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_CreateStream_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_stream_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_stream_sync.py new file mode 100644 index 0000000..164fc95 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_stream_sync.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateStream +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_CreateStream_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_create_stream(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + stream = datastream_v1.Stream() + stream.display_name = "display_name_value" + stream.source_config.source_connection_profile = "source_connection_profile_value" + stream.destination_config.destination_connection_profile = "destination_connection_profile_value" + + request = datastream_v1.CreateStreamRequest( + parent="parent_value", + stream_id="stream_id_value", + stream=stream, + ) + + # Make the request + operation = client.create_stream(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_CreateStream_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_connection_profile_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_connection_profile_async.py new file mode 100644 index 0000000..992b716 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_connection_profile_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteConnectionProfile +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_DeleteConnectionProfile_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_delete_connection_profile(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.DeleteConnectionProfileRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_connection_profile(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_DeleteConnectionProfile_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_connection_profile_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_connection_profile_sync.py new file mode 100644 index 0000000..3d21a9d --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_connection_profile_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteConnectionProfile +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_DeleteConnectionProfile_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_delete_connection_profile(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.DeleteConnectionProfileRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_connection_profile(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_DeleteConnectionProfile_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_private_connection_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_private_connection_async.py new file mode 100644 index 0000000..6554e34 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_private_connection_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeletePrivateConnection +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_DeletePrivateConnection_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_delete_private_connection(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.DeletePrivateConnectionRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_private_connection(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_DeletePrivateConnection_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_private_connection_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_private_connection_sync.py new file mode 100644 index 0000000..07d642e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_private_connection_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeletePrivateConnection +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_DeletePrivateConnection_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_delete_private_connection(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.DeletePrivateConnectionRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_private_connection(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_DeletePrivateConnection_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_route_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_route_async.py new file mode 100644 index 0000000..89d56f5 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_route_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteRoute +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_DeleteRoute_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_delete_route(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.DeleteRouteRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_route(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_DeleteRoute_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_route_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_route_sync.py new file mode 100644 index 0000000..2dbf0c0 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_route_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteRoute +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_DeleteRoute_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_delete_route(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.DeleteRouteRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_route(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_DeleteRoute_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_stream_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_stream_async.py new file mode 100644 index 0000000..64963af --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_stream_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteStream +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_DeleteStream_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_delete_stream(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.DeleteStreamRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_stream(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_DeleteStream_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_stream_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_stream_sync.py new file mode 100644 index 0000000..a3eff1a --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_stream_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteStream +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_DeleteStream_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_delete_stream(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.DeleteStreamRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_stream(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_DeleteStream_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_discover_connection_profile_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_discover_connection_profile_async.py new file mode 100644 index 0000000..728488e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_discover_connection_profile_async.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DiscoverConnectionProfile +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_DiscoverConnectionProfile_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_discover_connection_profile(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + connection_profile = datastream_v1.ConnectionProfile() + connection_profile.oracle_profile.hostname = "hostname_value" + connection_profile.oracle_profile.username = "username_value" + connection_profile.oracle_profile.password = "password_value" + connection_profile.oracle_profile.database_service = "database_service_value" + connection_profile.display_name = "display_name_value" + + request = datastream_v1.DiscoverConnectionProfileRequest( + connection_profile=connection_profile, + full_hierarchy=True, + parent="parent_value", + ) + + # Make the request + response = await client.discover_connection_profile(request=request) + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_DiscoverConnectionProfile_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_discover_connection_profile_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_discover_connection_profile_sync.py new file mode 100644 index 0000000..b400c0d --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_discover_connection_profile_sync.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DiscoverConnectionProfile +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_DiscoverConnectionProfile_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_discover_connection_profile(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + connection_profile = datastream_v1.ConnectionProfile() + connection_profile.oracle_profile.hostname = "hostname_value" + connection_profile.oracle_profile.username = "username_value" + connection_profile.oracle_profile.password = "password_value" + connection_profile.oracle_profile.database_service = "database_service_value" + connection_profile.display_name = "display_name_value" + + request = datastream_v1.DiscoverConnectionProfileRequest( + connection_profile=connection_profile, + full_hierarchy=True, + parent="parent_value", + ) + + # Make the request + response = client.discover_connection_profile(request=request) + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_DiscoverConnectionProfile_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_fetch_static_ips_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_fetch_static_ips_async.py new file mode 100644 index 0000000..04dc712 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_fetch_static_ips_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for FetchStaticIps +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_FetchStaticIps_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_fetch_static_ips(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.FetchStaticIpsRequest( + name="name_value", + ) + + # Make the request + page_result = client.fetch_static_ips(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END datastream_v1_generated_Datastream_FetchStaticIps_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_fetch_static_ips_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_fetch_static_ips_sync.py new file mode 100644 index 0000000..d6c2be7 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_fetch_static_ips_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for FetchStaticIps +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_FetchStaticIps_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_fetch_static_ips(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.FetchStaticIpsRequest( + name="name_value", + ) + + # Make the request + page_result = client.fetch_static_ips(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END datastream_v1_generated_Datastream_FetchStaticIps_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_connection_profile_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_connection_profile_async.py new file mode 100644 index 0000000..a22b482 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_connection_profile_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetConnectionProfile +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_GetConnectionProfile_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_get_connection_profile(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.GetConnectionProfileRequest( + name="name_value", + ) + + # Make the request + response = await client.get_connection_profile(request=request) + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_GetConnectionProfile_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_connection_profile_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_connection_profile_sync.py new file mode 100644 index 0000000..50c560a --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_connection_profile_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetConnectionProfile +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_GetConnectionProfile_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_get_connection_profile(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.GetConnectionProfileRequest( + name="name_value", + ) + + # Make the request + response = client.get_connection_profile(request=request) + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_GetConnectionProfile_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_private_connection_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_private_connection_async.py new file mode 100644 index 0000000..a1549e5 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_private_connection_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetPrivateConnection +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_GetPrivateConnection_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_get_private_connection(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.GetPrivateConnectionRequest( + name="name_value", + ) + + # Make the request + response = await client.get_private_connection(request=request) + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_GetPrivateConnection_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_private_connection_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_private_connection_sync.py new file mode 100644 index 0000000..1ed9057 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_private_connection_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetPrivateConnection +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_GetPrivateConnection_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_get_private_connection(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.GetPrivateConnectionRequest( + name="name_value", + ) + + # Make the request + response = client.get_private_connection(request=request) + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_GetPrivateConnection_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_route_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_route_async.py new file mode 100644 index 0000000..d74caa6 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_route_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetRoute +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_GetRoute_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_get_route(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.GetRouteRequest( + name="name_value", + ) + + # Make the request + response = await client.get_route(request=request) + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_GetRoute_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_route_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_route_sync.py new file mode 100644 index 0000000..d423021 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_route_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetRoute +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_GetRoute_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_get_route(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.GetRouteRequest( + name="name_value", + ) + + # Make the request + response = client.get_route(request=request) + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_GetRoute_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_async.py new file mode 100644 index 0000000..2af0060 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetStream +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_GetStream_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_get_stream(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.GetStreamRequest( + name="name_value", + ) + + # Make the request + response = await client.get_stream(request=request) + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_GetStream_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_object_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_object_async.py new file mode 100644 index 0000000..8011717 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_object_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetStreamObject +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_GetStreamObject_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_get_stream_object(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.GetStreamObjectRequest( + name="name_value", + ) + + # Make the request + response = await client.get_stream_object(request=request) + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_GetStreamObject_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_object_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_object_sync.py new file mode 100644 index 0000000..38b225a --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_object_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetStreamObject +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_GetStreamObject_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_get_stream_object(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.GetStreamObjectRequest( + name="name_value", + ) + + # Make the request + response = client.get_stream_object(request=request) + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_GetStreamObject_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_sync.py new file mode 100644 index 0000000..31fbe34 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetStream +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_GetStream_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_get_stream(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.GetStreamRequest( + name="name_value", + ) + + # Make the request + response = client.get_stream(request=request) + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_GetStream_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_connection_profiles_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_connection_profiles_async.py new file mode 100644 index 0000000..408b216 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_connection_profiles_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListConnectionProfiles +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_ListConnectionProfiles_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_list_connection_profiles(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.ListConnectionProfilesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_connection_profiles(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END datastream_v1_generated_Datastream_ListConnectionProfiles_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_connection_profiles_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_connection_profiles_sync.py new file mode 100644 index 0000000..d4723be --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_connection_profiles_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListConnectionProfiles +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_ListConnectionProfiles_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_list_connection_profiles(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.ListConnectionProfilesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_connection_profiles(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END datastream_v1_generated_Datastream_ListConnectionProfiles_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_private_connections_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_private_connections_async.py new file mode 100644 index 0000000..2816c2f --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_private_connections_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListPrivateConnections +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_ListPrivateConnections_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_list_private_connections(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.ListPrivateConnectionsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_private_connections(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END datastream_v1_generated_Datastream_ListPrivateConnections_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_private_connections_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_private_connections_sync.py new file mode 100644 index 0000000..0be38d8 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_private_connections_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListPrivateConnections +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_ListPrivateConnections_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_list_private_connections(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.ListPrivateConnectionsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_private_connections(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END datastream_v1_generated_Datastream_ListPrivateConnections_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_routes_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_routes_async.py new file mode 100644 index 0000000..3d11060 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_routes_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListRoutes +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_ListRoutes_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_list_routes(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.ListRoutesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_routes(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END datastream_v1_generated_Datastream_ListRoutes_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_routes_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_routes_sync.py new file mode 100644 index 0000000..2b58ca9 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_routes_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListRoutes +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_ListRoutes_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_list_routes(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.ListRoutesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_routes(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END datastream_v1_generated_Datastream_ListRoutes_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_stream_objects_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_stream_objects_async.py new file mode 100644 index 0000000..fc9ad86 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_stream_objects_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListStreamObjects +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_ListStreamObjects_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_list_stream_objects(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.ListStreamObjectsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_stream_objects(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END datastream_v1_generated_Datastream_ListStreamObjects_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_stream_objects_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_stream_objects_sync.py new file mode 100644 index 0000000..9c58e25 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_stream_objects_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListStreamObjects +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_ListStreamObjects_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_list_stream_objects(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.ListStreamObjectsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_stream_objects(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END datastream_v1_generated_Datastream_ListStreamObjects_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_streams_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_streams_async.py new file mode 100644 index 0000000..5ddde36 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_streams_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListStreams +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_ListStreams_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_list_streams(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.ListStreamsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_streams(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END datastream_v1_generated_Datastream_ListStreams_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_streams_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_streams_sync.py new file mode 100644 index 0000000..4a94337 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_streams_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListStreams +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_ListStreams_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_list_streams(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.ListStreamsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_streams(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END datastream_v1_generated_Datastream_ListStreams_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_lookup_stream_object_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_lookup_stream_object_async.py new file mode 100644 index 0000000..b4092a7 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_lookup_stream_object_async.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for LookupStreamObject +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_LookupStreamObject_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_lookup_stream_object(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + source_object_identifier = datastream_v1.SourceObjectIdentifier() + source_object_identifier.oracle_identifier.schema = "schema_value" + source_object_identifier.oracle_identifier.table = "table_value" + + request = datastream_v1.LookupStreamObjectRequest( + parent="parent_value", + source_object_identifier=source_object_identifier, + ) + + # Make the request + response = await client.lookup_stream_object(request=request) + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_LookupStreamObject_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_lookup_stream_object_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_lookup_stream_object_sync.py new file mode 100644 index 0000000..803c067 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_lookup_stream_object_sync.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for LookupStreamObject +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_LookupStreamObject_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_lookup_stream_object(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + source_object_identifier = datastream_v1.SourceObjectIdentifier() + source_object_identifier.oracle_identifier.schema = "schema_value" + source_object_identifier.oracle_identifier.table = "table_value" + + request = datastream_v1.LookupStreamObjectRequest( + parent="parent_value", + source_object_identifier=source_object_identifier, + ) + + # Make the request + response = client.lookup_stream_object(request=request) + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_LookupStreamObject_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_start_backfill_job_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_start_backfill_job_async.py new file mode 100644 index 0000000..32e6c38 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_start_backfill_job_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for StartBackfillJob +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_StartBackfillJob_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_start_backfill_job(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.StartBackfillJobRequest( + object_="object__value", + ) + + # Make the request + response = await client.start_backfill_job(request=request) + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_StartBackfillJob_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_start_backfill_job_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_start_backfill_job_sync.py new file mode 100644 index 0000000..d86713f --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_start_backfill_job_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for StartBackfillJob +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_StartBackfillJob_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_start_backfill_job(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.StartBackfillJobRequest( + object_="object__value", + ) + + # Make the request + response = client.start_backfill_job(request=request) + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_StartBackfillJob_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_stop_backfill_job_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_stop_backfill_job_async.py new file mode 100644 index 0000000..3ddedf8 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_stop_backfill_job_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for StopBackfillJob +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_StopBackfillJob_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_stop_backfill_job(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1.StopBackfillJobRequest( + object_="object__value", + ) + + # Make the request + response = await client.stop_backfill_job(request=request) + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_StopBackfillJob_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_stop_backfill_job_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_stop_backfill_job_sync.py new file mode 100644 index 0000000..aeefdbc --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_stop_backfill_job_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for StopBackfillJob +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_StopBackfillJob_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_stop_backfill_job(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1.StopBackfillJobRequest( + object_="object__value", + ) + + # Make the request + response = client.stop_backfill_job(request=request) + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_StopBackfillJob_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_connection_profile_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_connection_profile_async.py new file mode 100644 index 0000000..5d1d762 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_connection_profile_async.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateConnectionProfile +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_UpdateConnectionProfile_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_update_connection_profile(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + connection_profile = datastream_v1.ConnectionProfile() + connection_profile.oracle_profile.hostname = "hostname_value" + connection_profile.oracle_profile.username = "username_value" + connection_profile.oracle_profile.password = "password_value" + connection_profile.oracle_profile.database_service = "database_service_value" + connection_profile.display_name = "display_name_value" + + request = datastream_v1.UpdateConnectionProfileRequest( + connection_profile=connection_profile, + ) + + # Make the request + operation = client.update_connection_profile(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_UpdateConnectionProfile_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_connection_profile_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_connection_profile_sync.py new file mode 100644 index 0000000..81a9077 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_connection_profile_sync.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateConnectionProfile +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_UpdateConnectionProfile_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_update_connection_profile(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + connection_profile = datastream_v1.ConnectionProfile() + connection_profile.oracle_profile.hostname = "hostname_value" + connection_profile.oracle_profile.username = "username_value" + connection_profile.oracle_profile.password = "password_value" + connection_profile.oracle_profile.database_service = "database_service_value" + connection_profile.display_name = "display_name_value" + + request = datastream_v1.UpdateConnectionProfileRequest( + connection_profile=connection_profile, + ) + + # Make the request + operation = client.update_connection_profile(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_UpdateConnectionProfile_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_stream_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_stream_async.py new file mode 100644 index 0000000..e217b95 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_stream_async.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateStream +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_UpdateStream_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +async def sample_update_stream(): + # Create a client + client = datastream_v1.DatastreamAsyncClient() + + # Initialize request argument(s) + stream = datastream_v1.Stream() + stream.display_name = "display_name_value" + stream.source_config.source_connection_profile = "source_connection_profile_value" + stream.destination_config.destination_connection_profile = "destination_connection_profile_value" + + request = datastream_v1.UpdateStreamRequest( + stream=stream, + ) + + # Make the request + operation = client.update_stream(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_UpdateStream_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_stream_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_stream_sync.py new file mode 100644 index 0000000..ba85efc --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_stream_sync.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateStream +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1_generated_Datastream_UpdateStream_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1 + + +def sample_update_stream(): + # Create a client + client = datastream_v1.DatastreamClient() + + # Initialize request argument(s) + stream = datastream_v1.Stream() + stream.display_name = "display_name_value" + stream.source_config.source_connection_profile = "source_connection_profile_value" + stream.destination_config.destination_connection_profile = "destination_connection_profile_value" + + request = datastream_v1.UpdateStreamRequest( + stream=stream, + ) + + # Make the request + operation = client.update_stream(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END datastream_v1_generated_Datastream_UpdateStream_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/snippet_metadata_google.cloud.datastream.v1.json b/owl-bot-staging/v1/samples/generated_samples/snippet_metadata_google.cloud.datastream.v1.json new file mode 100644 index 0000000..8a69b90 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/snippet_metadata_google.cloud.datastream.v1.json @@ -0,0 +1,4104 @@ +{ + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.datastream.v1", + "version": "v1" + } + ], + "language": "PYTHON", + "name": "google-cloud-datastream", + "version": "0.1.0" + }, + "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": [ + { + "end": 64, + "start": 27, + "type": "FULL" + }, + { + "end": 64, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 54, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 61, + "start": 55, + "type": "REQUEST_EXECUTION" + }, + { + "end": 65, + "start": 62, + "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": [ + { + "end": 64, + "start": 27, + "type": "FULL" + }, + { + "end": 64, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 54, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 61, + "start": 55, + "type": "REQUEST_EXECUTION" + }, + { + "end": 65, + "start": 62, + "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": [ + { + "end": 60, + "start": 27, + "type": "FULL" + }, + { + "end": 60, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 57, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 61, + "start": 58, + "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": [ + { + "end": 60, + "start": 27, + "type": "FULL" + }, + { + "end": 60, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 57, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 61, + "start": 58, + "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": [ + { + "end": 61, + "start": 27, + "type": "FULL" + }, + { + "end": 61, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 51, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 58, + "start": 52, + "type": "REQUEST_EXECUTION" + }, + { + "end": 62, + "start": 59, + "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": [ + { + "end": 61, + "start": 27, + "type": "FULL" + }, + { + "end": 61, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 51, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 58, + "start": 52, + "type": "REQUEST_EXECUTION" + }, + { + "end": 62, + "start": 59, + "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": [ + { + "end": 62, + "start": 27, + "type": "FULL" + }, + { + "end": 62, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 52, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 59, + "start": 53, + "type": "REQUEST_EXECUTION" + }, + { + "end": 63, + "start": 60, + "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": [ + { + "end": 62, + "start": 27, + "type": "FULL" + }, + { + "end": 62, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 52, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 59, + "start": 53, + "type": "REQUEST_EXECUTION" + }, + { + "end": 63, + "start": 60, + "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": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "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": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "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": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "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": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "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": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "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": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "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": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "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": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "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": [ + { + "end": 60, + "start": 27, + "type": "FULL" + }, + { + "end": 60, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 54, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 57, + "start": 55, + "type": "REQUEST_EXECUTION" + }, + { + "end": 61, + "start": 58, + "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": [ + { + "end": 60, + "start": 27, + "type": "FULL" + }, + { + "end": 60, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 54, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 57, + "start": 55, + "type": "REQUEST_EXECUTION" + }, + { + "end": 61, + "start": 58, + "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": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "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": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "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": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "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": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "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": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "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": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "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": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "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": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "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": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "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": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "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": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "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": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "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": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "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": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "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": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "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": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "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": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "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": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "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": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "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": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "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": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "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": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "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": [ + { + "end": 56, + "start": 27, + "type": "FULL" + }, + { + "end": 56, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 53, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 57, + "start": 54, + "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": [ + { + "end": 56, + "start": 27, + "type": "FULL" + }, + { + "end": 56, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 53, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 57, + "start": 54, + "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": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "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": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "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": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "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": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "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": [ + { + "end": 62, + "start": 27, + "type": "FULL" + }, + { + "end": 62, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 52, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 59, + "start": 53, + "type": "REQUEST_EXECUTION" + }, + { + "end": 63, + "start": 60, + "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": [ + { + "end": 62, + "start": 27, + "type": "FULL" + }, + { + "end": 62, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 52, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 59, + "start": 53, + "type": "REQUEST_EXECUTION" + }, + { + "end": 63, + "start": 60, + "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": [ + { + "end": 60, + "start": 27, + "type": "FULL" + }, + { + "end": 60, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 57, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 61, + "start": 58, + "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": [ + { + "end": 60, + "start": 27, + "type": "FULL" + }, + { + "end": 60, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 57, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 61, + "start": 58, + "type": "RESPONSE_HANDLING" + } + ], + "title": "datastream_v1_generated_datastream_update_stream_sync.py" + } + ] +} diff --git a/owl-bot-staging/v1/scripts/fixup_datastream_v1_keywords.py b/owl-bot-staging/v1/scripts/fixup_datastream_v1_keywords.py new file mode 100644 index 0000000..f390fcd --- /dev/null +++ b/owl-bot-staging/v1/scripts/fixup_datastream_v1_keywords.py @@ -0,0 +1,200 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import argparse +import os +import libcst as cst +import pathlib +import sys +from typing import (Any, Callable, Dict, List, Sequence, Tuple) + + +def partition( + predicate: Callable[[Any], bool], + iterator: Sequence[Any] +) -> Tuple[List[Any], List[Any]]: + """A stable, out-of-place partition.""" + results = ([], []) + + for i in iterator: + results[int(predicate(i))].append(i) + + # Returns trueList, falseList + return results[1], results[0] + + +class datastreamCallTransformer(cst.CSTTransformer): + CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') + METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { + 'create_connection_profile': ('parent', 'connection_profile_id', 'connection_profile', 'request_id', 'validate_only', 'force', ), + 'create_private_connection': ('parent', 'private_connection_id', 'private_connection', 'request_id', ), + 'create_route': ('parent', 'route_id', 'route', 'request_id', ), + 'create_stream': ('parent', 'stream_id', 'stream', 'request_id', 'validate_only', 'force', ), + 'delete_connection_profile': ('name', 'request_id', ), + 'delete_private_connection': ('name', 'request_id', 'force', ), + 'delete_route': ('name', 'request_id', ), + 'delete_stream': ('name', 'request_id', ), + 'discover_connection_profile': ('parent', 'connection_profile', 'connection_profile_name', 'full_hierarchy', 'hierarchy_depth', 'oracle_rdbms', 'mysql_rdbms', 'postgresql_rdbms', ), + 'fetch_static_ips': ('name', 'page_size', 'page_token', ), + 'get_connection_profile': ('name', ), + 'get_private_connection': ('name', ), + 'get_route': ('name', ), + 'get_stream': ('name', ), + 'get_stream_object': ('name', ), + 'list_connection_profiles': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), + 'list_private_connections': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), + 'list_routes': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), + 'list_stream_objects': ('parent', 'page_size', 'page_token', ), + 'list_streams': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), + 'lookup_stream_object': ('parent', 'source_object_identifier', ), + 'start_backfill_job': ('object_', ), + 'stop_backfill_job': ('object_', ), + 'update_connection_profile': ('connection_profile', 'update_mask', 'request_id', 'validate_only', 'force', ), + 'update_stream': ('stream', 'update_mask', 'request_id', 'validate_only', 'force', ), + } + + def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: + try: + key = original.func.attr.value + kword_params = self.METHOD_TO_PARAMS[key] + except (AttributeError, KeyError): + # Either not a method from the API or too convoluted to be sure. + return updated + + # If the existing code is valid, keyword args come after positional args. + # Therefore, all positional args must map to the first parameters. + args, kwargs = partition(lambda a: not bool(a.keyword), updated.args) + if any(k.keyword.value == "request" for k in kwargs): + # We've already fixed this file, don't fix it again. + return updated + + kwargs, ctrl_kwargs = partition( + lambda a: a.keyword.value not in self.CTRL_PARAMS, + kwargs + ) + + args, ctrl_args = args[:len(kword_params)], args[len(kword_params):] + ctrl_kwargs.extend(cst.Arg(value=a.value, keyword=cst.Name(value=ctrl)) + for a, ctrl in zip(ctrl_args, self.CTRL_PARAMS)) + + request_arg = cst.Arg( + value=cst.Dict([ + cst.DictElement( + cst.SimpleString("'{}'".format(name)), +cst.Element(value=arg.value) + ) + # Note: the args + kwargs looks silly, but keep in mind that + # the control parameters had to be stripped out, and that + # those could have been passed positionally or by keyword. + for name, arg in zip(kword_params, args + kwargs)]), + keyword=cst.Name("request") + ) + + return updated.with_changes( + args=[request_arg] + ctrl_kwargs + ) + + +def fix_files( + in_dir: pathlib.Path, + out_dir: pathlib.Path, + *, + transformer=datastreamCallTransformer(), +): + """Duplicate the input dir to the output dir, fixing file method calls. + + Preconditions: + * in_dir is a real directory + * out_dir is a real, empty directory + """ + pyfile_gen = ( + pathlib.Path(os.path.join(root, f)) + for root, _, files in os.walk(in_dir) + for f in files if os.path.splitext(f)[1] == ".py" + ) + + for fpath in pyfile_gen: + with open(fpath, 'r') as f: + src = f.read() + + # Parse the code and insert method call fixes. + tree = cst.parse_module(src) + updated = tree.visit(transformer) + + # Create the path and directory structure for the new file. + updated_path = out_dir.joinpath(fpath.relative_to(in_dir)) + updated_path.parent.mkdir(parents=True, exist_ok=True) + + # Generate the updated source file at the corresponding path. + with open(updated_path, 'w') as f: + f.write(updated.code) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser( + description="""Fix up source that uses the datastream client library. + +The existing sources are NOT overwritten but are copied to output_dir with changes made. + +Note: This tool operates at a best-effort level at converting positional + parameters in client method calls to keyword based parameters. + Cases where it WILL FAIL include + A) * or ** expansion in a method call. + B) Calls via function or method alias (includes free function calls) + C) Indirect or dispatched calls (e.g. the method is looked up dynamically) + + These all constitute false negatives. The tool will also detect false + positives when an API method shares a name with another method. +""") + parser.add_argument( + '-d', + '--input-directory', + required=True, + dest='input_dir', + help='the input directory to walk for python files to fix up', + ) + parser.add_argument( + '-o', + '--output-directory', + required=True, + dest='output_dir', + help='the directory to output files fixed via un-flattening', + ) + args = parser.parse_args() + input_dir = pathlib.Path(args.input_dir) + output_dir = pathlib.Path(args.output_dir) + if not input_dir.is_dir(): + print( + f"input directory '{input_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if not output_dir.is_dir(): + print( + f"output directory '{output_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if os.listdir(output_dir): + print( + f"output directory '{output_dir}' is not empty", + file=sys.stderr, + ) + sys.exit(-1) + + fix_files(input_dir, output_dir) diff --git a/owl-bot-staging/v1/setup.py b/owl-bot-staging/v1/setup.py new file mode 100644 index 0000000..098cbf9 --- /dev/null +++ b/owl-bot-staging/v1/setup.py @@ -0,0 +1,91 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import io +import os + +import setuptools # type: ignore + +package_root = os.path.abspath(os.path.dirname(__file__)) + +name = 'google-cloud-datastream' + + +description = "Google Cloud Datastream API client library" + +version = {} +with open(os.path.join(package_root, 'google/cloud/datastream/gapic_version.py')) as fp: + exec(fp.read(), version) +version = version["__version__"] + +if version[0] == "0": + release_status = "Development Status :: 4 - Beta" +else: + release_status = "Development Status :: 5 - Production/Stable" + +dependencies = [ + "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", + "proto-plus >= 1.22.0, <2.0.0dev", + "proto-plus >= 1.22.2, <2.0.0dev; python_version>='3.11'", + "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", + 'grpc-google-iam-v1 >= 0.12.4, < 1.0.0dev', +] +url = "https://github.com/googleapis/python-datastream" + +package_root = os.path.abspath(os.path.dirname(__file__)) + +readme_filename = os.path.join(package_root, "README.rst") +with io.open(readme_filename, encoding="utf-8") as readme_file: + readme = readme_file.read() + +packages = [ + package + for package in setuptools.PEP420PackageFinder.find() + if package.startswith("google") +] + +namespaces = ["google", "google.cloud"] + +setuptools.setup( + name=name, + version=version, + description=description, + long_description=readme, + author="Google LLC", + author_email="googleapis-packages@google.com", + license="Apache 2.0", + url=url, + classifiers=[ + release_status, + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Operating System :: OS Independent", + "Topic :: Internet", + ], + platforms="Posix; MacOS X; Windows", + packages=packages, + python_requires=">=3.7", + namespace_packages=namespaces, + install_requires=dependencies, + include_package_data=True, + zip_safe=False, +) diff --git a/owl-bot-staging/v1/testing/constraints-3.10.txt b/owl-bot-staging/v1/testing/constraints-3.10.txt new file mode 100644 index 0000000..ad3f0fa --- /dev/null +++ b/owl-bot-staging/v1/testing/constraints-3.10.txt @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf +grpc-google-iam-v1 diff --git a/owl-bot-staging/v1/testing/constraints-3.11.txt b/owl-bot-staging/v1/testing/constraints-3.11.txt new file mode 100644 index 0000000..ad3f0fa --- /dev/null +++ b/owl-bot-staging/v1/testing/constraints-3.11.txt @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf +grpc-google-iam-v1 diff --git a/owl-bot-staging/v1/testing/constraints-3.12.txt b/owl-bot-staging/v1/testing/constraints-3.12.txt new file mode 100644 index 0000000..ad3f0fa --- /dev/null +++ b/owl-bot-staging/v1/testing/constraints-3.12.txt @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf +grpc-google-iam-v1 diff --git a/owl-bot-staging/v1/testing/constraints-3.7.txt b/owl-bot-staging/v1/testing/constraints-3.7.txt new file mode 100644 index 0000000..2beecf9 --- /dev/null +++ b/owl-bot-staging/v1/testing/constraints-3.7.txt @@ -0,0 +1,10 @@ +# This constraints file is used to check that lower bounds +# are correct in setup.py +# List all library dependencies and extras in this file. +# Pin the version to the lower bound. +# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", +# Then this file should have google-cloud-foo==1.14.0 +google-api-core==1.34.0 +proto-plus==1.22.0 +protobuf==3.19.5 +grpc-google-iam-v1==0.12.4 diff --git a/owl-bot-staging/v1/testing/constraints-3.8.txt b/owl-bot-staging/v1/testing/constraints-3.8.txt new file mode 100644 index 0000000..ad3f0fa --- /dev/null +++ b/owl-bot-staging/v1/testing/constraints-3.8.txt @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf +grpc-google-iam-v1 diff --git a/owl-bot-staging/v1/testing/constraints-3.9.txt b/owl-bot-staging/v1/testing/constraints-3.9.txt new file mode 100644 index 0000000..ad3f0fa --- /dev/null +++ b/owl-bot-staging/v1/testing/constraints-3.9.txt @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf +grpc-google-iam-v1 diff --git a/owl-bot-staging/v1/tests/__init__.py b/owl-bot-staging/v1/tests/__init__.py new file mode 100644 index 0000000..231bc12 --- /dev/null +++ b/owl-bot-staging/v1/tests/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1/tests/unit/__init__.py b/owl-bot-staging/v1/tests/unit/__init__.py new file mode 100644 index 0000000..231bc12 --- /dev/null +++ b/owl-bot-staging/v1/tests/unit/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1/tests/unit/gapic/__init__.py b/owl-bot-staging/v1/tests/unit/gapic/__init__.py new file mode 100644 index 0000000..231bc12 --- /dev/null +++ b/owl-bot-staging/v1/tests/unit/gapic/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1/tests/unit/gapic/datastream_v1/__init__.py b/owl-bot-staging/v1/tests/unit/gapic/datastream_v1/__init__.py new file mode 100644 index 0000000..231bc12 --- /dev/null +++ b/owl-bot-staging/v1/tests/unit/gapic/datastream_v1/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1/tests/unit/gapic/datastream_v1/test_datastream.py b/owl-bot-staging/v1/tests/unit/gapic/datastream_v1/test_datastream.py new file mode 100644 index 0000000..eb290d0 --- /dev/null +++ b/owl-bot-staging/v1/tests/unit/gapic/datastream_v1/test_datastream.py @@ -0,0 +1,9022 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import os +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock # pragma: NO COVER +except ImportError: # pragma: NO COVER + import mock + +import grpc +from grpc.experimental import aio +import math +import pytest +from proto.marshal.rules.dates import DurationRule, TimestampRule +from proto.marshal.rules import wrappers + +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 +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.cloud.location import locations_pb2 +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import options_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore +from google.longrunning import operations_pb2 +from google.oauth2 import service_account +from google.protobuf import duration_pb2 # type: ignore +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 +import google.auth + + +def client_cert_source_callback(): + return b"cert bytes", b"key bytes" + + +# If default endpoint is localhost, then default mtls endpoint will be the same. +# This method modifies the default endpoint so the client can produce a different +# mtls endpoint for endpoint testing purposes. +def modify_default_endpoint(client): + return "foo.googleapis.com" if ("localhost" in client.DEFAULT_ENDPOINT) else client.DEFAULT_ENDPOINT + + +def test__get_default_mtls_endpoint(): + api_endpoint = "example.googleapis.com" + api_mtls_endpoint = "example.mtls.googleapis.com" + sandbox_endpoint = "example.sandbox.googleapis.com" + sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" + non_googleapi = "api.example.com" + + assert DatastreamClient._get_default_mtls_endpoint(None) is None + assert DatastreamClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint + assert DatastreamClient._get_default_mtls_endpoint(api_mtls_endpoint) == api_mtls_endpoint + assert DatastreamClient._get_default_mtls_endpoint(sandbox_endpoint) == sandbox_mtls_endpoint + assert DatastreamClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) == sandbox_mtls_endpoint + assert DatastreamClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi + + +@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, transport=transport_name) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + assert client.transport._host == ( + 'datastream.googleapis.com:443' + ) + + +@pytest.mark.parametrize("transport_class,transport_name", [ + (transports.DatastreamGrpcTransport, "grpc"), + (transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio"), +]) +def test_datastream_client_service_account_always_use_jwt(transport_class, transport_name): + with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) + + with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + + +@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", transport=transport_name) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + 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' + ) + + +def test_datastream_client_get_transport_class(): + transport = DatastreamClient.get_transport_class() + available_transports = [ + transports.DatastreamGrpcTransport, + ] + assert transport in available_transports + + transport = DatastreamClient.get_transport_class("grpc") + assert transport == transports.DatastreamGrpcTransport + + +@pytest.mark.parametrize("client_class,transport_class,transport_name", [ + (DatastreamClient, transports.DatastreamGrpcTransport, "grpc"), + (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio"), +]) +@mock.patch.object(DatastreamClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DatastreamClient)) +@mock.patch.object(DatastreamAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DatastreamAsyncClient)) +def test_datastream_client_client_options(client_class, transport_class, transport_name): + # Check that if channel is provided we won't create a new one. + with mock.patch.object(DatastreamClient, 'get_transport_class') as gtc: + transport = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ) + client = client_class(transport=transport) + gtc.assert_not_called() + + # Check that if channel is provided via str we will create a new one. + with mock.patch.object(DatastreamClient, 'get_transport_class') as gtc: + client = client_class(transport=transport_name) + gtc.assert_called() + + # Check the case api_endpoint is provided. + options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(transport=transport_name, client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is + # "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is + # "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has + # unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): + with pytest.raises(MutualTLSChannelError): + client = client_class(transport=transport_name) + + # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}): + with pytest.raises(ValueError): + client = client_class(transport=transport_name) + + # Check the case quota_project_id is provided + options = client_options.ClientOptions(quota_project_id="octopus") + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id="octopus", + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + # Check the case api_endpoint is provided + options = client_options.ClientOptions(api_audience="https://language.googleapis.com") + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience="https://language.googleapis.com" + ) + +@pytest.mark.parametrize("client_class,transport_class,transport_name,use_client_cert_env", [ + (DatastreamClient, transports.DatastreamGrpcTransport, "grpc", "true"), + (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio", "true"), + (DatastreamClient, transports.DatastreamGrpcTransport, "grpc", "false"), + (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio", "false"), +]) +@mock.patch.object(DatastreamClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DatastreamClient)) +@mock.patch.object(DatastreamAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DatastreamAsyncClient)) +@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) +def test_datastream_client_mtls_env_auto(client_class, transport_class, transport_name, use_client_cert_env): + # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default + # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. + + # Check the case client_cert_source is provided. Whether client cert is used depends on + # GOOGLE_API_USE_CLIENT_CERTIFICATE value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): + options = client_options.ClientOptions(client_cert_source=client_cert_source_callback) + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT + + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case ADC client cert is provided. Whether client cert is used depends on + # GOOGLE_API_USE_CLIENT_CERTIFICATE value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): + with mock.patch.object(transport_class, '__init__') as patched: + with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): + with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=client_cert_source_callback): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback + + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): + with mock.patch.object(transport_class, '__init__') as patched: + with mock.patch("google.auth.transport.mtls.has_default_client_cert_source", return_value=False): + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + +@pytest.mark.parametrize("client_class", [ + DatastreamClient, DatastreamAsyncClient +]) +@mock.patch.object(DatastreamClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DatastreamClient)) +@mock.patch.object(DatastreamAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DatastreamAsyncClient)) +def test_datastream_client_get_mtls_endpoint_and_cert_source(client_class): + mock_client_cert_source = mock.Mock() + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + mock_api_endpoint = "foo" + options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) + assert api_endpoint == mock_api_endpoint + assert cert_source == mock_client_cert_source + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): + mock_client_cert_source = mock.Mock() + mock_api_endpoint = "foo" + options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) + assert api_endpoint == mock_api_endpoint + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=False): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): + with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=mock_client_cert_source): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source == mock_client_cert_source + + +@pytest.mark.parametrize("client_class,transport_class,transport_name", [ + (DatastreamClient, transports.DatastreamGrpcTransport, "grpc"), + (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio"), +]) +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"], + ) + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=["1", "2"], + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + +@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ + (DatastreamClient, transports.DatastreamGrpcTransport, "grpc", grpc_helpers), + (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), +]) +def test_datastream_client_client_options_credentials_file(client_class, transport_class, transport_name, grpc_helpers): + # Check the case credentials file is provided. + options = client_options.ClientOptions( + credentials_file="credentials.json" + ) + + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + +def test_datastream_client_client_options_from_dict(): + with mock.patch('google.cloud.datastream_v1.services.datastream.transports.DatastreamGrpcTransport.__init__') as grpc_transport: + grpc_transport.return_value = None + client = DatastreamClient( + client_options={'api_endpoint': 'squid.clam.whelk'} + ) + grpc_transport.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + +@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ + (DatastreamClient, transports.DatastreamGrpcTransport, "grpc", grpc_helpers), + (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), +]) +def test_datastream_client_create_channel_credentials_file(client_class, transport_class, transport_name, grpc_helpers): + # Check the case credentials file is provided. + options = client_options.ClientOptions( + credentials_file="credentials.json" + ) + + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # test that the credentials from file are saved and used as the credentials. + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel" + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() + load_creds.return_value = (file_creds, None) + adc.return_value = (creds, None) + client = client_class(client_options=options, transport=transport_name) + create_channel.assert_called_with( + "datastream.googleapis.com:443", + credentials=file_creds, + credentials_file=None, + quota_project_id=None, + default_scopes=( + 'https://www.googleapis.com/auth/cloud-platform', +), + scopes=None, + default_host="datastream.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize("request_type", [ + datastream.ListConnectionProfilesRequest, + dict, +]) +def test_list_connection_profiles(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_connection_profiles), + '__call__') 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'], + ) + response = client.list_connection_profiles(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListConnectionProfilesRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListConnectionProfilesPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_connection_profiles), + '__call__') as call: + client.list_connection_profiles() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListConnectionProfilesRequest() + +@pytest.mark.asyncio +async def test_list_connection_profiles_async(transport: str = 'grpc_asyncio', request_type=datastream.ListConnectionProfilesRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_connection_profiles), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListConnectionProfilesResponse( + next_page_token='next_page_token_value', + unreachable=['unreachable_value'], + )) + response = await client.list_connection_profiles(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListConnectionProfilesRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListConnectionProfilesAsyncPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +@pytest.mark.asyncio +async def test_list_connection_profiles_async_from_dict(): + await test_list_connection_profiles_async(request_type=dict) + + +def test_list_connection_profiles_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_connection_profiles), + '__call__') as call: + call.return_value = datastream.ListConnectionProfilesResponse() + client.list_connection_profiles(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_connection_profiles), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListConnectionProfilesResponse()) + await client.list_connection_profiles(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_connection_profiles_flattened(): + 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_connection_profiles), + '__call__') as call: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_connection_profiles_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_list_connection_profiles_flattened_async(): + 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_connection_profiles), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream.ListConnectionProfilesResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListConnectionProfilesResponse()) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_connection_profiles_flattened_error_async(): + 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', + ) + + +def test_list_connection_profiles_pager(transport_name: str = "grpc"): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_connection_profiles), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListConnectionProfilesResponse( + connection_profiles=[ + datastream_resources.ConnectionProfile(), + datastream_resources.ConnectionProfile(), + datastream_resources.ConnectionProfile(), + ], + next_page_token='abc', + ), + datastream.ListConnectionProfilesResponse( + connection_profiles=[], + next_page_token='def', + ), + datastream.ListConnectionProfilesResponse( + connection_profiles=[ + datastream_resources.ConnectionProfile(), + ], + next_page_token='ghi', + ), + datastream.ListConnectionProfilesResponse( + connection_profiles=[ + datastream_resources.ConnectionProfile(), + datastream_resources.ConnectionProfile(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_connection_profiles(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, datastream_resources.ConnectionProfile) + for i in results) +def test_list_connection_profiles_pages(transport_name: str = "grpc"): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_connection_profiles), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListConnectionProfilesResponse( + connection_profiles=[ + datastream_resources.ConnectionProfile(), + datastream_resources.ConnectionProfile(), + datastream_resources.ConnectionProfile(), + ], + next_page_token='abc', + ), + datastream.ListConnectionProfilesResponse( + connection_profiles=[], + next_page_token='def', + ), + datastream.ListConnectionProfilesResponse( + connection_profiles=[ + datastream_resources.ConnectionProfile(), + ], + next_page_token='ghi', + ), + datastream.ListConnectionProfilesResponse( + connection_profiles=[ + datastream_resources.ConnectionProfile(), + datastream_resources.ConnectionProfile(), + ], + ), + RuntimeError, + ) + pages = list(client.list_connection_profiles(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_connection_profiles_async_pager(): + 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_connection_profiles), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListConnectionProfilesResponse( + connection_profiles=[ + datastream_resources.ConnectionProfile(), + datastream_resources.ConnectionProfile(), + datastream_resources.ConnectionProfile(), + ], + next_page_token='abc', + ), + datastream.ListConnectionProfilesResponse( + connection_profiles=[], + next_page_token='def', + ), + datastream.ListConnectionProfilesResponse( + connection_profiles=[ + datastream_resources.ConnectionProfile(), + ], + next_page_token='ghi', + ), + datastream.ListConnectionProfilesResponse( + connection_profiles=[ + datastream_resources.ConnectionProfile(), + datastream_resources.ConnectionProfile(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_connection_profiles(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, datastream_resources.ConnectionProfile) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_connection_profiles_async_pages(): + 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_connection_profiles), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListConnectionProfilesResponse( + connection_profiles=[ + datastream_resources.ConnectionProfile(), + datastream_resources.ConnectionProfile(), + datastream_resources.ConnectionProfile(), + ], + next_page_token='abc', + ), + datastream.ListConnectionProfilesResponse( + connection_profiles=[], + next_page_token='def', + ), + datastream.ListConnectionProfilesResponse( + connection_profiles=[ + datastream_resources.ConnectionProfile(), + ], + next_page_token='ghi', + ), + datastream.ListConnectionProfilesResponse( + connection_profiles=[ + datastream_resources.ConnectionProfile(), + datastream_resources.ConnectionProfile(), + ], + ), + RuntimeError, + ) + 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, +]) +def test_get_connection_profile(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream_resources.ConnectionProfile( + name='name_value', + display_name='display_name_value', + oracle_profile=datastream_resources.OracleProfile(hostname='hostname_value'), + static_service_ip_connectivity=None, + ) + response = client.get_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetConnectionProfileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream_resources.ConnectionProfile) + assert response.name == 'name_value' + assert response.display_name == 'display_name_value' + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_connection_profile), + '__call__') as call: + client.get_connection_profile() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetConnectionProfileRequest() + +@pytest.mark.asyncio +async def test_get_connection_profile_async(transport: str = 'grpc_asyncio', request_type=datastream.GetConnectionProfileRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_connection_profile), + '__call__') as call: + # 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', + )) + response = await client.get_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetConnectionProfileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream_resources.ConnectionProfile) + assert response.name == 'name_value' + assert response.display_name == 'display_name_value' + + +@pytest.mark.asyncio +async def test_get_connection_profile_async_from_dict(): + await test_get_connection_profile_async(request_type=dict) + + +def test_get_connection_profile_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_connection_profile), + '__call__') as call: + call.return_value = datastream_resources.ConnectionProfile() + client.get_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_connection_profile), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.ConnectionProfile()) + await client.get_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_connection_profile_flattened(): + 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_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_connection_profile_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_get_connection_profile_flattened_async(): + 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_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream_resources.ConnectionProfile() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.ConnectionProfile()) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_connection_profile_flattened_error_async(): + 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', + ) + + +@pytest.mark.parametrize("request_type", [ + datastream.CreateConnectionProfileRequest, + dict, +]) +def test_create_connection_profile(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.create_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.CreateConnectionProfileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_connection_profile), + '__call__') as call: + client.create_connection_profile() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.CreateConnectionProfileRequest() + +@pytest.mark.asyncio +async def test_create_connection_profile_async(transport: str = 'grpc_asyncio', request_type=datastream.CreateConnectionProfileRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.create_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.CreateConnectionProfileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_create_connection_profile_async_from_dict(): + await test_create_connection_profile_async(request_type=dict) + + +def test_create_connection_profile_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_connection_profile), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.create_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_connection_profile), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.create_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_create_connection_profile_flattened(): + 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_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + 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.create_connection_profile( + parent='parent_value', + connection_profile=datastream_resources.ConnectionProfile(name='name_value'), + connection_profile_id='connection_profile_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].connection_profile + mock_val = datastream_resources.ConnectionProfile(name='name_value') + assert arg == mock_val + arg = args[0].connection_profile_id + mock_val = 'connection_profile_id_value' + assert arg == mock_val + + +def test_create_connection_profile_flattened_error(): + 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.create_connection_profile( + datastream.CreateConnectionProfileRequest(), + parent='parent_value', + connection_profile=datastream_resources.ConnectionProfile(name='name_value'), + connection_profile_id='connection_profile_id_value', + ) + +@pytest.mark.asyncio +async def test_create_connection_profile_flattened_async(): + 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_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_connection_profile( + parent='parent_value', + connection_profile=datastream_resources.ConnectionProfile(name='name_value'), + connection_profile_id='connection_profile_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].connection_profile + mock_val = datastream_resources.ConnectionProfile(name='name_value') + assert arg == mock_val + arg = args[0].connection_profile_id + mock_val = 'connection_profile_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_create_connection_profile_flattened_error_async(): + 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.create_connection_profile( + datastream.CreateConnectionProfileRequest(), + parent='parent_value', + connection_profile=datastream_resources.ConnectionProfile(name='name_value'), + connection_profile_id='connection_profile_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + datastream.UpdateConnectionProfileRequest, + dict, +]) +def test_update_connection_profile(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.update_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.UpdateConnectionProfileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_connection_profile), + '__call__') as call: + client.update_connection_profile() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.UpdateConnectionProfileRequest() + +@pytest.mark.asyncio +async def test_update_connection_profile_async(transport: str = 'grpc_asyncio', request_type=datastream.UpdateConnectionProfileRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.update_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.UpdateConnectionProfileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_update_connection_profile_async_from_dict(): + await test_update_connection_profile_async(request_type=dict) + + +def test_update_connection_profile_field_headers(): + 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 = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_connection_profile), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.update_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + '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(), + ) + + # 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 = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_connection_profile), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.update_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'connection_profile.name=name_value', + ) in kw['metadata'] + + +def test_update_connection_profile_flattened(): + 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_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + 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.update_connection_profile( + connection_profile=datastream_resources.ConnectionProfile(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].connection_profile + mock_val = datastream_resources.ConnectionProfile(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + + +def test_update_connection_profile_flattened_error(): + 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.update_connection_profile( + datastream.UpdateConnectionProfileRequest(), + connection_profile=datastream_resources.ConnectionProfile(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + +@pytest.mark.asyncio +async def test_update_connection_profile_flattened_async(): + 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_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_connection_profile( + connection_profile=datastream_resources.ConnectionProfile(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].connection_profile + mock_val = datastream_resources.ConnectionProfile(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + +@pytest.mark.asyncio +async def test_update_connection_profile_flattened_error_async(): + 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.update_connection_profile( + datastream.UpdateConnectionProfileRequest(), + connection_profile=datastream_resources.ConnectionProfile(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + +@pytest.mark.parametrize("request_type", [ + datastream.DeleteConnectionProfileRequest, + dict, +]) +def test_delete_connection_profile(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.delete_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DeleteConnectionProfileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_connection_profile), + '__call__') as call: + client.delete_connection_profile() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DeleteConnectionProfileRequest() + +@pytest.mark.asyncio +async def test_delete_connection_profile_async(transport: str = 'grpc_asyncio', request_type=datastream.DeleteConnectionProfileRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.delete_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DeleteConnectionProfileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_delete_connection_profile_async_from_dict(): + await test_delete_connection_profile_async(request_type=dict) + + +def test_delete_connection_profile_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_connection_profile), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.delete_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_connection_profile), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.delete_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_delete_connection_profile_flattened(): + 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_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_delete_connection_profile_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_delete_connection_profile_flattened_async(): + 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_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_delete_connection_profile_flattened_error_async(): + 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', + ) + + +@pytest.mark.parametrize("request_type", [ + datastream.DiscoverConnectionProfileRequest, + dict, +]) +def test_discover_connection_profile(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.discover_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream.DiscoverConnectionProfileResponse( + oracle_rdbms=datastream_resources.OracleRdbms(oracle_schemas=[datastream_resources.OracleSchema(schema='schema_value')]), + ) + response = client.discover_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DiscoverConnectionProfileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream.DiscoverConnectionProfileResponse) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.discover_connection_profile), + '__call__') as call: + client.discover_connection_profile() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DiscoverConnectionProfileRequest() + +@pytest.mark.asyncio +async def test_discover_connection_profile_async(transport: str = 'grpc_asyncio', request_type=datastream.DiscoverConnectionProfileRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.discover_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.DiscoverConnectionProfileResponse( + )) + response = await client.discover_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DiscoverConnectionProfileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream.DiscoverConnectionProfileResponse) + + +@pytest.mark.asyncio +async def test_discover_connection_profile_async_from_dict(): + await test_discover_connection_profile_async(request_type=dict) + + +def test_discover_connection_profile_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.discover_connection_profile), + '__call__') as call: + call.return_value = datastream.DiscoverConnectionProfileResponse() + client.discover_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.discover_connection_profile), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.DiscoverConnectionProfileResponse()) + await client.discover_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@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, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + 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'], + ) + response = client.list_streams(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListStreamsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListStreamsPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_streams), + '__call__') as call: + client.list_streams() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListStreamsRequest() + +@pytest.mark.asyncio +async def test_list_streams_async(transport: str = 'grpc_asyncio', request_type=datastream.ListStreamsRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_streams), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListStreamsResponse( + next_page_token='next_page_token_value', + unreachable=['unreachable_value'], + )) + response = await client.list_streams(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListStreamsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListStreamsAsyncPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +@pytest.mark.asyncio +async def test_list_streams_async_from_dict(): + await test_list_streams_async(request_type=dict) + + +def test_list_streams_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_streams), + '__call__') as call: + call.return_value = datastream.ListStreamsResponse() + client.list_streams(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_streams), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListStreamsResponse()) + await client.list_streams(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_streams_flattened(): + 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: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_streams_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_list_streams_flattened_async(): + 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: + # Designate an appropriate return value for the call. + call.return_value = datastream.ListStreamsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListStreamsResponse()) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_streams_flattened_error_async(): + 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', + ) + + +def test_list_streams_pager(transport_name: str = "grpc"): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_streams), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListStreamsResponse( + streams=[ + datastream_resources.Stream(), + datastream_resources.Stream(), + datastream_resources.Stream(), + ], + next_page_token='abc', + ), + datastream.ListStreamsResponse( + streams=[], + next_page_token='def', + ), + datastream.ListStreamsResponse( + streams=[ + datastream_resources.Stream(), + ], + next_page_token='ghi', + ), + datastream.ListStreamsResponse( + streams=[ + datastream_resources.Stream(), + datastream_resources.Stream(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_streams(request={}) + + assert pager._metadata == metadata + + 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, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_streams), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListStreamsResponse( + streams=[ + datastream_resources.Stream(), + datastream_resources.Stream(), + datastream_resources.Stream(), + ], + next_page_token='abc', + ), + datastream.ListStreamsResponse( + streams=[], + next_page_token='def', + ), + datastream.ListStreamsResponse( + streams=[ + datastream_resources.Stream(), + ], + next_page_token='ghi', + ), + datastream.ListStreamsResponse( + streams=[ + datastream_resources.Stream(), + datastream_resources.Stream(), + ], + ), + RuntimeError, + ) + pages = list(client.list_streams(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_streams_async_pager(): + 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__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListStreamsResponse( + streams=[ + datastream_resources.Stream(), + datastream_resources.Stream(), + datastream_resources.Stream(), + ], + next_page_token='abc', + ), + datastream.ListStreamsResponse( + streams=[], + next_page_token='def', + ), + datastream.ListStreamsResponse( + 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={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, datastream_resources.Stream) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_streams_async_pages(): + 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__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListStreamsResponse( + streams=[ + datastream_resources.Stream(), + datastream_resources.Stream(), + datastream_resources.Stream(), + ], + next_page_token='abc', + ), + datastream.ListStreamsResponse( + streams=[], + next_page_token='def', + ), + datastream.ListStreamsResponse( + 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: # 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, +]) +def test_get_stream(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_stream), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream_resources.Stream( + name='name_value', + display_name='display_name_value', + state=datastream_resources.Stream.State.NOT_STARTED, + customer_managed_encryption_key='customer_managed_encryption_key_value', + backfill_all=datastream_resources.Stream.BackfillAllStrategy(oracle_excluded_objects=datastream_resources.OracleRdbms(oracle_schemas=[datastream_resources.OracleSchema(schema='schema_value')])), + ) + response = client.get_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetStreamRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream_resources.Stream) + assert response.name == 'name_value' + assert response.display_name == 'display_name_value' + assert response.state == datastream_resources.Stream.State.NOT_STARTED + assert response.customer_managed_encryption_key == 'customer_managed_encryption_key_value' + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_stream), + '__call__') as call: + client.get_stream() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetStreamRequest() + +@pytest.mark.asyncio +async def test_get_stream_async(transport: str = 'grpc_asyncio', request_type=datastream.GetStreamRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_stream), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.Stream( + name='name_value', + display_name='display_name_value', + state=datastream_resources.Stream.State.NOT_STARTED, + customer_managed_encryption_key='customer_managed_encryption_key_value', + )) + response = await client.get_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetStreamRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream_resources.Stream) + assert response.name == 'name_value' + assert response.display_name == 'display_name_value' + assert response.state == datastream_resources.Stream.State.NOT_STARTED + assert response.customer_managed_encryption_key == 'customer_managed_encryption_key_value' + + +@pytest.mark.asyncio +async def test_get_stream_async_from_dict(): + await test_get_stream_async(request_type=dict) + + +def test_get_stream_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_stream), + '__call__') as call: + call.return_value = datastream_resources.Stream() + client.get_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_stream), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.Stream()) + await client.get_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_stream_flattened(): + 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: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_stream_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_get_stream_flattened_async(): + 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: + # Designate an appropriate return value for the call. + call.return_value = datastream_resources.Stream() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.Stream()) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_stream_flattened_error_async(): + 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', + ) + + +@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, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_stream), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.create_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.CreateStreamRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_stream), + '__call__') as call: + client.create_stream() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.CreateStreamRequest() + +@pytest.mark.asyncio +async def test_create_stream_async(transport: str = 'grpc_asyncio', request_type=datastream.CreateStreamRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_stream), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.create_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.CreateStreamRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_create_stream_async_from_dict(): + await test_create_stream_async(request_type=dict) + + +def test_create_stream_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_stream), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.create_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_stream), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.create_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_create_stream_flattened(): + 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: + # Designate an appropriate return value for the call. + 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.create_stream( + parent='parent_value', + stream=datastream_resources.Stream(name='name_value'), + stream_id='stream_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].stream + mock_val = datastream_resources.Stream(name='name_value') + assert arg == mock_val + arg = args[0].stream_id + mock_val = 'stream_id_value' + assert arg == mock_val + + +def test_create_stream_flattened_error(): + 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.create_stream( + datastream.CreateStreamRequest(), + parent='parent_value', + stream=datastream_resources.Stream(name='name_value'), + stream_id='stream_id_value', + ) + +@pytest.mark.asyncio +async def test_create_stream_flattened_async(): + 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: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_stream( + parent='parent_value', + stream=datastream_resources.Stream(name='name_value'), + stream_id='stream_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].stream + mock_val = datastream_resources.Stream(name='name_value') + assert arg == mock_val + arg = args[0].stream_id + mock_val = 'stream_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_create_stream_flattened_error_async(): + 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.create_stream( + datastream.CreateStreamRequest(), + parent='parent_value', + stream=datastream_resources.Stream(name='name_value'), + stream_id='stream_id_value', + ) + + +@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, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_stream), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.update_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.UpdateStreamRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_stream), + '__call__') as call: + client.update_stream() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.UpdateStreamRequest() + +@pytest.mark.asyncio +async def test_update_stream_async(transport: str = 'grpc_asyncio', request_type=datastream.UpdateStreamRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_stream), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.update_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.UpdateStreamRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_update_stream_async_from_dict(): + await test_update_stream_async(request_type=dict) + + +def test_update_stream_field_headers(): + 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 = '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: + call.return_value = operations_pb2.Operation(name='operations/op') + client.update_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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 = '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: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.update_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'stream.name=name_value', + ) in kw['metadata'] + + +def test_update_stream_flattened(): + 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: + # Designate an appropriate return value for the call. + 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.update_stream( + stream=datastream_resources.Stream(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].stream + mock_val = datastream_resources.Stream(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + + +def test_update_stream_flattened_error(): + 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.update_stream( + datastream.UpdateStreamRequest(), + stream=datastream_resources.Stream(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + +@pytest.mark.asyncio +async def test_update_stream_flattened_async(): + 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: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_stream( + stream=datastream_resources.Stream(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].stream + mock_val = datastream_resources.Stream(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + +@pytest.mark.asyncio +async def test_update_stream_flattened_error_async(): + 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.update_stream( + datastream.UpdateStreamRequest(), + stream=datastream_resources.Stream(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + +@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, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_stream), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.delete_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DeleteStreamRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_stream), + '__call__') as call: + client.delete_stream() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DeleteStreamRequest() + +@pytest.mark.asyncio +async def test_delete_stream_async(transport: str = 'grpc_asyncio', request_type=datastream.DeleteStreamRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_stream), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.delete_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DeleteStreamRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_delete_stream_async_from_dict(): + await test_delete_stream_async(request_type=dict) + + +def test_delete_stream_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_stream), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.delete_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_stream), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.delete_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_delete_stream_flattened(): + 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: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_delete_stream_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_delete_stream_flattened_async(): + 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: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_delete_stream_flattened_error_async(): + 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', + ) + + +@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, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_stream_object), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream_resources.StreamObject( + name='name_value', + display_name='display_name_value', + ) + response = client.get_stream_object(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetStreamObjectRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream_resources.StreamObject) + assert response.name == 'name_value' + assert response.display_name == 'display_name_value' + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_stream_object), + '__call__') as call: + client.get_stream_object() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetStreamObjectRequest() + +@pytest.mark.asyncio +async def test_get_stream_object_async(transport: str = 'grpc_asyncio', request_type=datastream.GetStreamObjectRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_stream_object), + '__call__') as call: + # 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', + )) + response = await client.get_stream_object(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetStreamObjectRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream_resources.StreamObject) + assert response.name == 'name_value' + assert response.display_name == 'display_name_value' + + +@pytest.mark.asyncio +async def test_get_stream_object_async_from_dict(): + await test_get_stream_object_async(request_type=dict) + + +def test_get_stream_object_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_stream_object), + '__call__') as call: + call.return_value = datastream_resources.StreamObject() + client.get_stream_object(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_stream_object), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.StreamObject()) + await client.get_stream_object(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_stream_object_flattened(): + 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_object), + '__call__') as call: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_stream_object_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_get_stream_object_flattened_async(): + 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_object), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream_resources.StreamObject() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.StreamObject()) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_stream_object_flattened_error_async(): + 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', + ) + + +@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, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.lookup_stream_object), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream_resources.StreamObject( + name='name_value', + display_name='display_name_value', + ) + response = client.lookup_stream_object(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.LookupStreamObjectRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream_resources.StreamObject) + assert response.name == 'name_value' + assert response.display_name == 'display_name_value' + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.lookup_stream_object), + '__call__') as call: + client.lookup_stream_object() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.LookupStreamObjectRequest() + +@pytest.mark.asyncio +async def test_lookup_stream_object_async(transport: str = 'grpc_asyncio', request_type=datastream.LookupStreamObjectRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.lookup_stream_object), + '__call__') as call: + # 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', + )) + response = await client.lookup_stream_object(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.LookupStreamObjectRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream_resources.StreamObject) + assert response.name == 'name_value' + assert response.display_name == 'display_name_value' + + +@pytest.mark.asyncio +async def test_lookup_stream_object_async_from_dict(): + await test_lookup_stream_object_async(request_type=dict) + + +def test_lookup_stream_object_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.lookup_stream_object), + '__call__') as call: + call.return_value = datastream_resources.StreamObject() + client.lookup_stream_object(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.lookup_stream_object), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.StreamObject()) + await client.lookup_stream_object(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@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, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_stream_objects), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream.ListStreamObjectsResponse( + next_page_token='next_page_token_value', + ) + response = client.list_stream_objects(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListStreamObjectsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListStreamObjectsPager) + assert response.next_page_token == 'next_page_token_value' + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_stream_objects), + '__call__') as call: + client.list_stream_objects() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListStreamObjectsRequest() + +@pytest.mark.asyncio +async def test_list_stream_objects_async(transport: str = 'grpc_asyncio', request_type=datastream.ListStreamObjectsRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_stream_objects), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListStreamObjectsResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_stream_objects(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListStreamObjectsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListStreamObjectsAsyncPager) + assert response.next_page_token == 'next_page_token_value' + + +@pytest.mark.asyncio +async def test_list_stream_objects_async_from_dict(): + await test_list_stream_objects_async(request_type=dict) + + +def test_list_stream_objects_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_stream_objects), + '__call__') as call: + call.return_value = datastream.ListStreamObjectsResponse() + client.list_stream_objects(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_stream_objects), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListStreamObjectsResponse()) + await client.list_stream_objects(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_stream_objects_flattened(): + 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_stream_objects), + '__call__') as call: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_stream_objects_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_list_stream_objects_flattened_async(): + 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_stream_objects), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream.ListStreamObjectsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListStreamObjectsResponse()) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_stream_objects_flattened_error_async(): + 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', + ) + + +def test_list_stream_objects_pager(transport_name: str = "grpc"): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_stream_objects), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListStreamObjectsResponse( + stream_objects=[ + datastream_resources.StreamObject(), + datastream_resources.StreamObject(), + datastream_resources.StreamObject(), + ], + next_page_token='abc', + ), + datastream.ListStreamObjectsResponse( + stream_objects=[], + next_page_token='def', + ), + datastream.ListStreamObjectsResponse( + stream_objects=[ + datastream_resources.StreamObject(), + ], + next_page_token='ghi', + ), + datastream.ListStreamObjectsResponse( + stream_objects=[ + datastream_resources.StreamObject(), + datastream_resources.StreamObject(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_stream_objects(request={}) + + assert pager._metadata == metadata + + 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, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_stream_objects), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListStreamObjectsResponse( + stream_objects=[ + datastream_resources.StreamObject(), + datastream_resources.StreamObject(), + datastream_resources.StreamObject(), + ], + next_page_token='abc', + ), + datastream.ListStreamObjectsResponse( + stream_objects=[], + next_page_token='def', + ), + datastream.ListStreamObjectsResponse( + stream_objects=[ + datastream_resources.StreamObject(), + ], + next_page_token='ghi', + ), + datastream.ListStreamObjectsResponse( + stream_objects=[ + datastream_resources.StreamObject(), + datastream_resources.StreamObject(), + ], + ), + RuntimeError, + ) + pages = list(client.list_stream_objects(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_stream_objects_async_pager(): + 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_stream_objects), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListStreamObjectsResponse( + stream_objects=[ + datastream_resources.StreamObject(), + datastream_resources.StreamObject(), + datastream_resources.StreamObject(), + ], + next_page_token='abc', + ), + datastream.ListStreamObjectsResponse( + stream_objects=[], + next_page_token='def', + ), + datastream.ListStreamObjectsResponse( + stream_objects=[ + datastream_resources.StreamObject(), + ], + next_page_token='ghi', + ), + datastream.ListStreamObjectsResponse( + stream_objects=[ + datastream_resources.StreamObject(), + datastream_resources.StreamObject(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_stream_objects(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, datastream_resources.StreamObject) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_stream_objects_async_pages(): + 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_stream_objects), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListStreamObjectsResponse( + stream_objects=[ + datastream_resources.StreamObject(), + datastream_resources.StreamObject(), + datastream_resources.StreamObject(), + ], + next_page_token='abc', + ), + datastream.ListStreamObjectsResponse( + stream_objects=[], + next_page_token='def', + ), + datastream.ListStreamObjectsResponse( + stream_objects=[ + datastream_resources.StreamObject(), + ], + next_page_token='ghi', + ), + datastream.ListStreamObjectsResponse( + stream_objects=[ + datastream_resources.StreamObject(), + datastream_resources.StreamObject(), + ], + ), + RuntimeError, + ) + 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, +]) +def test_start_backfill_job(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.start_backfill_job), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream.StartBackfillJobResponse( + ) + response = client.start_backfill_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.StartBackfillJobRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream.StartBackfillJobResponse) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.start_backfill_job), + '__call__') as call: + client.start_backfill_job() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.StartBackfillJobRequest() + +@pytest.mark.asyncio +async def test_start_backfill_job_async(transport: str = 'grpc_asyncio', request_type=datastream.StartBackfillJobRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.start_backfill_job), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.StartBackfillJobResponse( + )) + response = await client.start_backfill_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.StartBackfillJobRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream.StartBackfillJobResponse) + + +@pytest.mark.asyncio +async def test_start_backfill_job_async_from_dict(): + await test_start_backfill_job_async(request_type=dict) + + +def test_start_backfill_job_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.start_backfill_job), + '__call__') as call: + call.return_value = datastream.StartBackfillJobResponse() + client.start_backfill_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.start_backfill_job), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.StartBackfillJobResponse()) + await client.start_backfill_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'object=object__value', + ) in kw['metadata'] + + +def test_start_backfill_job_flattened(): + 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.start_backfill_job), + '__call__') as call: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].object_ + mock_val = 'object__value' + assert arg == mock_val + + +def test_start_backfill_job_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_start_backfill_job_flattened_async(): + 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.start_backfill_job), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream.StartBackfillJobResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.StartBackfillJobResponse()) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].object_ + mock_val = 'object__value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_start_backfill_job_flattened_error_async(): + 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', + ) + + +@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, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.stop_backfill_job), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream.StopBackfillJobResponse( + ) + response = client.stop_backfill_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.StopBackfillJobRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream.StopBackfillJobResponse) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.stop_backfill_job), + '__call__') as call: + client.stop_backfill_job() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.StopBackfillJobRequest() + +@pytest.mark.asyncio +async def test_stop_backfill_job_async(transport: str = 'grpc_asyncio', request_type=datastream.StopBackfillJobRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.stop_backfill_job), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.StopBackfillJobResponse( + )) + response = await client.stop_backfill_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.StopBackfillJobRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream.StopBackfillJobResponse) + + +@pytest.mark.asyncio +async def test_stop_backfill_job_async_from_dict(): + await test_stop_backfill_job_async(request_type=dict) + + +def test_stop_backfill_job_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.stop_backfill_job), + '__call__') as call: + call.return_value = datastream.StopBackfillJobResponse() + client.stop_backfill_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.stop_backfill_job), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.StopBackfillJobResponse()) + await client.stop_backfill_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'object=object__value', + ) in kw['metadata'] + + +def test_stop_backfill_job_flattened(): + 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.stop_backfill_job), + '__call__') as call: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].object_ + mock_val = 'object__value' + assert arg == mock_val + + +def test_stop_backfill_job_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_stop_backfill_job_flattened_async(): + 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.stop_backfill_job), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream.StopBackfillJobResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.StopBackfillJobResponse()) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].object_ + mock_val = 'object__value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_stop_backfill_job_flattened_error_async(): + 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', + ) + + +@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, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # 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: + # 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', + ) + response = client.fetch_static_ips(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.FetchStaticIpsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.FetchStaticIpsPager) + assert response.static_ips == ['static_ips_value'] + assert response.next_page_token == 'next_page_token_value' + + +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', + ) + + # 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: + client.fetch_static_ips() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.FetchStaticIpsRequest() + +@pytest.mark.asyncio +async def test_fetch_static_ips_async(transport: str = 'grpc_asyncio', request_type=datastream.FetchStaticIpsRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # 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: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.FetchStaticIpsResponse( + static_ips=['static_ips_value'], + next_page_token='next_page_token_value', + )) + response = await client.fetch_static_ips(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.FetchStaticIpsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.FetchStaticIpsAsyncPager) + assert response.static_ips == ['static_ips_value'] + assert response.next_page_token == 'next_page_token_value' + + +@pytest.mark.asyncio +async def test_fetch_static_ips_async_from_dict(): + await test_fetch_static_ips_async(request_type=dict) + + +def test_fetch_static_ips_field_headers(): + 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' + + # 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: + call.return_value = datastream.FetchStaticIpsResponse() + client.fetch_static_ips(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # 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: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.FetchStaticIpsResponse()) + await client.fetch_static_ips(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_fetch_static_ips_flattened(): + 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: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_fetch_static_ips_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_fetch_static_ips_flattened_async(): + 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: + # Designate an appropriate return value for the call. + call.return_value = datastream.FetchStaticIpsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.FetchStaticIpsResponse()) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_fetch_static_ips_flattened_error_async(): + 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', + ) + + +def test_fetch_static_ips_pager(transport_name: str = "grpc"): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # 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: + # Set the response to a series of pages. + call.side_effect = ( + datastream.FetchStaticIpsResponse( + 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=[ + str(), + str(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('name', ''), + )), + ) + pager = client.fetch_static_ips(request={}) + + assert pager._metadata == metadata + + 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, + ) + + # 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: + # Set the response to a series of pages. + call.side_effect = ( + datastream.FetchStaticIpsResponse( + 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=[ + str(), + str(), + ], + ), + RuntimeError, + ) + pages = list(client.fetch_static_ips(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_fetch_static_ips_async_pager(): + 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__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.FetchStaticIpsResponse( + 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=[ + str(), + str(), + ], + ), + RuntimeError, + ) + async_pager = await client.fetch_static_ips(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, str) + for i in responses) + + +@pytest.mark.asyncio +async def test_fetch_static_ips_async_pages(): + 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__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.FetchStaticIpsResponse( + 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=[ + str(), + str(), + ], + ), + RuntimeError, + ) + 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, +]) +def test_create_private_connection(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_private_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.create_private_connection(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.CreatePrivateConnectionRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_private_connection), + '__call__') as call: + client.create_private_connection() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.CreatePrivateConnectionRequest() + +@pytest.mark.asyncio +async def test_create_private_connection_async(transport: str = 'grpc_asyncio', request_type=datastream.CreatePrivateConnectionRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_private_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.create_private_connection(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.CreatePrivateConnectionRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_create_private_connection_async_from_dict(): + await test_create_private_connection_async(request_type=dict) + + +def test_create_private_connection_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_private_connection), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.create_private_connection(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_private_connection), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.create_private_connection(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_create_private_connection_flattened(): + 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_private_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + 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.create_private_connection( + parent='parent_value', + private_connection=datastream_resources.PrivateConnection(name='name_value'), + private_connection_id='private_connection_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].private_connection + mock_val = datastream_resources.PrivateConnection(name='name_value') + assert arg == mock_val + arg = args[0].private_connection_id + mock_val = 'private_connection_id_value' + assert arg == mock_val + + +def test_create_private_connection_flattened_error(): + 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.create_private_connection( + datastream.CreatePrivateConnectionRequest(), + parent='parent_value', + private_connection=datastream_resources.PrivateConnection(name='name_value'), + private_connection_id='private_connection_id_value', + ) + +@pytest.mark.asyncio +async def test_create_private_connection_flattened_async(): + 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_private_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_private_connection( + parent='parent_value', + private_connection=datastream_resources.PrivateConnection(name='name_value'), + private_connection_id='private_connection_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].private_connection + mock_val = datastream_resources.PrivateConnection(name='name_value') + assert arg == mock_val + arg = args[0].private_connection_id + mock_val = 'private_connection_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_create_private_connection_flattened_error_async(): + 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.create_private_connection( + datastream.CreatePrivateConnectionRequest(), + parent='parent_value', + private_connection=datastream_resources.PrivateConnection(name='name_value'), + private_connection_id='private_connection_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + datastream.GetPrivateConnectionRequest, + dict, +]) +def test_get_private_connection(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_private_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream_resources.PrivateConnection( + name='name_value', + display_name='display_name_value', + state=datastream_resources.PrivateConnection.State.CREATING, + ) + response = client.get_private_connection(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetPrivateConnectionRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream_resources.PrivateConnection) + assert response.name == 'name_value' + assert response.display_name == 'display_name_value' + assert response.state == datastream_resources.PrivateConnection.State.CREATING + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_private_connection), + '__call__') as call: + client.get_private_connection() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetPrivateConnectionRequest() + +@pytest.mark.asyncio +async def test_get_private_connection_async(transport: str = 'grpc_asyncio', request_type=datastream.GetPrivateConnectionRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_private_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.PrivateConnection( + name='name_value', + display_name='display_name_value', + state=datastream_resources.PrivateConnection.State.CREATING, + )) + response = await client.get_private_connection(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetPrivateConnectionRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream_resources.PrivateConnection) + assert response.name == 'name_value' + assert response.display_name == 'display_name_value' + assert response.state == datastream_resources.PrivateConnection.State.CREATING + + +@pytest.mark.asyncio +async def test_get_private_connection_async_from_dict(): + await test_get_private_connection_async(request_type=dict) + + +def test_get_private_connection_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_private_connection), + '__call__') as call: + call.return_value = datastream_resources.PrivateConnection() + client.get_private_connection(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_private_connection), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.PrivateConnection()) + await client.get_private_connection(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_private_connection_flattened(): + 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_private_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_private_connection_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_get_private_connection_flattened_async(): + 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_private_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream_resources.PrivateConnection() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.PrivateConnection()) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_private_connection_flattened_error_async(): + 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', + ) + + +@pytest.mark.parametrize("request_type", [ + datastream.ListPrivateConnectionsRequest, + dict, +]) +def test_list_private_connections(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_private_connections), + '__call__') 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'], + ) + response = client.list_private_connections(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListPrivateConnectionsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListPrivateConnectionsPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_private_connections), + '__call__') as call: + client.list_private_connections() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListPrivateConnectionsRequest() + +@pytest.mark.asyncio +async def test_list_private_connections_async(transport: str = 'grpc_asyncio', request_type=datastream.ListPrivateConnectionsRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_private_connections), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListPrivateConnectionsResponse( + next_page_token='next_page_token_value', + unreachable=['unreachable_value'], + )) + response = await client.list_private_connections(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListPrivateConnectionsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListPrivateConnectionsAsyncPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +@pytest.mark.asyncio +async def test_list_private_connections_async_from_dict(): + await test_list_private_connections_async(request_type=dict) + + +def test_list_private_connections_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_private_connections), + '__call__') as call: + call.return_value = datastream.ListPrivateConnectionsResponse() + client.list_private_connections(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_private_connections), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListPrivateConnectionsResponse()) + await client.list_private_connections(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_private_connections_flattened(): + 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_private_connections), + '__call__') as call: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_private_connections_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_list_private_connections_flattened_async(): + 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_private_connections), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream.ListPrivateConnectionsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListPrivateConnectionsResponse()) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_private_connections_flattened_error_async(): + 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', + ) + + +def test_list_private_connections_pager(transport_name: str = "grpc"): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_private_connections), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListPrivateConnectionsResponse( + private_connections=[ + datastream_resources.PrivateConnection(), + datastream_resources.PrivateConnection(), + datastream_resources.PrivateConnection(), + ], + next_page_token='abc', + ), + datastream.ListPrivateConnectionsResponse( + private_connections=[], + next_page_token='def', + ), + datastream.ListPrivateConnectionsResponse( + private_connections=[ + datastream_resources.PrivateConnection(), + ], + next_page_token='ghi', + ), + datastream.ListPrivateConnectionsResponse( + private_connections=[ + datastream_resources.PrivateConnection(), + datastream_resources.PrivateConnection(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_private_connections(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, datastream_resources.PrivateConnection) + for i in results) +def test_list_private_connections_pages(transport_name: str = "grpc"): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_private_connections), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListPrivateConnectionsResponse( + private_connections=[ + datastream_resources.PrivateConnection(), + datastream_resources.PrivateConnection(), + datastream_resources.PrivateConnection(), + ], + next_page_token='abc', + ), + datastream.ListPrivateConnectionsResponse( + private_connections=[], + next_page_token='def', + ), + datastream.ListPrivateConnectionsResponse( + private_connections=[ + datastream_resources.PrivateConnection(), + ], + next_page_token='ghi', + ), + datastream.ListPrivateConnectionsResponse( + private_connections=[ + datastream_resources.PrivateConnection(), + datastream_resources.PrivateConnection(), + ], + ), + RuntimeError, + ) + pages = list(client.list_private_connections(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_private_connections_async_pager(): + 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_private_connections), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListPrivateConnectionsResponse( + private_connections=[ + datastream_resources.PrivateConnection(), + datastream_resources.PrivateConnection(), + datastream_resources.PrivateConnection(), + ], + next_page_token='abc', + ), + datastream.ListPrivateConnectionsResponse( + private_connections=[], + next_page_token='def', + ), + datastream.ListPrivateConnectionsResponse( + private_connections=[ + datastream_resources.PrivateConnection(), + ], + next_page_token='ghi', + ), + datastream.ListPrivateConnectionsResponse( + private_connections=[ + datastream_resources.PrivateConnection(), + datastream_resources.PrivateConnection(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_private_connections(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, datastream_resources.PrivateConnection) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_private_connections_async_pages(): + 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_private_connections), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListPrivateConnectionsResponse( + private_connections=[ + datastream_resources.PrivateConnection(), + datastream_resources.PrivateConnection(), + datastream_resources.PrivateConnection(), + ], + next_page_token='abc', + ), + datastream.ListPrivateConnectionsResponse( + private_connections=[], + next_page_token='def', + ), + datastream.ListPrivateConnectionsResponse( + private_connections=[ + datastream_resources.PrivateConnection(), + ], + next_page_token='ghi', + ), + datastream.ListPrivateConnectionsResponse( + private_connections=[ + datastream_resources.PrivateConnection(), + datastream_resources.PrivateConnection(), + ], + ), + RuntimeError, + ) + 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, +]) +def test_delete_private_connection(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_private_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.delete_private_connection(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DeletePrivateConnectionRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_private_connection), + '__call__') as call: + client.delete_private_connection() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DeletePrivateConnectionRequest() + +@pytest.mark.asyncio +async def test_delete_private_connection_async(transport: str = 'grpc_asyncio', request_type=datastream.DeletePrivateConnectionRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_private_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.delete_private_connection(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DeletePrivateConnectionRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_delete_private_connection_async_from_dict(): + await test_delete_private_connection_async(request_type=dict) + + +def test_delete_private_connection_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_private_connection), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.delete_private_connection(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_private_connection), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.delete_private_connection(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_delete_private_connection_flattened(): + 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_private_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_delete_private_connection_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_delete_private_connection_flattened_async(): + 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_private_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_delete_private_connection_flattened_error_async(): + 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', + ) + + +@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, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_route), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.create_route(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.CreateRouteRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_route), + '__call__') as call: + client.create_route() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.CreateRouteRequest() + +@pytest.mark.asyncio +async def test_create_route_async(transport: str = 'grpc_asyncio', request_type=datastream.CreateRouteRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_route), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.create_route(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.CreateRouteRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_create_route_async_from_dict(): + await test_create_route_async(request_type=dict) + + +def test_create_route_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_route), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.create_route(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_route), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.create_route(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_create_route_flattened(): + 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: + # Designate an appropriate return value for the call. + 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.create_route( + parent='parent_value', + route=datastream_resources.Route(name='name_value'), + route_id='route_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].route + mock_val = datastream_resources.Route(name='name_value') + assert arg == mock_val + arg = args[0].route_id + mock_val = 'route_id_value' + assert arg == mock_val + + +def test_create_route_flattened_error(): + 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.create_route( + datastream.CreateRouteRequest(), + parent='parent_value', + route=datastream_resources.Route(name='name_value'), + route_id='route_id_value', + ) + +@pytest.mark.asyncio +async def test_create_route_flattened_async(): + 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: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_route( + parent='parent_value', + route=datastream_resources.Route(name='name_value'), + route_id='route_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].route + mock_val = datastream_resources.Route(name='name_value') + assert arg == mock_val + arg = args[0].route_id + mock_val = 'route_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_create_route_flattened_error_async(): + 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.create_route( + datastream.CreateRouteRequest(), + parent='parent_value', + route=datastream_resources.Route(name='name_value'), + route_id='route_id_value', + ) + + +@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, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_route), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream_resources.Route( + name='name_value', + display_name='display_name_value', + destination_address='destination_address_value', + destination_port=1734, + ) + response = client.get_route(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetRouteRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream_resources.Route) + assert response.name == 'name_value' + assert response.display_name == 'display_name_value' + assert response.destination_address == 'destination_address_value' + assert response.destination_port == 1734 + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_route), + '__call__') as call: + client.get_route() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetRouteRequest() + +@pytest.mark.asyncio +async def test_get_route_async(transport: str = 'grpc_asyncio', request_type=datastream.GetRouteRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_route), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.Route( + name='name_value', + display_name='display_name_value', + destination_address='destination_address_value', + destination_port=1734, + )) + response = await client.get_route(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetRouteRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream_resources.Route) + assert response.name == 'name_value' + assert response.display_name == 'display_name_value' + assert response.destination_address == 'destination_address_value' + assert response.destination_port == 1734 + + +@pytest.mark.asyncio +async def test_get_route_async_from_dict(): + await test_get_route_async(request_type=dict) + + +def test_get_route_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_route), + '__call__') as call: + call.return_value = datastream_resources.Route() + client.get_route(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_route), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.Route()) + await client.get_route(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_route_flattened(): + 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: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_route_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_get_route_flattened_async(): + 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: + # Designate an appropriate return value for the call. + call.return_value = datastream_resources.Route() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.Route()) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_route_flattened_error_async(): + 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', + ) + + +@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, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + 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'], + ) + response = client.list_routes(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListRoutesRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListRoutesPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_routes), + '__call__') as call: + client.list_routes() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListRoutesRequest() + +@pytest.mark.asyncio +async def test_list_routes_async(transport: str = 'grpc_asyncio', request_type=datastream.ListRoutesRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_routes), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListRoutesResponse( + next_page_token='next_page_token_value', + unreachable=['unreachable_value'], + )) + response = await client.list_routes(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListRoutesRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListRoutesAsyncPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +@pytest.mark.asyncio +async def test_list_routes_async_from_dict(): + await test_list_routes_async(request_type=dict) + + +def test_list_routes_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_routes), + '__call__') as call: + call.return_value = datastream.ListRoutesResponse() + client.list_routes(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_routes), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListRoutesResponse()) + await client.list_routes(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_routes_flattened(): + 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: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_routes_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_list_routes_flattened_async(): + 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: + # Designate an appropriate return value for the call. + call.return_value = datastream.ListRoutesResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListRoutesResponse()) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_routes_flattened_error_async(): + 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', + ) + + +def test_list_routes_pager(transport_name: str = "grpc"): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_routes), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + datastream_resources.Route(), + datastream_resources.Route(), + ], + next_page_token='abc', + ), + datastream.ListRoutesResponse( + routes=[], + next_page_token='def', + ), + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + ], + next_page_token='ghi', + ), + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + datastream_resources.Route(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_routes(request={}) + + assert pager._metadata == metadata + + 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, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_routes), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + datastream_resources.Route(), + datastream_resources.Route(), + ], + next_page_token='abc', + ), + datastream.ListRoutesResponse( + routes=[], + next_page_token='def', + ), + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + ], + next_page_token='ghi', + ), + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + datastream_resources.Route(), + ], + ), + RuntimeError, + ) + pages = list(client.list_routes(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_routes_async_pager(): + 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__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + datastream_resources.Route(), + datastream_resources.Route(), + ], + next_page_token='abc', + ), + datastream.ListRoutesResponse( + routes=[], + next_page_token='def', + ), + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + ], + next_page_token='ghi', + ), + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + datastream_resources.Route(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_routes(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, datastream_resources.Route) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_routes_async_pages(): + 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__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + datastream_resources.Route(), + datastream_resources.Route(), + ], + next_page_token='abc', + ), + datastream.ListRoutesResponse( + routes=[], + next_page_token='def', + ), + datastream.ListRoutesResponse( + 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: # 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, +]) +def test_delete_route(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_route), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.delete_route(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DeleteRouteRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_route), + '__call__') as call: + client.delete_route() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DeleteRouteRequest() + +@pytest.mark.asyncio +async def test_delete_route_async(transport: str = 'grpc_asyncio', request_type=datastream.DeleteRouteRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_route), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.delete_route(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DeleteRouteRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_delete_route_async_from_dict(): + await test_delete_route_async(request_type=dict) + + +def test_delete_route_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_route), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.delete_route(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_route), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.delete_route(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_delete_route_flattened(): + 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: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_delete_route_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_delete_route_flattened_async(): + 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: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_delete_route_flattened_error_async(): + 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', + ) + + +def test_credentials_transport_error(): + # It is an error to provide credentials and a transport instance. + transport = transports.DatastreamGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.DatastreamGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = DatastreamClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide an api_key and a transport instance. + transport = transports.DatastreamGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = DatastreamClient( + client_options=options, + transport=transport, + ) + + # It is an error to provide an api_key and a credential. + options = mock.Mock() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = DatastreamClient( + client_options=options, + credentials=ga_credentials.AnonymousCredentials() + ) + + # It is an error to provide scopes and a transport instance. + transport = transports.DatastreamGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = DatastreamClient( + client_options={"scopes": ["1", "2"]}, + transport=transport, + ) + + +def test_transport_instance(): + # A client may be instantiated with a custom transport instance. + transport = transports.DatastreamGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + client = DatastreamClient(transport=transport) + assert client.transport is transport + +def test_transport_get_channel(): + # A client may be instantiated with a custom transport instance. + transport = transports.DatastreamGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + transport = transports.DatastreamGrpcAsyncIOTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + +@pytest.mark.parametrize("transport_class", [ + transports.DatastreamGrpcTransport, + transports.DatastreamGrpcAsyncIOTransport, +]) +def test_transport_adc(transport_class): + # Test default credentials are used if not provided. + with mock.patch.object(google.auth, 'default') as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + 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, + ) + +def test_datastream_base_transport_error(): + # Passing both a credentials object and credentials_file should raise an error + with pytest.raises(core_exceptions.DuplicateCredentialArgs): + transport = transports.DatastreamTransport( + credentials=ga_credentials.AnonymousCredentials(), + credentials_file="credentials.json" + ) + + +def test_datastream_base_transport(): + # Instantiate the base transport. + with mock.patch('google.cloud.datastream_v1.services.datastream.transports.DatastreamTransport.__init__') as Transport: + Transport.return_value = None + transport = transports.DatastreamTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Every method on the transport should just blindly + # raise NotImplementedError. + methods = ( + 'list_connection_profiles', + 'get_connection_profile', + 'create_connection_profile', + 'update_connection_profile', + 'delete_connection_profile', + 'discover_connection_profile', + 'list_streams', + 'get_stream', + 'create_stream', + 'update_stream', + 'delete_stream', + 'get_stream_object', + 'lookup_stream_object', + 'list_stream_objects', + 'start_backfill_job', + 'stop_backfill_job', + 'fetch_static_ips', + 'create_private_connection', + 'get_private_connection', + 'list_private_connections', + 'delete_private_connection', + 'create_route', + 'get_route', + 'list_routes', + 'delete_route', + 'get_location', + 'list_locations', + 'get_operation', + 'cancel_operation', + 'delete_operation', + 'list_operations', + ) + for method in methods: + with pytest.raises(NotImplementedError): + getattr(transport, method)(request=object()) + + with pytest.raises(NotImplementedError): + transport.close() + + # Additionally, the LRO client (a property) should + # also raise NotImplementedError + 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 + with mock.patch.object(google.auth, 'load_credentials_from_file', autospec=True) as load_creds, mock.patch('google.cloud.datastream_v1.services.datastream.transports.DatastreamTransport._prep_wrapped_messages') as Transport: + Transport.return_value = None + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.DatastreamTransport( + credentials_file="credentials.json", + quota_project_id="octopus", + ) + load_creds.assert_called_once_with("credentials.json", + scopes=None, + default_scopes=( + 'https://www.googleapis.com/auth/cloud-platform', +), + quota_project_id="octopus", + ) + + +def test_datastream_base_transport_with_adc(): + # Test the default credentials are used if credentials and credentials_file are None. + with mock.patch.object(google.auth, 'default', autospec=True) as adc, mock.patch('google.cloud.datastream_v1.services.datastream.transports.DatastreamTransport._prep_wrapped_messages') as Transport: + Transport.return_value = None + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.DatastreamTransport() + adc.assert_called_once() + + +def test_datastream_auth_adc(): + # If no credentials are provided, we should use ADC credentials. + with mock.patch.object(google.auth, 'default', autospec=True) as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + DatastreamClient() + adc.assert_called_once_with( + scopes=None, + default_scopes=( + 'https://www.googleapis.com/auth/cloud-platform', +), + quota_project_id=None, + ) + + +@pytest.mark.parametrize( + "transport_class", + [ + transports.DatastreamGrpcTransport, + transports.DatastreamGrpcAsyncIOTransport, + ], +) +def test_datastream_transport_auth_adc(transport_class): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object(google.auth, 'default', autospec=True) as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport_class(quota_project_id="octopus", scopes=["1", "2"]) + adc.assert_called_once_with( + scopes=["1", "2"], + default_scopes=( 'https://www.googleapis.com/auth/cloud-platform',), + quota_project_id="octopus", + ) + + +@pytest.mark.parametrize( + "transport_class", + [ + transports.DatastreamGrpcTransport, + transports.DatastreamGrpcAsyncIOTransport, + ], +) +def test_datastream_transport_auth_gdch_credentials(transport_class): + host = 'https://language.com' + api_audience_tests = [None, 'https://language2.com'] + api_audience_expect = [host, 'https://language2.com'] + for t, e in zip(api_audience_tests, api_audience_expect): + with mock.patch.object(google.auth, 'default', autospec=True) as adc: + gdch_mock = mock.MagicMock() + type(gdch_mock).with_gdch_audience = mock.PropertyMock(return_value=gdch_mock) + adc.return_value = (gdch_mock, None) + transport_class(host=host, api_audience=t) + gdch_mock.with_gdch_audience.assert_called_once_with( + e + ) + + +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.DatastreamGrpcTransport, grpc_helpers), + (transports.DatastreamGrpcAsyncIOTransport, grpc_helpers_async) + ], +) +def test_datastream_transport_create_channel(transport_class, grpc_helpers): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch.object( + grpc_helpers, "create_channel", autospec=True + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + adc.return_value = (creds, None) + transport_class( + quota_project_id="octopus", + scopes=["1", "2"] + ) + + create_channel.assert_called_with( + "datastream.googleapis.com:443", + credentials=creds, + credentials_file=None, + quota_project_id="octopus", + default_scopes=( + 'https://www.googleapis.com/auth/cloud-platform', +), + scopes=["1", "2"], + default_host="datastream.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize("transport_class", [transports.DatastreamGrpcTransport, transports.DatastreamGrpcAsyncIOTransport]) +def test_datastream_grpc_transport_client_cert_source_for_mtls( + transport_class +): + cred = ga_credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=None, + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, + private_key=expected_key + ) + + +@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' + ) + +@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' + ) + +def test_datastream_grpc_transport_channel(): + channel = grpc.secure_channel('http://localhost/', grpc.local_channel_credentials()) + + # Check that channel is used if provided. + transport = transports.DatastreamGrpcTransport( + host="squid.clam.whelk", + channel=channel, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert transport._ssl_channel_credentials == None + + +def test_datastream_grpc_asyncio_transport_channel(): + channel = aio.secure_channel('http://localhost/', grpc.local_channel_credentials()) + + # Check that channel is used if provided. + transport = transports.DatastreamGrpcAsyncIOTransport( + host="squid.clam.whelk", + channel=channel, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert transport._ssl_channel_credentials == None + + +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. +@pytest.mark.parametrize("transport_class", [transports.DatastreamGrpcTransport, transports.DatastreamGrpcAsyncIOTransport]) +def test_datastream_transport_channel_mtls_with_client_cert_source( + transport_class +): + with mock.patch("grpc.ssl_channel_credentials", autospec=True) as grpc_ssl_channel_cred: + with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: + mock_ssl_cred = mock.Mock() + grpc_ssl_channel_cred.return_value = mock_ssl_cred + + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + cred = ga_credentials.AnonymousCredentials() + with pytest.warns(DeprecationWarning): + with mock.patch.object(google.auth, 'default') as adc: + adc.return_value = (cred, None) + transport = transport_class( + host="squid.clam.whelk", + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=client_cert_source_callback, + ) + adc.assert_called_once() + + grpc_ssl_channel_cred.assert_called_once_with( + certificate_chain=b"cert bytes", private_key=b"key bytes" + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=None, + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + assert transport.grpc_channel == mock_grpc_channel + assert transport._ssl_channel_credentials == mock_ssl_cred + + +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. +@pytest.mark.parametrize("transport_class", [transports.DatastreamGrpcTransport, transports.DatastreamGrpcAsyncIOTransport]) +def test_datastream_transport_channel_mtls_with_adc( + transport_class +): + mock_ssl_cred = mock.Mock() + with mock.patch.multiple( + "google.auth.transport.grpc.SslCredentials", + __init__=mock.Mock(return_value=None), + ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), + ): + with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + mock_cred = mock.Mock() + + with pytest.warns(DeprecationWarning): + transport = transport_class( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=None, + ) + + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=None, + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + assert transport.grpc_channel == mock_grpc_channel + + +def test_datastream_grpc_lro_client(): + client = DatastreamClient( + 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, + ) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + +def test_datastream_grpc_lro_async_client(): + client = DatastreamAsyncClient( + 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, + ) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + +def test_connection_profile_path(): + project = "squid" + location = "clam" + connection_profile = "whelk" + expected = "projects/{project}/locations/{location}/connectionProfiles/{connection_profile}".format(project=project, location=location, connection_profile=connection_profile, ) + actual = DatastreamClient.connection_profile_path(project, location, connection_profile) + assert expected == actual + + +def test_parse_connection_profile_path(): + expected = { + "project": "octopus", + "location": "oyster", + "connection_profile": "nudibranch", + } + path = DatastreamClient.connection_profile_path(**expected) + + # Check that the path construction is reversible. + actual = DatastreamClient.parse_connection_profile_path(path) + assert expected == actual + +def test_networks_path(): + project = "cuttlefish" + network = "mussel" + expected = "projects/{project}/global/networks/{network}".format(project=project, network=network, ) + actual = DatastreamClient.networks_path(project, network) + assert expected == actual + + +def test_parse_networks_path(): + expected = { + "project": "winkle", + "network": "nautilus", + } + path = DatastreamClient.networks_path(**expected) + + # Check that the path construction is reversible. + actual = DatastreamClient.parse_networks_path(path) + assert expected == actual + +def test_private_connection_path(): + project = "scallop" + location = "abalone" + private_connection = "squid" + expected = "projects/{project}/locations/{location}/privateConnections/{private_connection}".format(project=project, location=location, private_connection=private_connection, ) + actual = DatastreamClient.private_connection_path(project, location, private_connection) + assert expected == actual + + +def test_parse_private_connection_path(): + expected = { + "project": "clam", + "location": "whelk", + "private_connection": "octopus", + } + path = DatastreamClient.private_connection_path(**expected) + + # Check that the path construction is reversible. + actual = DatastreamClient.parse_private_connection_path(path) + assert expected == actual + +def test_route_path(): + project = "oyster" + location = "nudibranch" + private_connection = "cuttlefish" + route = "mussel" + expected = "projects/{project}/locations/{location}/privateConnections/{private_connection}/routes/{route}".format(project=project, location=location, private_connection=private_connection, route=route, ) + actual = DatastreamClient.route_path(project, location, private_connection, route) + assert expected == actual + + +def test_parse_route_path(): + expected = { + "project": "winkle", + "location": "nautilus", + "private_connection": "scallop", + "route": "abalone", + } + path = DatastreamClient.route_path(**expected) + + # Check that the path construction is reversible. + actual = DatastreamClient.parse_route_path(path) + assert expected == actual + +def test_stream_path(): + project = "squid" + location = "clam" + stream = "whelk" + expected = "projects/{project}/locations/{location}/streams/{stream}".format(project=project, location=location, stream=stream, ) + actual = DatastreamClient.stream_path(project, location, stream) + assert expected == actual + + +def test_parse_stream_path(): + expected = { + "project": "octopus", + "location": "oyster", + "stream": "nudibranch", + } + path = DatastreamClient.stream_path(**expected) + + # Check that the path construction is reversible. + actual = DatastreamClient.parse_stream_path(path) + assert expected == actual + +def test_stream_object_path(): + project = "cuttlefish" + location = "mussel" + stream = "winkle" + object = "nautilus" + expected = "projects/{project}/locations/{location}/streams/{stream}/objects/{object}".format(project=project, location=location, stream=stream, object=object, ) + actual = DatastreamClient.stream_object_path(project, location, stream, object) + assert expected == actual + + +def test_parse_stream_object_path(): + expected = { + "project": "scallop", + "location": "abalone", + "stream": "squid", + "object": "clam", + } + path = DatastreamClient.stream_object_path(**expected) + + # Check that the path construction is reversible. + actual = DatastreamClient.parse_stream_object_path(path) + assert expected == actual + +def test_common_billing_account_path(): + billing_account = "whelk" + expected = "billingAccounts/{billing_account}".format(billing_account=billing_account, ) + actual = DatastreamClient.common_billing_account_path(billing_account) + assert expected == actual + + +def test_parse_common_billing_account_path(): + expected = { + "billing_account": "octopus", + } + path = DatastreamClient.common_billing_account_path(**expected) + + # Check that the path construction is reversible. + actual = DatastreamClient.parse_common_billing_account_path(path) + assert expected == actual + +def test_common_folder_path(): + folder = "oyster" + expected = "folders/{folder}".format(folder=folder, ) + actual = DatastreamClient.common_folder_path(folder) + assert expected == actual + + +def test_parse_common_folder_path(): + expected = { + "folder": "nudibranch", + } + path = DatastreamClient.common_folder_path(**expected) + + # Check that the path construction is reversible. + actual = DatastreamClient.parse_common_folder_path(path) + assert expected == actual + +def test_common_organization_path(): + organization = "cuttlefish" + expected = "organizations/{organization}".format(organization=organization, ) + actual = DatastreamClient.common_organization_path(organization) + assert expected == actual + + +def test_parse_common_organization_path(): + expected = { + "organization": "mussel", + } + path = DatastreamClient.common_organization_path(**expected) + + # Check that the path construction is reversible. + actual = DatastreamClient.parse_common_organization_path(path) + assert expected == actual + +def test_common_project_path(): + project = "winkle" + expected = "projects/{project}".format(project=project, ) + actual = DatastreamClient.common_project_path(project) + assert expected == actual + + +def test_parse_common_project_path(): + expected = { + "project": "nautilus", + } + path = DatastreamClient.common_project_path(**expected) + + # Check that the path construction is reversible. + actual = DatastreamClient.parse_common_project_path(path) + assert expected == actual + +def test_common_location_path(): + project = "scallop" + location = "abalone" + expected = "projects/{project}/locations/{location}".format(project=project, location=location, ) + actual = DatastreamClient.common_location_path(project, location) + assert expected == actual + + +def test_parse_common_location_path(): + expected = { + "project": "squid", + "location": "clam", + } + path = DatastreamClient.common_location_path(**expected) + + # Check that the path construction is reversible. + actual = DatastreamClient.parse_common_location_path(path) + assert expected == actual + + +def test_client_with_default_client_info(): + client_info = gapic_v1.client_info.ClientInfo() + + with mock.patch.object(transports.DatastreamTransport, '_prep_wrapped_messages') as prep: + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + with mock.patch.object(transports.DatastreamTransport, '_prep_wrapped_messages') as prep: + transport_class = DatastreamClient.get_transport_class() + transport = transport_class( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + +@pytest.mark.asyncio +async def test_transport_close_async(): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", + ) + with mock.patch.object(type(getattr(client.transport, "grpc_channel")), "close") as close: + async with client: + close.assert_not_called() + close.assert_called_once() + + +def test_delete_operation(transport: str = "grpc"): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.DeleteOperationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + response = client.delete_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None +@pytest.mark.asyncio +async def test_delete_operation_async(transport: str = "grpc"): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.DeleteOperationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + None + ) + response = await client.delete_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None + +def test_delete_operation_field_headers(): + 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 = operations_pb2.DeleteOperationRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: + call.return_value = None + + client.delete_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] +@pytest.mark.asyncio +async def test_delete_operation_field_headers_async(): + 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 = operations_pb2.DeleteOperationRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + None + ) + await client.delete_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + +def test_delete_operation_from_dict(): + 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_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + + response = client.delete_operation( + request={ + "name": "locations", + } + ) + call.assert_called() +@pytest.mark.asyncio +async def test_delete_operation_from_dict_async(): + 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_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + None + ) + response = await client.delete_operation( + request={ + "name": "locations", + } + ) + call.assert_called() + + +def test_cancel_operation(transport: str = "grpc"): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.CancelOperationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + response = client.cancel_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None +@pytest.mark.asyncio +async def test_cancel_operation_async(transport: str = "grpc"): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.CancelOperationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + None + ) + response = await client.cancel_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None + +def test_cancel_operation_field_headers(): + 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 = operations_pb2.CancelOperationRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: + call.return_value = None + + client.cancel_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] +@pytest.mark.asyncio +async def test_cancel_operation_field_headers_async(): + 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 = operations_pb2.CancelOperationRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + None + ) + await client.cancel_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + +def test_cancel_operation_from_dict(): + 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.cancel_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + + response = client.cancel_operation( + request={ + "name": "locations", + } + ) + call.assert_called() +@pytest.mark.asyncio +async def test_cancel_operation_from_dict_async(): + 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.cancel_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + None + ) + response = await client.cancel_operation( + request={ + "name": "locations", + } + ) + call.assert_called() + + +def test_get_operation(transport: str = "grpc"): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.GetOperationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + response = client.get_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, operations_pb2.Operation) +@pytest.mark.asyncio +async def test_get_operation_async(transport: str = "grpc"): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.GetOperationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + response = await client.get_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, operations_pb2.Operation) + +def test_get_operation_field_headers(): + 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 = operations_pb2.GetOperationRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_operation), "__call__") as call: + call.return_value = operations_pb2.Operation() + + client.get_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] +@pytest.mark.asyncio +async def test_get_operation_field_headers_async(): + 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 = operations_pb2.GetOperationRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_operation), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.get_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + +def test_get_operation_from_dict(): + 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_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + response = client.get_operation( + request={ + "name": "locations", + } + ) + call.assert_called() +@pytest.mark.asyncio +async def test_get_operation_from_dict_async(): + 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_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + response = await client.get_operation( + request={ + "name": "locations", + } + ) + call.assert_called() + + +def test_list_operations(transport: str = "grpc"): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.ListOperationsRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_operations), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.ListOperationsResponse() + response = client.list_operations(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, operations_pb2.ListOperationsResponse) +@pytest.mark.asyncio +async def test_list_operations_async(transport: str = "grpc"): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.ListOperationsRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_operations), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.ListOperationsResponse() + ) + response = await client.list_operations(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, operations_pb2.ListOperationsResponse) + +def test_list_operations_field_headers(): + 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 = operations_pb2.ListOperationsRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_operations), "__call__") as call: + call.return_value = operations_pb2.ListOperationsResponse() + + client.list_operations(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] +@pytest.mark.asyncio +async def test_list_operations_field_headers_async(): + 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 = operations_pb2.ListOperationsRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_operations), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.ListOperationsResponse() + ) + await client.list_operations(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + +def test_list_operations_from_dict(): + 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_operations), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.ListOperationsResponse() + + response = client.list_operations( + request={ + "name": "locations", + } + ) + call.assert_called() +@pytest.mark.asyncio +async def test_list_operations_from_dict_async(): + 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_operations), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.ListOperationsResponse() + ) + response = await client.list_operations( + request={ + "name": "locations", + } + ) + call.assert_called() + + +def test_list_locations(transport: str = "grpc"): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = locations_pb2.ListLocationsRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_locations), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = locations_pb2.ListLocationsResponse() + response = client.list_locations(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, locations_pb2.ListLocationsResponse) +@pytest.mark.asyncio +async def test_list_locations_async(transport: str = "grpc"): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = locations_pb2.ListLocationsRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_locations), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + locations_pb2.ListLocationsResponse() + ) + response = await client.list_locations(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, locations_pb2.ListLocationsResponse) + +def test_list_locations_field_headers(): + 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 = locations_pb2.ListLocationsRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_locations), "__call__") as call: + call.return_value = locations_pb2.ListLocationsResponse() + + client.list_locations(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] +@pytest.mark.asyncio +async def test_list_locations_field_headers_async(): + 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 = locations_pb2.ListLocationsRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_locations), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + locations_pb2.ListLocationsResponse() + ) + await client.list_locations(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + +def test_list_locations_from_dict(): + 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_locations), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = locations_pb2.ListLocationsResponse() + + response = client.list_locations( + request={ + "name": "locations", + } + ) + call.assert_called() +@pytest.mark.asyncio +async def test_list_locations_from_dict_async(): + 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_locations), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + locations_pb2.ListLocationsResponse() + ) + response = await client.list_locations( + request={ + "name": "locations", + } + ) + call.assert_called() + + +def test_get_location(transport: str = "grpc"): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = locations_pb2.GetLocationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_location), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = locations_pb2.Location() + response = client.get_location(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, locations_pb2.Location) +@pytest.mark.asyncio +async def test_get_location_async(transport: str = "grpc_asyncio"): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = locations_pb2.GetLocationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_location), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + locations_pb2.Location() + ) + response = await client.get_location(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, locations_pb2.Location) + +def test_get_location_field_headers(): + 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 = locations_pb2.GetLocationRequest() + request.name = "locations/abc" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_location), "__call__") as call: + call.return_value = locations_pb2.Location() + + client.get_location(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations/abc",) in kw["metadata"] +@pytest.mark.asyncio +async def test_get_location_field_headers_async(): + 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 = locations_pb2.GetLocationRequest() + request.name = "locations/abc" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_location), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + locations_pb2.Location() + ) + await client.get_location(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations/abc",) in kw["metadata"] + +def test_get_location_from_dict(): + 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_locations), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = locations_pb2.Location() + + response = client.get_location( + request={ + "name": "locations/abc", + } + ) + call.assert_called() +@pytest.mark.asyncio +async def test_get_location_from_dict_async(): + 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_locations), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + locations_pb2.Location() + ) + response = await client.get_location( + request={ + "name": "locations", + } + ) + call.assert_called() + + +def test_transport_close(): + transports = { + "grpc": "_grpc_channel", + } + + for transport, close_name in transports.items(): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport + ) + with mock.patch.object(type(getattr(client.transport, close_name)), "close") as close: + with client: + close.assert_not_called() + close.assert_called_once() + +def test_client_ctx(): + transports = [ + 'grpc', + ] + for transport in transports: + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport + ) + # Test client calls underlying transport. + with mock.patch.object(type(client.transport), "close") as close: + close.assert_not_called() + with client: + pass + close.assert_called() + +@pytest.mark.parametrize("client_class,transport_class", [ + (DatastreamClient, transports.DatastreamGrpcTransport), + (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport), +]) +def test_api_key_credentials(client_class, transport_class): + with mock.patch.object( + google.auth._default, "get_api_key_credentials", create=True + ) as get_api_key_credentials: + mock_cred = mock.Mock() + get_api_key_credentials.return_value = mock_cred + options = client_options.ClientOptions() + options.api_key = "api_key" + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=mock_cred, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) diff --git a/owl-bot-staging/v1alpha1/.coveragerc b/owl-bot-staging/v1alpha1/.coveragerc new file mode 100644 index 0000000..99bdb31 --- /dev/null +++ b/owl-bot-staging/v1alpha1/.coveragerc @@ -0,0 +1,13 @@ +[run] +branch = True + +[report] +show_missing = True +omit = + google/cloud/datastream/__init__.py + google/cloud/datastream/gapic_version.py +exclude_lines = + # Re-enable the standard pragma + pragma: NO COVER + # Ignore debug-only repr + def __repr__ diff --git a/owl-bot-staging/v1alpha1/.flake8 b/owl-bot-staging/v1alpha1/.flake8 new file mode 100644 index 0000000..29227d4 --- /dev/null +++ b/owl-bot-staging/v1alpha1/.flake8 @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2020 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 +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Generated by synthtool. DO NOT EDIT! +[flake8] +ignore = E203, E266, E501, W503 +exclude = + # Exclude generated code. + **/proto/** + **/gapic/** + **/services/** + **/types/** + *_pb2.py + + # Standard linting exemptions. + **/.nox/** + __pycache__, + .git, + *.pyc, + conf.py diff --git a/owl-bot-staging/v1alpha1/MANIFEST.in b/owl-bot-staging/v1alpha1/MANIFEST.in new file mode 100644 index 0000000..9b55389 --- /dev/null +++ b/owl-bot-staging/v1alpha1/MANIFEST.in @@ -0,0 +1,2 @@ +recursive-include google/cloud/datastream *.py +recursive-include google/cloud/datastream_v1alpha1 *.py diff --git a/owl-bot-staging/v1alpha1/README.rst b/owl-bot-staging/v1alpha1/README.rst new file mode 100644 index 0000000..9a1922d --- /dev/null +++ b/owl-bot-staging/v1alpha1/README.rst @@ -0,0 +1,49 @@ +Python Client for Google Cloud Datastream API +================================================= + +Quick Start +----------- + +In order to use this library, you first need to go through the following steps: + +1. `Select or create a Cloud Platform project.`_ +2. `Enable billing for your project.`_ +3. Enable the Google Cloud Datastream API. +4. `Setup Authentication.`_ + +.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project +.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project +.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html + +Installation +~~~~~~~~~~~~ + +Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to +create isolated Python environments. The basic problem it addresses is one of +dependencies and versions, and indirectly permissions. + +With `virtualenv`_, it's possible to install this library without needing system +install permissions, and without clashing with the installed system +dependencies. + +.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ + + +Mac/Linux +^^^^^^^^^ + +.. code-block:: console + + python3 -m venv + source /bin/activate + /bin/pip install /path/to/library + + +Windows +^^^^^^^ + +.. code-block:: console + + python3 -m venv + \Scripts\activate + \Scripts\pip.exe install \path\to\library diff --git a/owl-bot-staging/v1alpha1/docs/conf.py b/owl-bot-staging/v1alpha1/docs/conf.py new file mode 100644 index 0000000..38f6361 --- /dev/null +++ b/owl-bot-staging/v1alpha1/docs/conf.py @@ -0,0 +1,376 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# google-cloud-datastream documentation build configuration file +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys +import os +import shlex + +# 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 +# documentation root, use os.path.abspath to make it absolute, like shown here. +sys.path.insert(0, os.path.abspath("..")) + +__version__ = "0.1.0" + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +needs_sphinx = "4.0.1" + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.autosummary", + "sphinx.ext.intersphinx", + "sphinx.ext.coverage", + "sphinx.ext.napoleon", + "sphinx.ext.todo", + "sphinx.ext.viewcode", +] + +# autodoc/autosummary flags +autoclass_content = "both" +autodoc_default_flags = ["members"] +autosummary_generate = True + + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# Allow markdown includes (so releases.md can include CHANGLEOG.md) +# http://www.sphinx-doc.org/en/master/markdown.html +source_parsers = {".md": "recommonmark.parser.CommonMarkParser"} + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +source_suffix = [".rst", ".md"] + +# The encoding of source files. +# source_encoding = 'utf-8-sig' + +# The root toctree document. +root_doc = "index" + +# General information about the project. +project = u"google-cloud-datastream" +copyright = u"2022, Google, LLC" +author = u"Google APIs" # TODO: autogenerate this bit + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The full version, including alpha/beta/rc tags. +release = __version__ +# The short X.Y version. +version = ".".join(release.split(".")[0:2]) + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +# today = '' +# Else, today_fmt is used as the format for a strftime call. +# today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ["_build"] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +# default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +# add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +# add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +# show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = "sphinx" + +# A list of ignored prefixes for module index sorting. +# modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +# keep_warnings = False + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = True + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = "alabaster" + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +html_theme_options = { + "description": "Google Cloud Client Libraries for Python", + "github_user": "googleapis", + "github_repo": "google-cloud-python", + "github_banner": True, + "font_family": "'Roboto', Georgia, sans", + "head_font_family": "'Roboto', Georgia, serif", + "code_font_family": "'Roboto Mono', 'Consolas', monospace", +} + +# Add any paths that contain custom themes here, relative to this directory. +# html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +# html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +# html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +# html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +# html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ["_static"] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +# html_extra_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +# html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +# html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +# html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +# html_additional_pages = {} + +# If false, no module index is generated. +# html_domain_indices = True + +# If false, no index is generated. +# html_use_index = True + +# If true, the index is split into individual pages for each letter. +# html_split_index = False + +# If true, links to the reST sources are added to the pages. +# html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +# html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +# html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +# html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +# html_file_suffix = None + +# Language to be used for generating the HTML full-text search index. +# Sphinx supports the following languages: +# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' +# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' +# html_search_language = 'en' + +# A dictionary with options for the search language support, empty by default. +# Now only 'ja' uses this config value +# html_search_options = {'type': 'default'} + +# The name of a javascript file (relative to the configuration directory) that +# implements a search results scorer. If empty, the default will be used. +# html_search_scorer = 'scorer.js' + +# Output file base name for HTML help builder. +htmlhelp_basename = "google-cloud-datastream-doc" + +# -- Options for warnings ------------------------------------------------------ + + +suppress_warnings = [ + # Temporarily suppress this to avoid "more than one target found for + # cross-reference" warning, which are intractable for us to avoid while in + # a mono-repo. + # See https://github.com/sphinx-doc/sphinx/blob + # /2a65ffeef5c107c19084fabdd706cdff3f52d93c/sphinx/domains/python.py#L843 + "ref.python" +] + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # 'papersize': 'letterpaper', + # The font size ('10pt', '11pt' or '12pt'). + # 'pointsize': '10pt', + # Additional stuff for the LaTeX preamble. + # 'preamble': '', + # Latex figure (float) alignment + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + ( + root_doc, + "google-cloud-datastream.tex", + u"google-cloud-datastream Documentation", + author, + "manual", + ) +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +# latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +# latex_use_parts = False + +# If true, show page references after internal links. +# latex_show_pagerefs = False + +# If true, show URL addresses after external links. +# latex_show_urls = False + +# Documents to append as an appendix to all manuals. +# latex_appendices = [] + +# If false, no module index is generated. +# latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ( + root_doc, + "google-cloud-datastream", + u"Google Cloud Datastream Documentation", + [author], + 1, + ) +] + +# If true, show URL addresses after external links. +# man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ( + root_doc, + "google-cloud-datastream", + u"google-cloud-datastream Documentation", + author, + "google-cloud-datastream", + "GAPIC library for Google Cloud Datastream API", + "APIs", + ) +] + +# Documents to append as an appendix to all manuals. +# texinfo_appendices = [] + +# If false, no module index is generated. +# texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +# texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +# texinfo_no_detailmenu = False + + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = { + "python": ("http://python.readthedocs.org/en/latest/", None), + "gax": ("https://gax-python.readthedocs.org/en/latest/", None), + "google-auth": ("https://google-auth.readthedocs.io/en/stable", None), + "google-gax": ("https://gax-python.readthedocs.io/en/latest/", None), + "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None), + "grpc": ("https://grpc.io/grpc/python/", None), + "requests": ("http://requests.kennethreitz.org/en/stable/", None), + "proto": ("https://proto-plus-python.readthedocs.io/en/stable", None), + "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), +} + + +# Napoleon settings +napoleon_google_docstring = True +napoleon_numpy_docstring = True +napoleon_include_private_with_doc = False +napoleon_include_special_with_doc = True +napoleon_use_admonition_for_examples = False +napoleon_use_admonition_for_notes = False +napoleon_use_admonition_for_references = False +napoleon_use_ivar = False +napoleon_use_param = True +napoleon_use_rtype = True diff --git a/owl-bot-staging/v1alpha1/docs/datastream_v1alpha1/datastream.rst b/owl-bot-staging/v1alpha1/docs/datastream_v1alpha1/datastream.rst new file mode 100644 index 0000000..507205d --- /dev/null +++ b/owl-bot-staging/v1alpha1/docs/datastream_v1alpha1/datastream.rst @@ -0,0 +1,10 @@ +Datastream +---------------------------- + +.. automodule:: google.cloud.datastream_v1alpha1.services.datastream + :members: + :inherited-members: + +.. automodule:: google.cloud.datastream_v1alpha1.services.datastream.pagers + :members: + :inherited-members: diff --git a/owl-bot-staging/v1alpha1/docs/datastream_v1alpha1/services.rst b/owl-bot-staging/v1alpha1/docs/datastream_v1alpha1/services.rst new file mode 100644 index 0000000..1711424 --- /dev/null +++ b/owl-bot-staging/v1alpha1/docs/datastream_v1alpha1/services.rst @@ -0,0 +1,6 @@ +Services for Google Cloud Datastream v1alpha1 API +================================================= +.. toctree:: + :maxdepth: 2 + + datastream diff --git a/owl-bot-staging/v1alpha1/docs/datastream_v1alpha1/types.rst b/owl-bot-staging/v1alpha1/docs/datastream_v1alpha1/types.rst new file mode 100644 index 0000000..62cc052 --- /dev/null +++ b/owl-bot-staging/v1alpha1/docs/datastream_v1alpha1/types.rst @@ -0,0 +1,6 @@ +Types for Google Cloud Datastream v1alpha1 API +============================================== + +.. automodule:: google.cloud.datastream_v1alpha1.types + :members: + :show-inheritance: diff --git a/owl-bot-staging/v1alpha1/docs/index.rst b/owl-bot-staging/v1alpha1/docs/index.rst new file mode 100644 index 0000000..e0c9ba0 --- /dev/null +++ b/owl-bot-staging/v1alpha1/docs/index.rst @@ -0,0 +1,7 @@ +API Reference +------------- +.. toctree:: + :maxdepth: 2 + + datastream_v1alpha1/services + datastream_v1alpha1/types diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream/__init__.py b/owl-bot-staging/v1alpha1/google/cloud/datastream/__init__.py new file mode 100644 index 0000000..3e7dfdc --- /dev/null +++ b/owl-bot-staging/v1alpha1/google/cloud/datastream/__init__.py @@ -0,0 +1,153 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from google.cloud.datastream import gapic_version as package_version + +__version__ = package_version.__version__ + + +from google.cloud.datastream_v1alpha1.services.datastream.client import DatastreamClient +from google.cloud.datastream_v1alpha1.services.datastream.async_client import DatastreamAsyncClient + +from google.cloud.datastream_v1alpha1.types.datastream import CreateConnectionProfileRequest +from google.cloud.datastream_v1alpha1.types.datastream import CreatePrivateConnectionRequest +from google.cloud.datastream_v1alpha1.types.datastream import CreateRouteRequest +from google.cloud.datastream_v1alpha1.types.datastream import CreateStreamRequest +from google.cloud.datastream_v1alpha1.types.datastream import DeleteConnectionProfileRequest +from google.cloud.datastream_v1alpha1.types.datastream import DeletePrivateConnectionRequest +from google.cloud.datastream_v1alpha1.types.datastream import DeleteRouteRequest +from google.cloud.datastream_v1alpha1.types.datastream import DeleteStreamRequest +from google.cloud.datastream_v1alpha1.types.datastream import DiscoverConnectionProfileRequest +from google.cloud.datastream_v1alpha1.types.datastream import DiscoverConnectionProfileResponse +from google.cloud.datastream_v1alpha1.types.datastream import FetchErrorsRequest +from google.cloud.datastream_v1alpha1.types.datastream import FetchErrorsResponse +from google.cloud.datastream_v1alpha1.types.datastream import FetchStaticIpsRequest +from google.cloud.datastream_v1alpha1.types.datastream import FetchStaticIpsResponse +from google.cloud.datastream_v1alpha1.types.datastream import GetConnectionProfileRequest +from google.cloud.datastream_v1alpha1.types.datastream import GetPrivateConnectionRequest +from google.cloud.datastream_v1alpha1.types.datastream import GetRouteRequest +from google.cloud.datastream_v1alpha1.types.datastream import GetStreamRequest +from google.cloud.datastream_v1alpha1.types.datastream import ListConnectionProfilesRequest +from google.cloud.datastream_v1alpha1.types.datastream import ListConnectionProfilesResponse +from google.cloud.datastream_v1alpha1.types.datastream import ListPrivateConnectionsRequest +from google.cloud.datastream_v1alpha1.types.datastream import ListPrivateConnectionsResponse +from google.cloud.datastream_v1alpha1.types.datastream import ListRoutesRequest +from google.cloud.datastream_v1alpha1.types.datastream import ListRoutesResponse +from google.cloud.datastream_v1alpha1.types.datastream import ListStreamsRequest +from google.cloud.datastream_v1alpha1.types.datastream import ListStreamsResponse +from google.cloud.datastream_v1alpha1.types.datastream import OperationMetadata +from google.cloud.datastream_v1alpha1.types.datastream import UpdateConnectionProfileRequest +from google.cloud.datastream_v1alpha1.types.datastream import UpdateStreamRequest +from google.cloud.datastream_v1alpha1.types.datastream_resources import AvroFileFormat +from google.cloud.datastream_v1alpha1.types.datastream_resources import ConnectionProfile +from google.cloud.datastream_v1alpha1.types.datastream_resources import DestinationConfig +from google.cloud.datastream_v1alpha1.types.datastream_resources import Error +from google.cloud.datastream_v1alpha1.types.datastream_resources import ForwardSshTunnelConnectivity +from google.cloud.datastream_v1alpha1.types.datastream_resources import GcsDestinationConfig +from google.cloud.datastream_v1alpha1.types.datastream_resources import GcsProfile +from google.cloud.datastream_v1alpha1.types.datastream_resources import JsonFileFormat +from google.cloud.datastream_v1alpha1.types.datastream_resources import MysqlColumn +from google.cloud.datastream_v1alpha1.types.datastream_resources import MysqlDatabase +from google.cloud.datastream_v1alpha1.types.datastream_resources import MysqlProfile +from google.cloud.datastream_v1alpha1.types.datastream_resources import MysqlRdbms +from google.cloud.datastream_v1alpha1.types.datastream_resources import MysqlSourceConfig +from google.cloud.datastream_v1alpha1.types.datastream_resources import MysqlSslConfig +from google.cloud.datastream_v1alpha1.types.datastream_resources import MysqlTable +from google.cloud.datastream_v1alpha1.types.datastream_resources import NoConnectivitySettings +from google.cloud.datastream_v1alpha1.types.datastream_resources import OracleColumn +from google.cloud.datastream_v1alpha1.types.datastream_resources import OracleProfile +from google.cloud.datastream_v1alpha1.types.datastream_resources import OracleRdbms +from google.cloud.datastream_v1alpha1.types.datastream_resources import OracleSchema +from google.cloud.datastream_v1alpha1.types.datastream_resources import OracleSourceConfig +from google.cloud.datastream_v1alpha1.types.datastream_resources import OracleTable +from google.cloud.datastream_v1alpha1.types.datastream_resources import PrivateConnection +from google.cloud.datastream_v1alpha1.types.datastream_resources import PrivateConnectivity +from google.cloud.datastream_v1alpha1.types.datastream_resources import Route +from google.cloud.datastream_v1alpha1.types.datastream_resources import SourceConfig +from google.cloud.datastream_v1alpha1.types.datastream_resources import StaticServiceIpConnectivity +from google.cloud.datastream_v1alpha1.types.datastream_resources import Stream +from google.cloud.datastream_v1alpha1.types.datastream_resources import Validation +from google.cloud.datastream_v1alpha1.types.datastream_resources import ValidationMessage +from google.cloud.datastream_v1alpha1.types.datastream_resources import ValidationResult +from google.cloud.datastream_v1alpha1.types.datastream_resources import VpcPeeringConfig +from google.cloud.datastream_v1alpha1.types.datastream_resources import GcsFileFormat +from google.cloud.datastream_v1alpha1.types.datastream_resources import SchemaFileFormat + +__all__ = ('DatastreamClient', + 'DatastreamAsyncClient', + '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', + 'AvroFileFormat', + 'ConnectionProfile', + 'DestinationConfig', + 'Error', + 'ForwardSshTunnelConnectivity', + 'GcsDestinationConfig', + 'GcsProfile', + 'JsonFileFormat', + 'MysqlColumn', + 'MysqlDatabase', + 'MysqlProfile', + 'MysqlRdbms', + 'MysqlSourceConfig', + 'MysqlSslConfig', + 'MysqlTable', + 'NoConnectivitySettings', + 'OracleColumn', + 'OracleProfile', + 'OracleRdbms', + 'OracleSchema', + 'OracleSourceConfig', + 'OracleTable', + 'PrivateConnection', + 'PrivateConnectivity', + 'Route', + 'SourceConfig', + 'StaticServiceIpConnectivity', + 'Stream', + 'Validation', + 'ValidationMessage', + 'ValidationResult', + 'VpcPeeringConfig', + 'GcsFileFormat', + 'SchemaFileFormat', +) diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream/gapic_version.py b/owl-bot-staging/v1alpha1/google/cloud/datastream/gapic_version.py new file mode 100644 index 0000000..405b1ce --- /dev/null +++ b/owl-bot-staging/v1alpha1/google/cloud/datastream/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__version__ = "0.1.0" # {x-release-please-version} diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream/py.typed b/owl-bot-staging/v1alpha1/google/cloud/datastream/py.typed new file mode 100644 index 0000000..38ae0fa --- /dev/null +++ b/owl-bot-staging/v1alpha1/google/cloud/datastream/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-cloud-datastream package uses inline types. diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/__init__.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/__init__.py new file mode 100644 index 0000000..a071234 --- /dev/null +++ b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/__init__.py @@ -0,0 +1,154 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from google.cloud.datastream_v1alpha1 import gapic_version as package_version + +__version__ = package_version.__version__ + + +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 + +__all__ = ( + 'DatastreamAsyncClient', +'AvroFileFormat', +'ConnectionProfile', +'CreateConnectionProfileRequest', +'CreatePrivateConnectionRequest', +'CreateRouteRequest', +'CreateStreamRequest', +'DatastreamClient', +'DeleteConnectionProfileRequest', +'DeletePrivateConnectionRequest', +'DeleteRouteRequest', +'DeleteStreamRequest', +'DestinationConfig', +'DiscoverConnectionProfileRequest', +'DiscoverConnectionProfileResponse', +'Error', +'FetchErrorsRequest', +'FetchErrorsResponse', +'FetchStaticIpsRequest', +'FetchStaticIpsResponse', +'ForwardSshTunnelConnectivity', +'GcsDestinationConfig', +'GcsFileFormat', +'GcsProfile', +'GetConnectionProfileRequest', +'GetPrivateConnectionRequest', +'GetRouteRequest', +'GetStreamRequest', +'JsonFileFormat', +'ListConnectionProfilesRequest', +'ListConnectionProfilesResponse', +'ListPrivateConnectionsRequest', +'ListPrivateConnectionsResponse', +'ListRoutesRequest', +'ListRoutesResponse', +'ListStreamsRequest', +'ListStreamsResponse', +'MysqlColumn', +'MysqlDatabase', +'MysqlProfile', +'MysqlRdbms', +'MysqlSourceConfig', +'MysqlSslConfig', +'MysqlTable', +'NoConnectivitySettings', +'OperationMetadata', +'OracleColumn', +'OracleProfile', +'OracleRdbms', +'OracleSchema', +'OracleSourceConfig', +'OracleTable', +'PrivateConnection', +'PrivateConnectivity', +'Route', +'SchemaFileFormat', +'SourceConfig', +'StaticServiceIpConnectivity', +'Stream', +'UpdateConnectionProfileRequest', +'UpdateStreamRequest', +'Validation', +'ValidationMessage', +'ValidationResult', +'VpcPeeringConfig', +) diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/gapic_metadata.json b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/gapic_metadata.json new file mode 100644 index 0000000..a82501e --- /dev/null +++ b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/gapic_metadata.json @@ -0,0 +1,233 @@ + { + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "python", + "libraryPackage": "google.cloud.datastream_v1alpha1", + "protoPackage": "google.cloud.datastream.v1alpha1", + "schema": "1.0", + "services": { + "Datastream": { + "clients": { + "grpc": { + "libraryClient": "DatastreamClient", + "rpcs": { + "CreateConnectionProfile": { + "methods": [ + "create_connection_profile" + ] + }, + "CreatePrivateConnection": { + "methods": [ + "create_private_connection" + ] + }, + "CreateRoute": { + "methods": [ + "create_route" + ] + }, + "CreateStream": { + "methods": [ + "create_stream" + ] + }, + "DeleteConnectionProfile": { + "methods": [ + "delete_connection_profile" + ] + }, + "DeletePrivateConnection": { + "methods": [ + "delete_private_connection" + ] + }, + "DeleteRoute": { + "methods": [ + "delete_route" + ] + }, + "DeleteStream": { + "methods": [ + "delete_stream" + ] + }, + "DiscoverConnectionProfile": { + "methods": [ + "discover_connection_profile" + ] + }, + "FetchErrors": { + "methods": [ + "fetch_errors" + ] + }, + "FetchStaticIps": { + "methods": [ + "fetch_static_ips" + ] + }, + "GetConnectionProfile": { + "methods": [ + "get_connection_profile" + ] + }, + "GetPrivateConnection": { + "methods": [ + "get_private_connection" + ] + }, + "GetRoute": { + "methods": [ + "get_route" + ] + }, + "GetStream": { + "methods": [ + "get_stream" + ] + }, + "ListConnectionProfiles": { + "methods": [ + "list_connection_profiles" + ] + }, + "ListPrivateConnections": { + "methods": [ + "list_private_connections" + ] + }, + "ListRoutes": { + "methods": [ + "list_routes" + ] + }, + "ListStreams": { + "methods": [ + "list_streams" + ] + }, + "UpdateConnectionProfile": { + "methods": [ + "update_connection_profile" + ] + }, + "UpdateStream": { + "methods": [ + "update_stream" + ] + } + } + }, + "grpc-async": { + "libraryClient": "DatastreamAsyncClient", + "rpcs": { + "CreateConnectionProfile": { + "methods": [ + "create_connection_profile" + ] + }, + "CreatePrivateConnection": { + "methods": [ + "create_private_connection" + ] + }, + "CreateRoute": { + "methods": [ + "create_route" + ] + }, + "CreateStream": { + "methods": [ + "create_stream" + ] + }, + "DeleteConnectionProfile": { + "methods": [ + "delete_connection_profile" + ] + }, + "DeletePrivateConnection": { + "methods": [ + "delete_private_connection" + ] + }, + "DeleteRoute": { + "methods": [ + "delete_route" + ] + }, + "DeleteStream": { + "methods": [ + "delete_stream" + ] + }, + "DiscoverConnectionProfile": { + "methods": [ + "discover_connection_profile" + ] + }, + "FetchErrors": { + "methods": [ + "fetch_errors" + ] + }, + "FetchStaticIps": { + "methods": [ + "fetch_static_ips" + ] + }, + "GetConnectionProfile": { + "methods": [ + "get_connection_profile" + ] + }, + "GetPrivateConnection": { + "methods": [ + "get_private_connection" + ] + }, + "GetRoute": { + "methods": [ + "get_route" + ] + }, + "GetStream": { + "methods": [ + "get_stream" + ] + }, + "ListConnectionProfiles": { + "methods": [ + "list_connection_profiles" + ] + }, + "ListPrivateConnections": { + "methods": [ + "list_private_connections" + ] + }, + "ListRoutes": { + "methods": [ + "list_routes" + ] + }, + "ListStreams": { + "methods": [ + "list_streams" + ] + }, + "UpdateConnectionProfile": { + "methods": [ + "update_connection_profile" + ] + }, + "UpdateStream": { + "methods": [ + "update_stream" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/gapic_version.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/gapic_version.py new file mode 100644 index 0000000..405b1ce --- /dev/null +++ b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__version__ = "0.1.0" # {x-release-please-version} diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/py.typed b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/py.typed new file mode 100644 index 0000000..38ae0fa --- /dev/null +++ b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-cloud-datastream package uses inline types. diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/__init__.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/__init__.py new file mode 100644 index 0000000..e8e1c38 --- /dev/null +++ b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/__init__.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/__init__.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/__init__.py new file mode 100644 index 0000000..f03a8e0 --- /dev/null +++ b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from .client import DatastreamClient +from .async_client import DatastreamAsyncClient + +__all__ = ( + 'DatastreamClient', + 'DatastreamAsyncClient', +) diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/async_client.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/async_client.py new file mode 100644 index 0000000..9011ff9 --- /dev/null +++ b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/async_client.py @@ -0,0 +1,2690 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from collections import OrderedDict +import functools +import re +from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union + +from google.cloud.datastream_v1alpha1 import gapic_version as package_version + +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.auth import credentials as ga_credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + +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 .client import DatastreamClient + + +class DatastreamAsyncClient: + """Datastream service""" + + _client: DatastreamClient + + DEFAULT_ENDPOINT = DatastreamClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = DatastreamClient.DEFAULT_MTLS_ENDPOINT + + connection_profile_path = staticmethod(DatastreamClient.connection_profile_path) + parse_connection_profile_path = staticmethod(DatastreamClient.parse_connection_profile_path) + private_connection_path = staticmethod(DatastreamClient.private_connection_path) + parse_private_connection_path = staticmethod(DatastreamClient.parse_private_connection_path) + route_path = staticmethod(DatastreamClient.route_path) + parse_route_path = staticmethod(DatastreamClient.parse_route_path) + stream_path = staticmethod(DatastreamClient.stream_path) + parse_stream_path = staticmethod(DatastreamClient.parse_stream_path) + common_billing_account_path = staticmethod(DatastreamClient.common_billing_account_path) + parse_common_billing_account_path = staticmethod(DatastreamClient.parse_common_billing_account_path) + common_folder_path = staticmethod(DatastreamClient.common_folder_path) + parse_common_folder_path = staticmethod(DatastreamClient.parse_common_folder_path) + common_organization_path = staticmethod(DatastreamClient.common_organization_path) + parse_common_organization_path = staticmethod(DatastreamClient.parse_common_organization_path) + common_project_path = staticmethod(DatastreamClient.common_project_path) + parse_common_project_path = staticmethod(DatastreamClient.parse_common_project_path) + common_location_path = staticmethod(DatastreamClient.common_location_path) + parse_common_location_path = staticmethod(DatastreamClient.parse_common_location_path) + + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials + info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + DatastreamAsyncClient: The constructed client. + """ + return DatastreamClient.from_service_account_info.__func__(DatastreamAsyncClient, info, *args, **kwargs) # type: ignore + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + DatastreamAsyncClient: The constructed client. + """ + return DatastreamClient.from_service_account_file.__func__(DatastreamAsyncClient, filename, *args, **kwargs) # type: ignore + + from_service_account_json = from_service_account_file + + @classmethod + def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[ClientOptions] = None): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variable is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + return DatastreamClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore + + @property + def transport(self) -> DatastreamTransport: + """Returns the transport used by the client instance. + + Returns: + DatastreamTransport: The transport used by the client instance. + """ + return self._client.transport + + get_transport_class = functools.partial(type(DatastreamClient).get_transport_class, type(DatastreamClient)) + + def __init__(self, *, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Union[str, DatastreamTransport] = "grpc_asyncio", + client_options: Optional[ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiates the datastream client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.DatastreamTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + self._client = DatastreamClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + + ) + + async def list_connection_profiles(self, + request: Optional[Union[datastream.ListConnectionProfilesRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListConnectionProfilesAsyncPager: + r"""Use this method to list connection profiles created + in a project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + async def sample_list_connection_profiles(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.ListConnectionProfilesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_connection_profiles(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1alpha1.types.ListConnectionProfilesRequest, dict]]): + The request object. + parent (:class:`str`): + Required. The parent that owns the + collection of connection profiles. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1alpha1.services.datastream.pagers.ListConnectionProfilesAsyncPager: + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.ListConnectionProfilesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_connection_profiles, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + async def get_connection_profile(self, + request: Optional[Union[datastream.GetConnectionProfileRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream_resources.ConnectionProfile: + r"""Use this method to get details about a connection + profile. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + async def sample_get_connection_profile(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.GetConnectionProfileRequest( + name="name_value", + ) + + # Make the request + response = await client.get_connection_profile(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1alpha1.types.GetConnectionProfileRequest, dict]]): + The request object. + name (:class:`str`): + Required. The name of the connection + profile resource to get. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1alpha1.types.ConnectionProfile: + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.GetConnectionProfileRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_connection_profile, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def create_connection_profile(self, + request: Optional[Union[datastream.CreateConnectionProfileRequest, dict]] = None, + *, + parent: Optional[str] = None, + connection_profile: Optional[datastream_resources.ConnectionProfile] = None, + connection_profile_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Use this method to create a connection profile in a + project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + async def sample_create_connection_profile(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + connection_profile = datastream_v1alpha1.ConnectionProfile() + connection_profile.oracle_profile.hostname = "hostname_value" + connection_profile.oracle_profile.username = "username_value" + connection_profile.oracle_profile.password = "password_value" + connection_profile.oracle_profile.database_service = "database_service_value" + connection_profile.display_name = "display_name_value" + + request = datastream_v1alpha1.CreateConnectionProfileRequest( + parent="parent_value", + connection_profile_id="connection_profile_id_value", + connection_profile=connection_profile, + ) + + # Make the request + operation = client.create_connection_profile(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1alpha1.types.CreateConnectionProfileRequest, dict]]): + The request object. + parent (:class:`str`): + Required. The parent that owns the + collection of ConnectionProfiles. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + connection_profile (:class:`google.cloud.datastream_v1alpha1.types.ConnectionProfile`): + Required. The connection profile + resource to create. + + This corresponds to the ``connection_profile`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + connection_profile_id (:class:`str`): + Required. The connection profile + identifier. + + This corresponds to the ``connection_profile_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.datastream_v1alpha1.types.ConnectionProfile` + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, connection_profile, connection_profile_id]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.CreateConnectionProfileRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if connection_profile is not None: + request.connection_profile = connection_profile + if connection_profile_id is not None: + request.connection_profile_id = connection_profile_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_connection_profile, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + datastream_resources.ConnectionProfile, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + async def update_connection_profile(self, + request: Optional[Union[datastream.UpdateConnectionProfileRequest, dict]] = None, + *, + connection_profile: Optional[datastream_resources.ConnectionProfile] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Use this method to update the parameters of a + connection profile. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + async def sample_update_connection_profile(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + connection_profile = datastream_v1alpha1.ConnectionProfile() + connection_profile.oracle_profile.hostname = "hostname_value" + connection_profile.oracle_profile.username = "username_value" + connection_profile.oracle_profile.password = "password_value" + connection_profile.oracle_profile.database_service = "database_service_value" + connection_profile.display_name = "display_name_value" + + request = datastream_v1alpha1.UpdateConnectionProfileRequest( + connection_profile=connection_profile, + ) + + # Make the request + operation = client.update_connection_profile(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1alpha1.types.UpdateConnectionProfileRequest, dict]]): + The request object. + connection_profile (:class:`google.cloud.datastream_v1alpha1.types.ConnectionProfile`): + Required. The ConnectionProfile to + update. + + This corresponds to the ``connection_profile`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Optional. Field mask is used to specify the fields to be + overwritten in the ConnectionProfile resource by the + update. The fields specified in the update_mask are + relative to the resource, not the full request. A field + will be overwritten if it is in the mask. If the user + does not provide a mask then all fields will be + overwritten. + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.datastream_v1alpha1.types.ConnectionProfile` + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([connection_profile, update_mask]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.UpdateConnectionProfileRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if connection_profile is not None: + request.connection_profile = connection_profile + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_connection_profile, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("connection_profile.name", request.connection_profile.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + datastream_resources.ConnectionProfile, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + async def delete_connection_profile(self, + request: Optional[Union[datastream.DeleteConnectionProfileRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Use this method to delete a connection profile.. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + async def sample_delete_connection_profile(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.DeleteConnectionProfileRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_connection_profile(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1alpha1.types.DeleteConnectionProfileRequest, dict]]): + The request object. + name (:class:`str`): + Required. The name of the connection + profile resource to delete. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.DeleteConnectionProfileRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_connection_profile, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty_pb2.Empty, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + async def discover_connection_profile(self, + request: Optional[Union[datastream.DiscoverConnectionProfileRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream.DiscoverConnectionProfileResponse: + r"""Use this method to discover a connection profile. + The discover API call exposes the data objects and + metadata belonging to the profile. Typically, a request + returns children data objects under a parent data object + that's optionally supplied in the request. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + async def sample_discover_connection_profile(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + connection_profile = datastream_v1alpha1.ConnectionProfile() + connection_profile.oracle_profile.hostname = "hostname_value" + connection_profile.oracle_profile.username = "username_value" + connection_profile.oracle_profile.password = "password_value" + connection_profile.oracle_profile.database_service = "database_service_value" + connection_profile.display_name = "display_name_value" + + request = datastream_v1alpha1.DiscoverConnectionProfileRequest( + connection_profile=connection_profile, + recursive=True, + parent="parent_value", + ) + + # Make the request + response = await client.discover_connection_profile(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1alpha1.types.DiscoverConnectionProfileRequest, dict]]): + The request object. Request message for 'discover' + ConnectionProfile request. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1alpha1.types.DiscoverConnectionProfileResponse: + + """ + # Create or coerce a protobuf request object. + request = datastream.DiscoverConnectionProfileRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.discover_connection_profile, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_streams(self, + request: Optional[Union[datastream.ListStreamsRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListStreamsAsyncPager: + r"""Use this method to list streams in a project and + location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + async def sample_list_streams(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.ListStreamsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_streams(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1alpha1.types.ListStreamsRequest, dict]]): + The request object. + parent (:class:`str`): + Required. The parent that owns the + collection of streams. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1alpha1.services.datastream.pagers.ListStreamsAsyncPager: + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.ListStreamsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_streams, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + async def get_stream(self, + request: Optional[Union[datastream.GetStreamRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream_resources.Stream: + r"""Use this method to get details about a stream. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + async def sample_get_stream(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.GetStreamRequest( + name="name_value", + ) + + # Make the request + response = await client.get_stream(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1alpha1.types.GetStreamRequest, dict]]): + The request object. + name (:class:`str`): + Required. The name of the stream + resource to get. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1alpha1.types.Stream: + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.GetStreamRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_stream, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def create_stream(self, + request: Optional[Union[datastream.CreateStreamRequest, dict]] = None, + *, + parent: Optional[str] = None, + stream: Optional[datastream_resources.Stream] = None, + stream_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Use this method to create a stream. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + async def sample_create_stream(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + stream = datastream_v1alpha1.Stream() + stream.display_name = "display_name_value" + stream.source_config.source_connection_profile_name = "source_connection_profile_name_value" + stream.destination_config.destination_connection_profile_name = "destination_connection_profile_name_value" + + request = datastream_v1alpha1.CreateStreamRequest( + parent="parent_value", + stream_id="stream_id_value", + stream=stream, + ) + + # Make the request + operation = client.create_stream(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1alpha1.types.CreateStreamRequest, dict]]): + The request object. + parent (:class:`str`): + Required. The parent that owns the + collection of streams. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + stream (:class:`google.cloud.datastream_v1alpha1.types.Stream`): + Required. The stream resource to + create. + + This corresponds to the ``stream`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + stream_id (:class:`str`): + Required. The stream identifier. + This corresponds to the ``stream_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.datastream_v1alpha1.types.Stream` + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, stream, stream_id]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.CreateStreamRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if stream is not None: + request.stream = stream + if stream_id is not None: + request.stream_id = stream_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_stream, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + datastream_resources.Stream, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + async def update_stream(self, + request: Optional[Union[datastream.UpdateStreamRequest, dict]] = None, + *, + stream: Optional[datastream_resources.Stream] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Use this method to update the configuration of a + stream. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + async def sample_update_stream(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + stream = datastream_v1alpha1.Stream() + stream.display_name = "display_name_value" + stream.source_config.source_connection_profile_name = "source_connection_profile_name_value" + stream.destination_config.destination_connection_profile_name = "destination_connection_profile_name_value" + + request = datastream_v1alpha1.UpdateStreamRequest( + stream=stream, + ) + + # Make the request + operation = client.update_stream(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1alpha1.types.UpdateStreamRequest, dict]]): + The request object. + stream (:class:`google.cloud.datastream_v1alpha1.types.Stream`): + Required. The stream resource to + update. + + This corresponds to the ``stream`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Optional. Field mask is used to specify the fields to be + overwritten in the stream resource by the update. The + fields specified in the update_mask are relative to the + resource, not the full request. A field will be + overwritten if it is in the mask. If the user does not + provide a mask then all fields will be overwritten. + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.datastream_v1alpha1.types.Stream` + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([stream, update_mask]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.UpdateStreamRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if stream is not None: + request.stream = stream + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_stream, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("stream.name", request.stream.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + datastream_resources.Stream, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + async def delete_stream(self, + request: Optional[Union[datastream.DeleteStreamRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Use this method to delete a stream. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + async def sample_delete_stream(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.DeleteStreamRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_stream(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1alpha1.types.DeleteStreamRequest, dict]]): + The request object. + name (:class:`str`): + Required. The name of the stream + resource to delete. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.DeleteStreamRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_stream, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty_pb2.Empty, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + async def fetch_errors(self, + request: Optional[Union[datastream.FetchErrorsRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Use this method to fetch any errors associated with a + stream. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + async def sample_fetch_errors(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.FetchErrorsRequest( + ) + + # Make the request + operation = client.fetch_errors(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1alpha1.types.FetchErrorsRequest, dict]]): + The request object. Request message for 'FetchErrors' + request. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.datastream_v1alpha1.types.FetchErrorsResponse` + Response message for a 'FetchErrors' response. + + """ + # Create or coerce a protobuf request object. + request = datastream.FetchErrorsRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.fetch_errors, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("stream", request.stream), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + datastream.FetchErrorsResponse, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + async def fetch_static_ips(self, + request: Optional[Union[datastream.FetchStaticIpsRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.FetchStaticIpsAsyncPager: + r"""The FetchStaticIps API call exposes the static ips + used by Datastream. Typically, a request returns + children data objects under a parent data object that's + optionally supplied in the request. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + async def sample_fetch_static_ips(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.FetchStaticIpsRequest( + name="name_value", + ) + + # Make the request + page_result = client.fetch_static_ips(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1alpha1.types.FetchStaticIpsRequest, dict]]): + The request object. Request message for 'FetchStaticIps' + request. + name (:class:`str`): + Required. The name resource of the Response type. Must + be in the format ``projects/*/locations/*``. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1alpha1.services.datastream.pagers.FetchStaticIpsAsyncPager: + Response message for a + 'FetchStaticIps' response. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.FetchStaticIpsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.fetch_static_ips, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + async def create_private_connection(self, + request: Optional[Union[datastream.CreatePrivateConnectionRequest, dict]] = None, + *, + parent: Optional[str] = None, + private_connection: Optional[datastream_resources.PrivateConnection] = None, + private_connection_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Use this method to create a private connectivity + configuration. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + async def sample_create_private_connection(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + private_connection = datastream_v1alpha1.PrivateConnection() + private_connection.display_name = "display_name_value" + + request = datastream_v1alpha1.CreatePrivateConnectionRequest( + parent="parent_value", + private_connection_id="private_connection_id_value", + private_connection=private_connection, + ) + + # Make the request + operation = client.create_private_connection(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1alpha1.types.CreatePrivateConnectionRequest, dict]]): + The request object. + parent (:class:`str`): + Required. The parent that owns the + collection of PrivateConnections. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + private_connection (:class:`google.cloud.datastream_v1alpha1.types.PrivateConnection`): + Required. The Private Connectivity + resource to create. + + This corresponds to the ``private_connection`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + private_connection_id (:class:`str`): + Required. The private connectivity + identifier. + + This corresponds to the ``private_connection_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.datastream_v1alpha1.types.PrivateConnection` The PrivateConnection resource is used to establish private connectivity + between Datastream and a customer's network. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, private_connection, private_connection_id]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.CreatePrivateConnectionRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if private_connection is not None: + request.private_connection = private_connection + if private_connection_id is not None: + request.private_connection_id = private_connection_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_private_connection, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + datastream_resources.PrivateConnection, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + async def get_private_connection(self, + request: Optional[Union[datastream.GetPrivateConnectionRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream_resources.PrivateConnection: + r"""Use this method to get details about a private + connectivity configuration. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + async def sample_get_private_connection(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.GetPrivateConnectionRequest( + name="name_value", + ) + + # Make the request + response = await client.get_private_connection(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1alpha1.types.GetPrivateConnectionRequest, dict]]): + The request object. + name (:class:`str`): + Required. The name of the private + connectivity configuration to get. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1alpha1.types.PrivateConnection: + The PrivateConnection resource is + used to establish private connectivity + between Datastream and a customer's + network. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.GetPrivateConnectionRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_private_connection, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_private_connections(self, + request: Optional[Union[datastream.ListPrivateConnectionsRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListPrivateConnectionsAsyncPager: + r"""Use this method to list private connectivity + configurations in a project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + async def sample_list_private_connections(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.ListPrivateConnectionsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_private_connections(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1alpha1.types.ListPrivateConnectionsRequest, dict]]): + The request object. + parent (:class:`str`): + Required. The parent that owns the + collection of private connectivity + configurations. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1alpha1.services.datastream.pagers.ListPrivateConnectionsAsyncPager: + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.ListPrivateConnectionsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_private_connections, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + async def delete_private_connection(self, + request: Optional[Union[datastream.DeletePrivateConnectionRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Use this method to delete a private connectivity + configuration. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + async def sample_delete_private_connection(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.DeletePrivateConnectionRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_private_connection(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1alpha1.types.DeletePrivateConnectionRequest, dict]]): + The request object. + name (:class:`str`): + Required. The name of the private + connectivity configuration to delete. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.DeletePrivateConnectionRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_private_connection, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty_pb2.Empty, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + async def create_route(self, + request: Optional[Union[datastream.CreateRouteRequest, dict]] = None, + *, + parent: Optional[str] = None, + route: Optional[datastream_resources.Route] = None, + route_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Use this method to create a route for a private + connectivity in a project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + async def sample_create_route(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + route = datastream_v1alpha1.Route() + route.display_name = "display_name_value" + route.destination_address = "destination_address_value" + + request = datastream_v1alpha1.CreateRouteRequest( + parent="parent_value", + route_id="route_id_value", + route=route, + ) + + # Make the request + operation = client.create_route(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1alpha1.types.CreateRouteRequest, dict]]): + The request object. route creation request + parent (:class:`str`): + Required. The parent that owns the + collection of Routes. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + route (:class:`google.cloud.datastream_v1alpha1.types.Route`): + Required. The Route resource to + create. + + This corresponds to the ``route`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + route_id (:class:`str`): + Required. The Route identifier. + This corresponds to the ``route_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.datastream_v1alpha1.types.Route` The Route resource is the child of the PrivateConnection resource. + It used to define a route for a PrivateConnection + setup. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, route, route_id]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.CreateRouteRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if route is not None: + request.route = route + if route_id is not None: + request.route_id = route_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_route, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + datastream_resources.Route, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + async def get_route(self, + request: Optional[Union[datastream.GetRouteRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream_resources.Route: + r"""Use this method to get details about a route. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + async def sample_get_route(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.GetRouteRequest( + name="name_value", + ) + + # Make the request + response = await client.get_route(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1alpha1.types.GetRouteRequest, dict]]): + The request object. route get request + name (:class:`str`): + Required. The name of the Route + resource to get. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1alpha1.types.Route: + The Route resource is the child of + the PrivateConnection resource. It used + to define a route for a + PrivateConnection setup. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.GetRouteRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_route, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_routes(self, + request: Optional[Union[datastream.ListRoutesRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListRoutesAsyncPager: + r"""Use this method to list routes created for a private + connectivity in a project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + async def sample_list_routes(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.ListRoutesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_routes(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1alpha1.types.ListRoutesRequest, dict]]): + The request object. route list request + parent (:class:`str`): + Required. The parent that owns the + collection of Routess. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1alpha1.services.datastream.pagers.ListRoutesAsyncPager: + route list response + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.ListRoutesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_routes, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + async def delete_route(self, + request: Optional[Union[datastream.DeleteRouteRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Use this method to delete a route. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + async def sample_delete_route(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.DeleteRouteRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_route(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.datastream_v1alpha1.types.DeleteRouteRequest, dict]]): + The request object. route deletion request + name (:class:`str`): + Required. The name of the Route + resource to delete. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = datastream.DeleteRouteRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_route, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty_pb2.Empty, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc, tb): + await self.transport.close() + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) + + +__all__ = ( + "DatastreamAsyncClient", +) diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/client.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/client.py new file mode 100644 index 0000000..21cae90 --- /dev/null +++ b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/client.py @@ -0,0 +1,2921 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from collections import OrderedDict +import os +import re +from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union, cast + +from google.cloud.datastream_v1alpha1 import gapic_version as package_version + +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.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 + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + +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 import DatastreamGrpcTransport +from .transports.grpc_asyncio import DatastreamGrpcAsyncIOTransport + + +class DatastreamClientMeta(type): + """Metaclass for the Datastream client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + _transport_registry = OrderedDict() # type: Dict[str, Type[DatastreamTransport]] + _transport_registry["grpc"] = DatastreamGrpcTransport + _transport_registry["grpc_asyncio"] = DatastreamGrpcAsyncIOTransport + + def get_transport_class(cls, + label: Optional[str] = None, + ) -> Type[DatastreamTransport]: + """Returns an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class DatastreamClient(metaclass=DatastreamClientMeta): + """Datastream service""" + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Converts api endpoint to mTLS endpoint. + + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "datastream.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials + info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + DatastreamClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + DatastreamClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file( + filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> DatastreamTransport: + """Returns the transport used by the client instance. + + Returns: + DatastreamTransport: The transport used by the client + instance. + """ + return self._transport + + @staticmethod + def connection_profile_path(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, ) + + @staticmethod + def parse_connection_profile_path(path: str) -> Dict[str,str]: + """Parses a connection_profile path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/connectionProfiles/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def private_connection_path(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, ) + + @staticmethod + def parse_private_connection_path(path: str) -> Dict[str,str]: + """Parses a private_connection path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/privateConnections/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def route_path(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(project=project, location=location, private_connection=private_connection, route=route, ) + + @staticmethod + def parse_route_path(path: str) -> Dict[str,str]: + """Parses a route path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/privateConnections/(?P.+?)/routes/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + 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, ) + + @staticmethod + def parse_stream_path(path: str) -> Dict[str,str]: + """Parses a stream path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/streams/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + 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, ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str,str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path(folder: str, ) -> str: + """Returns a fully-qualified folder string.""" + return "folders/{folder}".format(folder=folder, ) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str,str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path(organization: str, ) -> str: + """Returns a fully-qualified organization string.""" + return "organizations/{organization}".format(organization=organization, ) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str,str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path(project: str, ) -> str: + """Returns a fully-qualified project string.""" + return "projects/{project}".format(project=project, ) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str,str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + 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, ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str,str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @classmethod + def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[client_options_lib.ClientOptions] = None): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variable is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + if client_options is None: + client_options = client_options_lib.ClientOptions() + use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") + use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_client_cert not in ("true", "false"): + raise ValueError("Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`") + if use_mtls_endpoint not in ("auto", "never", "always"): + raise MutualTLSChannelError("Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`") + + # Figure out the client cert source to use. + client_cert_source = None + if use_client_cert == "true": + if client_options.client_cert_source: + client_cert_source = client_options.client_cert_source + elif mtls.has_default_client_cert_source(): + client_cert_source = mtls.default_client_cert_source() + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + elif use_mtls_endpoint == "always" or (use_mtls_endpoint == "auto" and client_cert_source): + api_endpoint = cls.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = cls.DEFAULT_ENDPOINT + + return api_endpoint, client_cert_source + + def __init__(self, *, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Optional[Union[str, DatastreamTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiates the datastream client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, DatastreamTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) + + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source(client_options) + + api_key_value = getattr(client_options, "api_key", None) + if api_key_value and credentials: + raise ValueError("client_options.api_key and credentials are mutually exclusive") + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, DatastreamTransport): + # transport is a DatastreamTransport instance. + if credentials or client_options.credentials_file or api_key_value: + raise ValueError("When providing a transport instance, " + "provide its credentials directly.") + if client_options.scopes: + raise ValueError( + "When providing a transport instance, provide its scopes " + "directly." + ) + self._transport = transport + else: + import google.auth._default # type: ignore + + if api_key_value and hasattr(google.auth._default, "get_api_key_credentials"): + credentials = google.auth._default.get_api_key_credentials(api_key_value) + + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + client_cert_source_for_mtls=client_cert_source_func, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + always_use_jwt_access=True, + api_audience=client_options.api_audience, + ) + + def list_connection_profiles(self, + request: Optional[Union[datastream.ListConnectionProfilesRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListConnectionProfilesPager: + r"""Use this method to list connection profiles created + in a project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + def sample_list_connection_profiles(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.ListConnectionProfilesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_connection_profiles(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.datastream_v1alpha1.types.ListConnectionProfilesRequest, dict]): + The request object. + parent (str): + Required. The parent that owns the + collection of connection profiles. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1alpha1.services.datastream.pagers.ListConnectionProfilesPager: + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.ListConnectionProfilesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.ListConnectionProfilesRequest): + request = datastream.ListConnectionProfilesRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_connection_profiles] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + def get_connection_profile(self, + request: Optional[Union[datastream.GetConnectionProfileRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream_resources.ConnectionProfile: + r"""Use this method to get details about a connection + profile. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + def sample_get_connection_profile(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.GetConnectionProfileRequest( + name="name_value", + ) + + # Make the request + response = client.get_connection_profile(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1alpha1.types.GetConnectionProfileRequest, dict]): + The request object. + name (str): + Required. The name of the connection + profile resource to get. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1alpha1.types.ConnectionProfile: + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.GetConnectionProfileRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.GetConnectionProfileRequest): + request = datastream.GetConnectionProfileRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_connection_profile] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def create_connection_profile(self, + request: Optional[Union[datastream.CreateConnectionProfileRequest, dict]] = None, + *, + parent: Optional[str] = None, + connection_profile: Optional[datastream_resources.ConnectionProfile] = None, + connection_profile_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Use this method to create a connection profile in a + project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + def sample_create_connection_profile(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + connection_profile = datastream_v1alpha1.ConnectionProfile() + connection_profile.oracle_profile.hostname = "hostname_value" + connection_profile.oracle_profile.username = "username_value" + connection_profile.oracle_profile.password = "password_value" + connection_profile.oracle_profile.database_service = "database_service_value" + connection_profile.display_name = "display_name_value" + + request = datastream_v1alpha1.CreateConnectionProfileRequest( + parent="parent_value", + connection_profile_id="connection_profile_id_value", + connection_profile=connection_profile, + ) + + # Make the request + operation = client.create_connection_profile(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1alpha1.types.CreateConnectionProfileRequest, dict]): + The request object. + parent (str): + Required. The parent that owns the + collection of ConnectionProfiles. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + connection_profile (google.cloud.datastream_v1alpha1.types.ConnectionProfile): + Required. The connection profile + resource to create. + + This corresponds to the ``connection_profile`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + connection_profile_id (str): + Required. The connection profile + identifier. + + This corresponds to the ``connection_profile_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.datastream_v1alpha1.types.ConnectionProfile` + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, connection_profile, connection_profile_id]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.CreateConnectionProfileRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.CreateConnectionProfileRequest): + request = datastream.CreateConnectionProfileRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if connection_profile is not None: + request.connection_profile = connection_profile + if connection_profile_id is not None: + request.connection_profile_id = connection_profile_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_connection_profile] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + datastream_resources.ConnectionProfile, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + def update_connection_profile(self, + request: Optional[Union[datastream.UpdateConnectionProfileRequest, dict]] = None, + *, + connection_profile: Optional[datastream_resources.ConnectionProfile] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Use this method to update the parameters of a + connection profile. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + def sample_update_connection_profile(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + connection_profile = datastream_v1alpha1.ConnectionProfile() + connection_profile.oracle_profile.hostname = "hostname_value" + connection_profile.oracle_profile.username = "username_value" + connection_profile.oracle_profile.password = "password_value" + connection_profile.oracle_profile.database_service = "database_service_value" + connection_profile.display_name = "display_name_value" + + request = datastream_v1alpha1.UpdateConnectionProfileRequest( + connection_profile=connection_profile, + ) + + # Make the request + operation = client.update_connection_profile(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1alpha1.types.UpdateConnectionProfileRequest, dict]): + The request object. + connection_profile (google.cloud.datastream_v1alpha1.types.ConnectionProfile): + Required. The ConnectionProfile to + update. + + This corresponds to the ``connection_profile`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Optional. Field mask is used to specify the fields to be + overwritten in the ConnectionProfile resource by the + update. The fields specified in the update_mask are + relative to the resource, not the full request. A field + will be overwritten if it is in the mask. If the user + does not provide a mask then all fields will be + overwritten. + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.datastream_v1alpha1.types.ConnectionProfile` + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([connection_profile, update_mask]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.UpdateConnectionProfileRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.UpdateConnectionProfileRequest): + request = datastream.UpdateConnectionProfileRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if connection_profile is not None: + request.connection_profile = connection_profile + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_connection_profile] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("connection_profile.name", request.connection_profile.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + datastream_resources.ConnectionProfile, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + def delete_connection_profile(self, + request: Optional[Union[datastream.DeleteConnectionProfileRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Use this method to delete a connection profile.. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + def sample_delete_connection_profile(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.DeleteConnectionProfileRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_connection_profile(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1alpha1.types.DeleteConnectionProfileRequest, dict]): + The request object. + name (str): + Required. The name of the connection + profile resource to delete. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.DeleteConnectionProfileRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.DeleteConnectionProfileRequest): + request = datastream.DeleteConnectionProfileRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_connection_profile] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty_pb2.Empty, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + def discover_connection_profile(self, + request: Optional[Union[datastream.DiscoverConnectionProfileRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream.DiscoverConnectionProfileResponse: + r"""Use this method to discover a connection profile. + The discover API call exposes the data objects and + metadata belonging to the profile. Typically, a request + returns children data objects under a parent data object + that's optionally supplied in the request. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + def sample_discover_connection_profile(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + connection_profile = datastream_v1alpha1.ConnectionProfile() + connection_profile.oracle_profile.hostname = "hostname_value" + connection_profile.oracle_profile.username = "username_value" + connection_profile.oracle_profile.password = "password_value" + connection_profile.oracle_profile.database_service = "database_service_value" + connection_profile.display_name = "display_name_value" + + request = datastream_v1alpha1.DiscoverConnectionProfileRequest( + connection_profile=connection_profile, + recursive=True, + parent="parent_value", + ) + + # Make the request + response = client.discover_connection_profile(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1alpha1.types.DiscoverConnectionProfileRequest, dict]): + The request object. Request message for 'discover' + ConnectionProfile request. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1alpha1.types.DiscoverConnectionProfileResponse: + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a datastream.DiscoverConnectionProfileRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.DiscoverConnectionProfileRequest): + request = datastream.DiscoverConnectionProfileRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.discover_connection_profile] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_streams(self, + request: Optional[Union[datastream.ListStreamsRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListStreamsPager: + r"""Use this method to list streams in a project and + location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + def sample_list_streams(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.ListStreamsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_streams(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.datastream_v1alpha1.types.ListStreamsRequest, dict]): + The request object. + parent (str): + Required. The parent that owns the + collection of streams. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1alpha1.services.datastream.pagers.ListStreamsPager: + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.ListStreamsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.ListStreamsRequest): + request = datastream.ListStreamsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_streams] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + def get_stream(self, + request: Optional[Union[datastream.GetStreamRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream_resources.Stream: + r"""Use this method to get details about a stream. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + def sample_get_stream(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.GetStreamRequest( + name="name_value", + ) + + # Make the request + response = client.get_stream(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1alpha1.types.GetStreamRequest, dict]): + The request object. + name (str): + Required. The name of the stream + resource to get. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1alpha1.types.Stream: + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.GetStreamRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.GetStreamRequest): + request = datastream.GetStreamRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_stream] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def create_stream(self, + request: Optional[Union[datastream.CreateStreamRequest, dict]] = None, + *, + parent: Optional[str] = None, + stream: Optional[datastream_resources.Stream] = None, + stream_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Use this method to create a stream. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + def sample_create_stream(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + stream = datastream_v1alpha1.Stream() + stream.display_name = "display_name_value" + stream.source_config.source_connection_profile_name = "source_connection_profile_name_value" + stream.destination_config.destination_connection_profile_name = "destination_connection_profile_name_value" + + request = datastream_v1alpha1.CreateStreamRequest( + parent="parent_value", + stream_id="stream_id_value", + stream=stream, + ) + + # Make the request + operation = client.create_stream(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1alpha1.types.CreateStreamRequest, dict]): + The request object. + parent (str): + Required. The parent that owns the + collection of streams. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + stream (google.cloud.datastream_v1alpha1.types.Stream): + Required. The stream resource to + create. + + This corresponds to the ``stream`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + stream_id (str): + Required. The stream identifier. + This corresponds to the ``stream_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.datastream_v1alpha1.types.Stream` + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, stream, stream_id]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.CreateStreamRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.CreateStreamRequest): + request = datastream.CreateStreamRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if stream is not None: + request.stream = stream + if stream_id is not None: + request.stream_id = stream_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_stream] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + datastream_resources.Stream, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + def update_stream(self, + request: Optional[Union[datastream.UpdateStreamRequest, dict]] = None, + *, + stream: Optional[datastream_resources.Stream] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Use this method to update the configuration of a + stream. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + def sample_update_stream(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + stream = datastream_v1alpha1.Stream() + stream.display_name = "display_name_value" + stream.source_config.source_connection_profile_name = "source_connection_profile_name_value" + stream.destination_config.destination_connection_profile_name = "destination_connection_profile_name_value" + + request = datastream_v1alpha1.UpdateStreamRequest( + stream=stream, + ) + + # Make the request + operation = client.update_stream(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1alpha1.types.UpdateStreamRequest, dict]): + The request object. + stream (google.cloud.datastream_v1alpha1.types.Stream): + Required. The stream resource to + update. + + This corresponds to the ``stream`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Optional. Field mask is used to specify the fields to be + overwritten in the stream resource by the update. The + fields specified in the update_mask are relative to the + resource, not the full request. A field will be + overwritten if it is in the mask. If the user does not + provide a mask then all fields will be overwritten. + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.datastream_v1alpha1.types.Stream` + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([stream, update_mask]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.UpdateStreamRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.UpdateStreamRequest): + request = datastream.UpdateStreamRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if stream is not None: + request.stream = stream + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_stream] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("stream.name", request.stream.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + datastream_resources.Stream, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + def delete_stream(self, + request: Optional[Union[datastream.DeleteStreamRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Use this method to delete a stream. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + def sample_delete_stream(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.DeleteStreamRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_stream(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1alpha1.types.DeleteStreamRequest, dict]): + The request object. + name (str): + Required. The name of the stream + resource to delete. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.DeleteStreamRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.DeleteStreamRequest): + request = datastream.DeleteStreamRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_stream] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty_pb2.Empty, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + def fetch_errors(self, + request: Optional[Union[datastream.FetchErrorsRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Use this method to fetch any errors associated with a + stream. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + def sample_fetch_errors(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.FetchErrorsRequest( + ) + + # Make the request + operation = client.fetch_errors(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1alpha1.types.FetchErrorsRequest, dict]): + The request object. Request message for 'FetchErrors' + request. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.datastream_v1alpha1.types.FetchErrorsResponse` + Response message for a 'FetchErrors' response. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a datastream.FetchErrorsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.FetchErrorsRequest): + request = datastream.FetchErrorsRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.fetch_errors] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("stream", request.stream), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + datastream.FetchErrorsResponse, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + def fetch_static_ips(self, + request: Optional[Union[datastream.FetchStaticIpsRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.FetchStaticIpsPager: + r"""The FetchStaticIps API call exposes the static ips + used by Datastream. Typically, a request returns + children data objects under a parent data object that's + optionally supplied in the request. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + def sample_fetch_static_ips(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.FetchStaticIpsRequest( + name="name_value", + ) + + # Make the request + page_result = client.fetch_static_ips(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.datastream_v1alpha1.types.FetchStaticIpsRequest, dict]): + The request object. Request message for 'FetchStaticIps' + request. + name (str): + Required. The name resource of the Response type. Must + be in the format ``projects/*/locations/*``. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1alpha1.services.datastream.pagers.FetchStaticIpsPager: + Response message for a + 'FetchStaticIps' response. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.FetchStaticIpsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.FetchStaticIpsRequest): + request = datastream.FetchStaticIpsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.fetch_static_ips] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + def create_private_connection(self, + request: Optional[Union[datastream.CreatePrivateConnectionRequest, dict]] = None, + *, + parent: Optional[str] = None, + private_connection: Optional[datastream_resources.PrivateConnection] = None, + private_connection_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Use this method to create a private connectivity + configuration. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + def sample_create_private_connection(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + private_connection = datastream_v1alpha1.PrivateConnection() + private_connection.display_name = "display_name_value" + + request = datastream_v1alpha1.CreatePrivateConnectionRequest( + parent="parent_value", + private_connection_id="private_connection_id_value", + private_connection=private_connection, + ) + + # Make the request + operation = client.create_private_connection(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1alpha1.types.CreatePrivateConnectionRequest, dict]): + The request object. + parent (str): + Required. The parent that owns the + collection of PrivateConnections. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + private_connection (google.cloud.datastream_v1alpha1.types.PrivateConnection): + Required. The Private Connectivity + resource to create. + + This corresponds to the ``private_connection`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + private_connection_id (str): + Required. The private connectivity + identifier. + + This corresponds to the ``private_connection_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.datastream_v1alpha1.types.PrivateConnection` The PrivateConnection resource is used to establish private connectivity + between Datastream and a customer's network. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, private_connection, private_connection_id]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.CreatePrivateConnectionRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.CreatePrivateConnectionRequest): + request = datastream.CreatePrivateConnectionRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if private_connection is not None: + request.private_connection = private_connection + if private_connection_id is not None: + request.private_connection_id = private_connection_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_private_connection] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + datastream_resources.PrivateConnection, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + def get_private_connection(self, + request: Optional[Union[datastream.GetPrivateConnectionRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream_resources.PrivateConnection: + r"""Use this method to get details about a private + connectivity configuration. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + def sample_get_private_connection(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.GetPrivateConnectionRequest( + name="name_value", + ) + + # Make the request + response = client.get_private_connection(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1alpha1.types.GetPrivateConnectionRequest, dict]): + The request object. + name (str): + Required. The name of the private + connectivity configuration to get. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1alpha1.types.PrivateConnection: + The PrivateConnection resource is + used to establish private connectivity + between Datastream and a customer's + network. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.GetPrivateConnectionRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.GetPrivateConnectionRequest): + request = datastream.GetPrivateConnectionRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_private_connection] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_private_connections(self, + request: Optional[Union[datastream.ListPrivateConnectionsRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListPrivateConnectionsPager: + r"""Use this method to list private connectivity + configurations in a project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + def sample_list_private_connections(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.ListPrivateConnectionsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_private_connections(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.datastream_v1alpha1.types.ListPrivateConnectionsRequest, dict]): + The request object. + parent (str): + Required. The parent that owns the + collection of private connectivity + configurations. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1alpha1.services.datastream.pagers.ListPrivateConnectionsPager: + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.ListPrivateConnectionsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.ListPrivateConnectionsRequest): + request = datastream.ListPrivateConnectionsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_private_connections] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + def delete_private_connection(self, + request: Optional[Union[datastream.DeletePrivateConnectionRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Use this method to delete a private connectivity + configuration. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + def sample_delete_private_connection(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.DeletePrivateConnectionRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_private_connection(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1alpha1.types.DeletePrivateConnectionRequest, dict]): + The request object. + name (str): + Required. The name of the private + connectivity configuration to delete. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.DeletePrivateConnectionRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.DeletePrivateConnectionRequest): + request = datastream.DeletePrivateConnectionRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_private_connection] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty_pb2.Empty, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + def create_route(self, + request: Optional[Union[datastream.CreateRouteRequest, dict]] = None, + *, + parent: Optional[str] = None, + route: Optional[datastream_resources.Route] = None, + route_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Use this method to create a route for a private + connectivity in a project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + def sample_create_route(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + route = datastream_v1alpha1.Route() + route.display_name = "display_name_value" + route.destination_address = "destination_address_value" + + request = datastream_v1alpha1.CreateRouteRequest( + parent="parent_value", + route_id="route_id_value", + route=route, + ) + + # Make the request + operation = client.create_route(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1alpha1.types.CreateRouteRequest, dict]): + The request object. route creation request + parent (str): + Required. The parent that owns the + collection of Routes. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + route (google.cloud.datastream_v1alpha1.types.Route): + Required. The Route resource to + create. + + This corresponds to the ``route`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + route_id (str): + Required. The Route identifier. + This corresponds to the ``route_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.datastream_v1alpha1.types.Route` The Route resource is the child of the PrivateConnection resource. + It used to define a route for a PrivateConnection + setup. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, route, route_id]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.CreateRouteRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.CreateRouteRequest): + request = datastream.CreateRouteRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if route is not None: + request.route = route + if route_id is not None: + request.route_id = route_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_route] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + datastream_resources.Route, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + def get_route(self, + request: Optional[Union[datastream.GetRouteRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> datastream_resources.Route: + r"""Use this method to get details about a route. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + def sample_get_route(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.GetRouteRequest( + name="name_value", + ) + + # Make the request + response = client.get_route(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1alpha1.types.GetRouteRequest, dict]): + The request object. route get request + name (str): + Required. The name of the Route + resource to get. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1alpha1.types.Route: + The Route resource is the child of + the PrivateConnection resource. It used + to define a route for a + PrivateConnection setup. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.GetRouteRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.GetRouteRequest): + request = datastream.GetRouteRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_route] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_routes(self, + request: Optional[Union[datastream.ListRoutesRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListRoutesPager: + r"""Use this method to list routes created for a private + connectivity in a project and location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + def sample_list_routes(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.ListRoutesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_routes(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.datastream_v1alpha1.types.ListRoutesRequest, dict]): + The request object. route list request + parent (str): + Required. The parent that owns the + collection of Routess. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.datastream_v1alpha1.services.datastream.pagers.ListRoutesPager: + route list response + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.ListRoutesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.ListRoutesRequest): + request = datastream.ListRoutesRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_routes] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + 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, + ) + + # Done; return the response. + return response + + def delete_route(self, + request: Optional[Union[datastream.DeleteRouteRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Use this method to delete a route. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import datastream_v1alpha1 + + def sample_delete_route(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.DeleteRouteRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_route(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.datastream_v1alpha1.types.DeleteRouteRequest, dict]): + The request object. route deletion request + name (str): + Required. The name of the Route + resource to delete. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a datastream.DeleteRouteRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, datastream.DeleteRouteRequest): + request = datastream.DeleteRouteRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_route] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty_pb2.Empty, + metadata_type=datastream.OperationMetadata, + ) + + # Done; return the response. + return response + + def __enter__(self) -> "DatastreamClient": + return self + + def __exit__(self, type, value, traceback): + """Releases underlying transport's resources. + + .. warning:: + ONLY use as a context manager if the transport is NOT shared + with other clients! Exiting the with block will CLOSE the transport + and may cause errors in other clients! + """ + self.transport.close() + + + + + + + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) + + +__all__ = ( + "DatastreamClient", +) diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/pagers.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/pagers.py new file mode 100644 index 0000000..d74be17 --- /dev/null +++ b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/pagers.py @@ -0,0 +1,624 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from typing import Any, AsyncIterator, Awaitable, Callable, Sequence, Tuple, Optional, Iterator + +from google.cloud.datastream_v1alpha1.types import datastream +from google.cloud.datastream_v1alpha1.types import datastream_resources + + +class ListConnectionProfilesPager: + """A pager for iterating through ``list_connection_profiles`` requests. + + This class thinly wraps an initial + :class:`google.cloud.datastream_v1alpha1.types.ListConnectionProfilesResponse` object, and + provides an ``__iter__`` method to iterate through its + ``connection_profiles`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListConnectionProfiles`` requests and continue to iterate + through the ``connection_profiles`` field on the + corresponding responses. + + All the usual :class:`google.cloud.datastream_v1alpha1.types.ListConnectionProfilesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., datastream.ListConnectionProfilesResponse], + request: datastream.ListConnectionProfilesRequest, + response: datastream.ListConnectionProfilesResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.datastream_v1alpha1.types.ListConnectionProfilesRequest): + The initial request object. + response (google.cloud.datastream_v1alpha1.types.ListConnectionProfilesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = datastream.ListConnectionProfilesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[datastream.ListConnectionProfilesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[datastream_resources.ConnectionProfile]: + for page in self.pages: + yield from page.connection_profiles + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListConnectionProfilesAsyncPager: + """A pager for iterating through ``list_connection_profiles`` requests. + + This class thinly wraps an initial + :class:`google.cloud.datastream_v1alpha1.types.ListConnectionProfilesResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``connection_profiles`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListConnectionProfiles`` requests and continue to iterate + through the ``connection_profiles`` field on the + corresponding responses. + + All the usual :class:`google.cloud.datastream_v1alpha1.types.ListConnectionProfilesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[datastream.ListConnectionProfilesResponse]], + request: datastream.ListConnectionProfilesRequest, + response: datastream.ListConnectionProfilesResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.datastream_v1alpha1.types.ListConnectionProfilesRequest): + The initial request object. + response (google.cloud.datastream_v1alpha1.types.ListConnectionProfilesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = datastream.ListConnectionProfilesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[datastream.ListConnectionProfilesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[datastream_resources.ConnectionProfile]: + async def async_generator(): + async for page in self.pages: + for response in page.connection_profiles: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListStreamsPager: + """A pager for iterating through ``list_streams`` requests. + + This class thinly wraps an initial + :class:`google.cloud.datastream_v1alpha1.types.ListStreamsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``streams`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListStreams`` requests and continue to iterate + through the ``streams`` field on the + corresponding responses. + + All the usual :class:`google.cloud.datastream_v1alpha1.types.ListStreamsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., datastream.ListStreamsResponse], + request: datastream.ListStreamsRequest, + response: datastream.ListStreamsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.datastream_v1alpha1.types.ListStreamsRequest): + The initial request object. + response (google.cloud.datastream_v1alpha1.types.ListStreamsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = datastream.ListStreamsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[datastream.ListStreamsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[datastream_resources.Stream]: + for page in self.pages: + yield from page.streams + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListStreamsAsyncPager: + """A pager for iterating through ``list_streams`` requests. + + This class thinly wraps an initial + :class:`google.cloud.datastream_v1alpha1.types.ListStreamsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``streams`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListStreams`` requests and continue to iterate + through the ``streams`` field on the + corresponding responses. + + All the usual :class:`google.cloud.datastream_v1alpha1.types.ListStreamsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[datastream.ListStreamsResponse]], + request: datastream.ListStreamsRequest, + response: datastream.ListStreamsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.datastream_v1alpha1.types.ListStreamsRequest): + The initial request object. + response (google.cloud.datastream_v1alpha1.types.ListStreamsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = datastream.ListStreamsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[datastream.ListStreamsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[datastream_resources.Stream]: + async def async_generator(): + async for page in self.pages: + for response in page.streams: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class FetchStaticIpsPager: + """A pager for iterating through ``fetch_static_ips`` requests. + + This class thinly wraps an initial + :class:`google.cloud.datastream_v1alpha1.types.FetchStaticIpsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``static_ips`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``FetchStaticIps`` requests and continue to iterate + through the ``static_ips`` field on the + corresponding responses. + + All the usual :class:`google.cloud.datastream_v1alpha1.types.FetchStaticIpsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., datastream.FetchStaticIpsResponse], + request: datastream.FetchStaticIpsRequest, + response: datastream.FetchStaticIpsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.datastream_v1alpha1.types.FetchStaticIpsRequest): + The initial request object. + response (google.cloud.datastream_v1alpha1.types.FetchStaticIpsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = datastream.FetchStaticIpsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[datastream.FetchStaticIpsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[str]: + for page in self.pages: + yield from page.static_ips + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class FetchStaticIpsAsyncPager: + """A pager for iterating through ``fetch_static_ips`` requests. + + This class thinly wraps an initial + :class:`google.cloud.datastream_v1alpha1.types.FetchStaticIpsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``static_ips`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``FetchStaticIps`` requests and continue to iterate + through the ``static_ips`` field on the + corresponding responses. + + All the usual :class:`google.cloud.datastream_v1alpha1.types.FetchStaticIpsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[datastream.FetchStaticIpsResponse]], + request: datastream.FetchStaticIpsRequest, + response: datastream.FetchStaticIpsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.datastream_v1alpha1.types.FetchStaticIpsRequest): + The initial request object. + response (google.cloud.datastream_v1alpha1.types.FetchStaticIpsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = datastream.FetchStaticIpsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[datastream.FetchStaticIpsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[str]: + async def async_generator(): + async for page in self.pages: + for response in page.static_ips: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListPrivateConnectionsPager: + """A pager for iterating through ``list_private_connections`` requests. + + This class thinly wraps an initial + :class:`google.cloud.datastream_v1alpha1.types.ListPrivateConnectionsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``private_connections`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListPrivateConnections`` requests and continue to iterate + through the ``private_connections`` field on the + corresponding responses. + + All the usual :class:`google.cloud.datastream_v1alpha1.types.ListPrivateConnectionsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., datastream.ListPrivateConnectionsResponse], + request: datastream.ListPrivateConnectionsRequest, + response: datastream.ListPrivateConnectionsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.datastream_v1alpha1.types.ListPrivateConnectionsRequest): + The initial request object. + response (google.cloud.datastream_v1alpha1.types.ListPrivateConnectionsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = datastream.ListPrivateConnectionsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[datastream.ListPrivateConnectionsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[datastream_resources.PrivateConnection]: + for page in self.pages: + yield from page.private_connections + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListPrivateConnectionsAsyncPager: + """A pager for iterating through ``list_private_connections`` requests. + + This class thinly wraps an initial + :class:`google.cloud.datastream_v1alpha1.types.ListPrivateConnectionsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``private_connections`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListPrivateConnections`` requests and continue to iterate + through the ``private_connections`` field on the + corresponding responses. + + All the usual :class:`google.cloud.datastream_v1alpha1.types.ListPrivateConnectionsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[datastream.ListPrivateConnectionsResponse]], + request: datastream.ListPrivateConnectionsRequest, + response: datastream.ListPrivateConnectionsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.datastream_v1alpha1.types.ListPrivateConnectionsRequest): + The initial request object. + response (google.cloud.datastream_v1alpha1.types.ListPrivateConnectionsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = datastream.ListPrivateConnectionsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[datastream.ListPrivateConnectionsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[datastream_resources.PrivateConnection]: + async def async_generator(): + async for page in self.pages: + for response in page.private_connections: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListRoutesPager: + """A pager for iterating through ``list_routes`` requests. + + This class thinly wraps an initial + :class:`google.cloud.datastream_v1alpha1.types.ListRoutesResponse` object, and + provides an ``__iter__`` method to iterate through its + ``routes`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListRoutes`` requests and continue to iterate + through the ``routes`` field on the + corresponding responses. + + All the usual :class:`google.cloud.datastream_v1alpha1.types.ListRoutesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., datastream.ListRoutesResponse], + request: datastream.ListRoutesRequest, + response: datastream.ListRoutesResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.datastream_v1alpha1.types.ListRoutesRequest): + The initial request object. + response (google.cloud.datastream_v1alpha1.types.ListRoutesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = datastream.ListRoutesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[datastream.ListRoutesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[datastream_resources.Route]: + for page in self.pages: + yield from page.routes + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListRoutesAsyncPager: + """A pager for iterating through ``list_routes`` requests. + + This class thinly wraps an initial + :class:`google.cloud.datastream_v1alpha1.types.ListRoutesResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``routes`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListRoutes`` requests and continue to iterate + through the ``routes`` field on the + corresponding responses. + + All the usual :class:`google.cloud.datastream_v1alpha1.types.ListRoutesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[datastream.ListRoutesResponse]], + request: datastream.ListRoutesRequest, + response: datastream.ListRoutesResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.datastream_v1alpha1.types.ListRoutesRequest): + The initial request object. + response (google.cloud.datastream_v1alpha1.types.ListRoutesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = datastream.ListRoutesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[datastream.ListRoutesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[datastream_resources.Route]: + async def async_generator(): + async for page in self.pages: + for response in page.routes: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/__init__.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/__init__.py new file mode 100644 index 0000000..02599a2 --- /dev/null +++ b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/__init__.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from collections import OrderedDict +from typing import Dict, Type + +from .base import DatastreamTransport +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 +_transport_registry['grpc_asyncio'] = DatastreamGrpcAsyncIOTransport + +__all__ = ( + 'DatastreamTransport', + 'DatastreamGrpcTransport', + 'DatastreamGrpcAsyncIOTransport', +) diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/base.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/base.py new file mode 100644 index 0000000..3f42c0e --- /dev/null +++ b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/base.py @@ -0,0 +1,436 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import abc +from typing import Awaitable, Callable, Dict, Optional, Sequence, Union + +from google.cloud.datastream_v1alpha1 import gapic_version as package_version + +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 retry as retries +from google.api_core import operations_v1 +from google.auth import credentials as ga_credentials # type: ignore +from google.oauth2 import service_account # 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 + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) + + +class DatastreamTransport(abc.ABC): + """Abstract transport class for Datastream.""" + + AUTH_SCOPES = ( + 'https://www.googleapis.com/auth/cloud-platform', + ) + + DEFAULT_HOST: str = 'datastream.googleapis.com' + def __init__( + self, *, + host: str = DEFAULT_HOST, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + """ + + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} + + # Save the scopes. + self._scopes = scopes + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise core_exceptions.DuplicateCredentialArgs("'credentials_file' and 'credentials' are mutually exclusive") + + if credentials_file is not None: + credentials, _ = google.auth.load_credentials_from_file( + credentials_file, + **scopes_kwargs, + quota_project_id=quota_project_id + ) + elif credentials is None: + credentials, _ = google.auth.default(**scopes_kwargs, quota_project_id=quota_project_id) + # Don't apply audience if the credentials file passed from user. + if hasattr(credentials, "with_gdch_audience"): + credentials = credentials.with_gdch_audience(api_audience if api_audience else host) + + # If the credentials are service account credentials, then always try to use self signed JWT. + if always_use_jwt_access and isinstance(credentials, service_account.Credentials) and hasattr(service_account.Credentials, "with_always_use_jwt_access"): + credentials = credentials.with_always_use_jwt_access(True) + + # Save the credentials. + self._credentials = credentials + + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ':' not in host: + host += ':443' + self._host = host + + def _prep_wrapped_messages(self, client_info): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.list_connection_profiles: gapic_v1.method.wrap_method( + self.list_connection_profiles, + default_timeout=None, + client_info=client_info, + ), + self.get_connection_profile: gapic_v1.method.wrap_method( + self.get_connection_profile, + default_timeout=None, + client_info=client_info, + ), + self.create_connection_profile: gapic_v1.method.wrap_method( + self.create_connection_profile, + default_timeout=60.0, + client_info=client_info, + ), + self.update_connection_profile: gapic_v1.method.wrap_method( + self.update_connection_profile, + default_timeout=60.0, + client_info=client_info, + ), + self.delete_connection_profile: gapic_v1.method.wrap_method( + self.delete_connection_profile, + default_timeout=60.0, + client_info=client_info, + ), + self.discover_connection_profile: gapic_v1.method.wrap_method( + self.discover_connection_profile, + default_timeout=None, + client_info=client_info, + ), + self.list_streams: gapic_v1.method.wrap_method( + 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.create_stream: gapic_v1.method.wrap_method( + 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.delete_stream: gapic_v1.method.wrap_method( + 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_static_ips: gapic_v1.method.wrap_method( + self.fetch_static_ips, + default_timeout=None, + client_info=client_info, + ), + self.create_private_connection: gapic_v1.method.wrap_method( + self.create_private_connection, + default_timeout=60.0, + client_info=client_info, + ), + self.get_private_connection: gapic_v1.method.wrap_method( + self.get_private_connection, + default_timeout=None, + client_info=client_info, + ), + self.list_private_connections: gapic_v1.method.wrap_method( + self.list_private_connections, + default_timeout=None, + client_info=client_info, + ), + self.delete_private_connection: gapic_v1.method.wrap_method( + self.delete_private_connection, + default_timeout=60.0, + client_info=client_info, + ), + self.create_route: gapic_v1.method.wrap_method( + 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.list_routes: gapic_v1.method.wrap_method( + 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, + ), + } + + 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! + """ + raise NotImplementedError() + + @property + def operations_client(self): + """Return the client designed to process long-running operations.""" + raise NotImplementedError() + + @property + def list_connection_profiles(self) -> Callable[ + [datastream.ListConnectionProfilesRequest], + Union[ + datastream.ListConnectionProfilesResponse, + Awaitable[datastream.ListConnectionProfilesResponse] + ]]: + raise NotImplementedError() + + @property + def get_connection_profile(self) -> Callable[ + [datastream.GetConnectionProfileRequest], + Union[ + datastream_resources.ConnectionProfile, + Awaitable[datastream_resources.ConnectionProfile] + ]]: + raise NotImplementedError() + + @property + def create_connection_profile(self) -> Callable[ + [datastream.CreateConnectionProfileRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def update_connection_profile(self) -> Callable[ + [datastream.UpdateConnectionProfileRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def delete_connection_profile(self) -> Callable[ + [datastream.DeleteConnectionProfileRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def discover_connection_profile(self) -> Callable[ + [datastream.DiscoverConnectionProfileRequest], + Union[ + datastream.DiscoverConnectionProfileResponse, + Awaitable[datastream.DiscoverConnectionProfileResponse] + ]]: + raise NotImplementedError() + + @property + def list_streams(self) -> Callable[ + [datastream.ListStreamsRequest], + Union[ + datastream.ListStreamsResponse, + Awaitable[datastream.ListStreamsResponse] + ]]: + raise NotImplementedError() + + @property + def get_stream(self) -> Callable[ + [datastream.GetStreamRequest], + Union[ + datastream_resources.Stream, + Awaitable[datastream_resources.Stream] + ]]: + raise NotImplementedError() + + @property + def create_stream(self) -> Callable[ + [datastream.CreateStreamRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def update_stream(self) -> Callable[ + [datastream.UpdateStreamRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def delete_stream(self) -> Callable[ + [datastream.DeleteStreamRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def fetch_errors(self) -> Callable[ + [datastream.FetchErrorsRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def fetch_static_ips(self) -> Callable[ + [datastream.FetchStaticIpsRequest], + Union[ + datastream.FetchStaticIpsResponse, + Awaitable[datastream.FetchStaticIpsResponse] + ]]: + raise NotImplementedError() + + @property + def create_private_connection(self) -> Callable[ + [datastream.CreatePrivateConnectionRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def get_private_connection(self) -> Callable[ + [datastream.GetPrivateConnectionRequest], + Union[ + datastream_resources.PrivateConnection, + Awaitable[datastream_resources.PrivateConnection] + ]]: + raise NotImplementedError() + + @property + def list_private_connections(self) -> Callable[ + [datastream.ListPrivateConnectionsRequest], + Union[ + datastream.ListPrivateConnectionsResponse, + Awaitable[datastream.ListPrivateConnectionsResponse] + ]]: + raise NotImplementedError() + + @property + def delete_private_connection(self) -> Callable[ + [datastream.DeletePrivateConnectionRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def create_route(self) -> Callable[ + [datastream.CreateRouteRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def get_route(self) -> Callable[ + [datastream.GetRouteRequest], + Union[ + datastream_resources.Route, + Awaitable[datastream_resources.Route] + ]]: + raise NotImplementedError() + + @property + def list_routes(self) -> Callable[ + [datastream.ListRoutesRequest], + Union[ + datastream.ListRoutesResponse, + Awaitable[datastream.ListRoutesResponse] + ]]: + raise NotImplementedError() + + @property + def delete_route(self) -> Callable[ + [datastream.DeleteRouteRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def kind(self) -> str: + raise NotImplementedError() + + +__all__ = ( + 'DatastreamTransport', +) diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/grpc.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/grpc.py new file mode 100644 index 0000000..8214220 --- /dev/null +++ b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/grpc.py @@ -0,0 +1,824 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple, Union + +from google.api_core import grpc_helpers +from google.api_core import operations_v1 +from google.api_core import gapic_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 + +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 + + +class DatastreamGrpcTransport(DatastreamTransport): + """gRPC backend transport for Datastream. + + Datastream service + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + _stubs: Dict[str, Callable] + + def __init__(self, *, + host: str = 'datastream.googleapis.com', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or application default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for the grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure a mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._grpc_channel = None + self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} + self._operations_client: Optional[operations_v1.OperationsClient] = None + + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + + if channel: + # Ignore credentials if a channel was passed. + credentials = False + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + + else: + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials + + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, + ) + + if not self._grpc_channel: + self._grpc_channel = type(self).create_channel( + self._host, + # use the credentials which are saved + credentials=self._credentials, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, + scopes=self._scopes, + ssl_credentials=self._ssl_channel_credentials, + quota_project_id=quota_project_id, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) + + @classmethod + def create_channel(cls, + host: str = 'datastream.googleapis.com', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + host (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + quota_project_id=quota_project_id, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, + **kwargs + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Return the channel designed to connect to this service. + """ + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Quick check: Only create a new client if we do not already have one. + if self._operations_client is None: + self._operations_client = operations_v1.OperationsClient( + self.grpc_channel + ) + + # Return the client from cache. + return self._operations_client + + @property + def list_connection_profiles(self) -> Callable[ + [datastream.ListConnectionProfilesRequest], + datastream.ListConnectionProfilesResponse]: + r"""Return a callable for the list connection profiles method over gRPC. + + Use this method to list connection profiles created + in a project and location. + + Returns: + Callable[[~.ListConnectionProfilesRequest], + ~.ListConnectionProfilesResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_connection_profiles' not in self._stubs: + self._stubs['list_connection_profiles'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/ListConnectionProfiles', + request_serializer=datastream.ListConnectionProfilesRequest.serialize, + response_deserializer=datastream.ListConnectionProfilesResponse.deserialize, + ) + return self._stubs['list_connection_profiles'] + + @property + def get_connection_profile(self) -> Callable[ + [datastream.GetConnectionProfileRequest], + datastream_resources.ConnectionProfile]: + r"""Return a callable for the get connection profile method over gRPC. + + Use this method to get details about a connection + profile. + + Returns: + Callable[[~.GetConnectionProfileRequest], + ~.ConnectionProfile]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_connection_profile' not in self._stubs: + self._stubs['get_connection_profile'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/GetConnectionProfile', + request_serializer=datastream.GetConnectionProfileRequest.serialize, + response_deserializer=datastream_resources.ConnectionProfile.deserialize, + ) + return self._stubs['get_connection_profile'] + + @property + def create_connection_profile(self) -> Callable[ + [datastream.CreateConnectionProfileRequest], + operations_pb2.Operation]: + r"""Return a callable for the create connection profile method over gRPC. + + Use this method to create a connection profile in a + project and location. + + Returns: + Callable[[~.CreateConnectionProfileRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_connection_profile' not in self._stubs: + self._stubs['create_connection_profile'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/CreateConnectionProfile', + request_serializer=datastream.CreateConnectionProfileRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_connection_profile'] + + @property + def update_connection_profile(self) -> Callable[ + [datastream.UpdateConnectionProfileRequest], + operations_pb2.Operation]: + r"""Return a callable for the update connection profile method over gRPC. + + Use this method to update the parameters of a + connection profile. + + Returns: + Callable[[~.UpdateConnectionProfileRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_connection_profile' not in self._stubs: + self._stubs['update_connection_profile'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/UpdateConnectionProfile', + request_serializer=datastream.UpdateConnectionProfileRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['update_connection_profile'] + + @property + def delete_connection_profile(self) -> Callable[ + [datastream.DeleteConnectionProfileRequest], + operations_pb2.Operation]: + r"""Return a callable for the delete connection profile method over gRPC. + + Use this method to delete a connection profile.. + + Returns: + Callable[[~.DeleteConnectionProfileRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_connection_profile' not in self._stubs: + self._stubs['delete_connection_profile'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/DeleteConnectionProfile', + request_serializer=datastream.DeleteConnectionProfileRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['delete_connection_profile'] + + @property + def discover_connection_profile(self) -> Callable[ + [datastream.DiscoverConnectionProfileRequest], + datastream.DiscoverConnectionProfileResponse]: + r"""Return a callable for the discover connection profile method over gRPC. + + Use this method to discover a connection profile. + The discover API call exposes the data objects and + metadata belonging to the profile. Typically, a request + returns children data objects under a parent data object + that's optionally supplied in the request. + + Returns: + Callable[[~.DiscoverConnectionProfileRequest], + ~.DiscoverConnectionProfileResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'discover_connection_profile' not in self._stubs: + self._stubs['discover_connection_profile'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/DiscoverConnectionProfile', + request_serializer=datastream.DiscoverConnectionProfileRequest.serialize, + response_deserializer=datastream.DiscoverConnectionProfileResponse.deserialize, + ) + return self._stubs['discover_connection_profile'] + + @property + def list_streams(self) -> Callable[ + [datastream.ListStreamsRequest], + datastream.ListStreamsResponse]: + r"""Return a callable for the list streams method over gRPC. + + Use this method to list streams in a project and + location. + + Returns: + Callable[[~.ListStreamsRequest], + ~.ListStreamsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_streams' not in self._stubs: + self._stubs['list_streams'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/ListStreams', + request_serializer=datastream.ListStreamsRequest.serialize, + response_deserializer=datastream.ListStreamsResponse.deserialize, + ) + return self._stubs['list_streams'] + + @property + def get_stream(self) -> Callable[ + [datastream.GetStreamRequest], + datastream_resources.Stream]: + r"""Return a callable for the get stream method over gRPC. + + Use this method to get details about a stream. + + Returns: + Callable[[~.GetStreamRequest], + ~.Stream]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_stream' not in self._stubs: + self._stubs['get_stream'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/GetStream', + request_serializer=datastream.GetStreamRequest.serialize, + response_deserializer=datastream_resources.Stream.deserialize, + ) + return self._stubs['get_stream'] + + @property + def create_stream(self) -> Callable[ + [datastream.CreateStreamRequest], + operations_pb2.Operation]: + r"""Return a callable for the create stream method over gRPC. + + Use this method to create a stream. + + Returns: + Callable[[~.CreateStreamRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_stream' not in self._stubs: + self._stubs['create_stream'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/CreateStream', + request_serializer=datastream.CreateStreamRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_stream'] + + @property + def update_stream(self) -> Callable[ + [datastream.UpdateStreamRequest], + operations_pb2.Operation]: + r"""Return a callable for the update stream method over gRPC. + + Use this method to update the configuration of a + stream. + + Returns: + Callable[[~.UpdateStreamRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_stream' not in self._stubs: + self._stubs['update_stream'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/UpdateStream', + request_serializer=datastream.UpdateStreamRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['update_stream'] + + @property + def delete_stream(self) -> Callable[ + [datastream.DeleteStreamRequest], + operations_pb2.Operation]: + r"""Return a callable for the delete stream method over gRPC. + + Use this method to delete a stream. + + Returns: + Callable[[~.DeleteStreamRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_stream' not in self._stubs: + self._stubs['delete_stream'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/DeleteStream', + request_serializer=datastream.DeleteStreamRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['delete_stream'] + + @property + def fetch_errors(self) -> Callable[ + [datastream.FetchErrorsRequest], + operations_pb2.Operation]: + r"""Return a callable for the fetch errors method over gRPC. + + Use this method to fetch any errors associated with a + stream. + + Returns: + Callable[[~.FetchErrorsRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'fetch_errors' not in self._stubs: + self._stubs['fetch_errors'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/FetchErrors', + request_serializer=datastream.FetchErrorsRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['fetch_errors'] + + @property + def fetch_static_ips(self) -> Callable[ + [datastream.FetchStaticIpsRequest], + datastream.FetchStaticIpsResponse]: + r"""Return a callable for the fetch static ips method over gRPC. + + The FetchStaticIps API call exposes the static ips + used by Datastream. Typically, a request returns + children data objects under a parent data object that's + optionally supplied in the request. + + Returns: + Callable[[~.FetchStaticIpsRequest], + ~.FetchStaticIpsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'fetch_static_ips' not in self._stubs: + self._stubs['fetch_static_ips'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/FetchStaticIps', + request_serializer=datastream.FetchStaticIpsRequest.serialize, + response_deserializer=datastream.FetchStaticIpsResponse.deserialize, + ) + return self._stubs['fetch_static_ips'] + + @property + def create_private_connection(self) -> Callable[ + [datastream.CreatePrivateConnectionRequest], + operations_pb2.Operation]: + r"""Return a callable for the create private connection method over gRPC. + + Use this method to create a private connectivity + configuration. + + Returns: + Callable[[~.CreatePrivateConnectionRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_private_connection' not in self._stubs: + self._stubs['create_private_connection'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/CreatePrivateConnection', + request_serializer=datastream.CreatePrivateConnectionRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_private_connection'] + + @property + def get_private_connection(self) -> Callable[ + [datastream.GetPrivateConnectionRequest], + datastream_resources.PrivateConnection]: + r"""Return a callable for the get private connection method over gRPC. + + Use this method to get details about a private + connectivity configuration. + + Returns: + Callable[[~.GetPrivateConnectionRequest], + ~.PrivateConnection]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_private_connection' not in self._stubs: + self._stubs['get_private_connection'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/GetPrivateConnection', + request_serializer=datastream.GetPrivateConnectionRequest.serialize, + response_deserializer=datastream_resources.PrivateConnection.deserialize, + ) + return self._stubs['get_private_connection'] + + @property + def list_private_connections(self) -> Callable[ + [datastream.ListPrivateConnectionsRequest], + datastream.ListPrivateConnectionsResponse]: + r"""Return a callable for the list private connections method over gRPC. + + Use this method to list private connectivity + configurations in a project and location. + + Returns: + Callable[[~.ListPrivateConnectionsRequest], + ~.ListPrivateConnectionsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_private_connections' not in self._stubs: + self._stubs['list_private_connections'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/ListPrivateConnections', + request_serializer=datastream.ListPrivateConnectionsRequest.serialize, + response_deserializer=datastream.ListPrivateConnectionsResponse.deserialize, + ) + return self._stubs['list_private_connections'] + + @property + def delete_private_connection(self) -> Callable[ + [datastream.DeletePrivateConnectionRequest], + operations_pb2.Operation]: + r"""Return a callable for the delete private connection method over gRPC. + + Use this method to delete a private connectivity + configuration. + + Returns: + Callable[[~.DeletePrivateConnectionRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_private_connection' not in self._stubs: + self._stubs['delete_private_connection'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/DeletePrivateConnection', + request_serializer=datastream.DeletePrivateConnectionRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['delete_private_connection'] + + @property + def create_route(self) -> Callable[ + [datastream.CreateRouteRequest], + operations_pb2.Operation]: + r"""Return a callable for the create route method over gRPC. + + Use this method to create a route for a private + connectivity in a project and location. + + Returns: + Callable[[~.CreateRouteRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_route' not in self._stubs: + self._stubs['create_route'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/CreateRoute', + request_serializer=datastream.CreateRouteRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_route'] + + @property + def get_route(self) -> Callable[ + [datastream.GetRouteRequest], + datastream_resources.Route]: + r"""Return a callable for the get route method over gRPC. + + Use this method to get details about a route. + + Returns: + Callable[[~.GetRouteRequest], + ~.Route]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_route' not in self._stubs: + self._stubs['get_route'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/GetRoute', + request_serializer=datastream.GetRouteRequest.serialize, + response_deserializer=datastream_resources.Route.deserialize, + ) + return self._stubs['get_route'] + + @property + def list_routes(self) -> Callable[ + [datastream.ListRoutesRequest], + datastream.ListRoutesResponse]: + r"""Return a callable for the list routes method over gRPC. + + Use this method to list routes created for a private + connectivity in a project and location. + + Returns: + Callable[[~.ListRoutesRequest], + ~.ListRoutesResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_routes' not in self._stubs: + self._stubs['list_routes'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/ListRoutes', + request_serializer=datastream.ListRoutesRequest.serialize, + response_deserializer=datastream.ListRoutesResponse.deserialize, + ) + return self._stubs['list_routes'] + + @property + def delete_route(self) -> Callable[ + [datastream.DeleteRouteRequest], + operations_pb2.Operation]: + r"""Return a callable for the delete route method over gRPC. + + Use this method to delete a route. + + Returns: + Callable[[~.DeleteRouteRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_route' not in self._stubs: + self._stubs['delete_route'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/DeleteRoute', + request_serializer=datastream.DeleteRouteRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['delete_route'] + + def close(self): + self.grpc_channel.close() + + @property + def kind(self) -> str: + return "grpc" + + +__all__ = ( + 'DatastreamGrpcTransport', +) diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/grpc_asyncio.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/grpc_asyncio.py new file mode 100644 index 0000000..3f6eea2 --- /dev/null +++ b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/grpc_asyncio.py @@ -0,0 +1,823 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import warnings +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union + +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async +from google.api_core import operations_v1 +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # 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 .grpc import DatastreamGrpcTransport + + +class DatastreamGrpcAsyncIOTransport(DatastreamTransport): + """gRPC AsyncIO backend transport for Datastream. + + Datastream service + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel(cls, + host: str = 'datastream.googleapis.com', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + host (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + quota_project_id=quota_project_id, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, + **kwargs + ) + + def __init__(self, *, + host: str = 'datastream.googleapis.com', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or application default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for the grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure a mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._grpc_channel = None + self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} + self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None + + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + + if channel: + # Ignore credentials if a channel was passed. + credentials = False + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + else: + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials + + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, + ) + + if not self._grpc_channel: + self._grpc_channel = type(self).create_channel( + self._host, + # use the credentials which are saved + credentials=self._credentials, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, + scopes=self._scopes, + ssl_credentials=self._ssl_channel_credentials, + quota_project_id=quota_project_id, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Return the channel from cache. + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsAsyncClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Quick check: Only create a new client if we do not already have one. + if self._operations_client is None: + self._operations_client = operations_v1.OperationsAsyncClient( + self.grpc_channel + ) + + # Return the client from cache. + return self._operations_client + + @property + def list_connection_profiles(self) -> Callable[ + [datastream.ListConnectionProfilesRequest], + Awaitable[datastream.ListConnectionProfilesResponse]]: + r"""Return a callable for the list connection profiles method over gRPC. + + Use this method to list connection profiles created + in a project and location. + + Returns: + Callable[[~.ListConnectionProfilesRequest], + Awaitable[~.ListConnectionProfilesResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_connection_profiles' not in self._stubs: + self._stubs['list_connection_profiles'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/ListConnectionProfiles', + request_serializer=datastream.ListConnectionProfilesRequest.serialize, + response_deserializer=datastream.ListConnectionProfilesResponse.deserialize, + ) + return self._stubs['list_connection_profiles'] + + @property + def get_connection_profile(self) -> Callable[ + [datastream.GetConnectionProfileRequest], + Awaitable[datastream_resources.ConnectionProfile]]: + r"""Return a callable for the get connection profile method over gRPC. + + Use this method to get details about a connection + profile. + + Returns: + Callable[[~.GetConnectionProfileRequest], + Awaitable[~.ConnectionProfile]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_connection_profile' not in self._stubs: + self._stubs['get_connection_profile'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/GetConnectionProfile', + request_serializer=datastream.GetConnectionProfileRequest.serialize, + response_deserializer=datastream_resources.ConnectionProfile.deserialize, + ) + return self._stubs['get_connection_profile'] + + @property + def create_connection_profile(self) -> Callable[ + [datastream.CreateConnectionProfileRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the create connection profile method over gRPC. + + Use this method to create a connection profile in a + project and location. + + Returns: + Callable[[~.CreateConnectionProfileRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_connection_profile' not in self._stubs: + self._stubs['create_connection_profile'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/CreateConnectionProfile', + request_serializer=datastream.CreateConnectionProfileRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_connection_profile'] + + @property + def update_connection_profile(self) -> Callable[ + [datastream.UpdateConnectionProfileRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the update connection profile method over gRPC. + + Use this method to update the parameters of a + connection profile. + + Returns: + Callable[[~.UpdateConnectionProfileRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_connection_profile' not in self._stubs: + self._stubs['update_connection_profile'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/UpdateConnectionProfile', + request_serializer=datastream.UpdateConnectionProfileRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['update_connection_profile'] + + @property + def delete_connection_profile(self) -> Callable[ + [datastream.DeleteConnectionProfileRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the delete connection profile method over gRPC. + + Use this method to delete a connection profile.. + + Returns: + Callable[[~.DeleteConnectionProfileRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_connection_profile' not in self._stubs: + self._stubs['delete_connection_profile'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/DeleteConnectionProfile', + request_serializer=datastream.DeleteConnectionProfileRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['delete_connection_profile'] + + @property + def discover_connection_profile(self) -> Callable[ + [datastream.DiscoverConnectionProfileRequest], + Awaitable[datastream.DiscoverConnectionProfileResponse]]: + r"""Return a callable for the discover connection profile method over gRPC. + + Use this method to discover a connection profile. + The discover API call exposes the data objects and + metadata belonging to the profile. Typically, a request + returns children data objects under a parent data object + that's optionally supplied in the request. + + Returns: + Callable[[~.DiscoverConnectionProfileRequest], + Awaitable[~.DiscoverConnectionProfileResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'discover_connection_profile' not in self._stubs: + self._stubs['discover_connection_profile'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/DiscoverConnectionProfile', + request_serializer=datastream.DiscoverConnectionProfileRequest.serialize, + response_deserializer=datastream.DiscoverConnectionProfileResponse.deserialize, + ) + return self._stubs['discover_connection_profile'] + + @property + def list_streams(self) -> Callable[ + [datastream.ListStreamsRequest], + Awaitable[datastream.ListStreamsResponse]]: + r"""Return a callable for the list streams method over gRPC. + + Use this method to list streams in a project and + location. + + Returns: + Callable[[~.ListStreamsRequest], + Awaitable[~.ListStreamsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_streams' not in self._stubs: + self._stubs['list_streams'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/ListStreams', + request_serializer=datastream.ListStreamsRequest.serialize, + response_deserializer=datastream.ListStreamsResponse.deserialize, + ) + return self._stubs['list_streams'] + + @property + def get_stream(self) -> Callable[ + [datastream.GetStreamRequest], + Awaitable[datastream_resources.Stream]]: + r"""Return a callable for the get stream method over gRPC. + + Use this method to get details about a stream. + + Returns: + Callable[[~.GetStreamRequest], + Awaitable[~.Stream]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_stream' not in self._stubs: + self._stubs['get_stream'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/GetStream', + request_serializer=datastream.GetStreamRequest.serialize, + response_deserializer=datastream_resources.Stream.deserialize, + ) + return self._stubs['get_stream'] + + @property + def create_stream(self) -> Callable[ + [datastream.CreateStreamRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the create stream method over gRPC. + + Use this method to create a stream. + + Returns: + Callable[[~.CreateStreamRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_stream' not in self._stubs: + self._stubs['create_stream'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/CreateStream', + request_serializer=datastream.CreateStreamRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_stream'] + + @property + def update_stream(self) -> Callable[ + [datastream.UpdateStreamRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the update stream method over gRPC. + + Use this method to update the configuration of a + stream. + + Returns: + Callable[[~.UpdateStreamRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_stream' not in self._stubs: + self._stubs['update_stream'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/UpdateStream', + request_serializer=datastream.UpdateStreamRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['update_stream'] + + @property + def delete_stream(self) -> Callable[ + [datastream.DeleteStreamRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the delete stream method over gRPC. + + Use this method to delete a stream. + + Returns: + Callable[[~.DeleteStreamRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_stream' not in self._stubs: + self._stubs['delete_stream'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/DeleteStream', + request_serializer=datastream.DeleteStreamRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['delete_stream'] + + @property + def fetch_errors(self) -> Callable[ + [datastream.FetchErrorsRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the fetch errors method over gRPC. + + Use this method to fetch any errors associated with a + stream. + + Returns: + Callable[[~.FetchErrorsRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'fetch_errors' not in self._stubs: + self._stubs['fetch_errors'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/FetchErrors', + request_serializer=datastream.FetchErrorsRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['fetch_errors'] + + @property + def fetch_static_ips(self) -> Callable[ + [datastream.FetchStaticIpsRequest], + Awaitable[datastream.FetchStaticIpsResponse]]: + r"""Return a callable for the fetch static ips method over gRPC. + + The FetchStaticIps API call exposes the static ips + used by Datastream. Typically, a request returns + children data objects under a parent data object that's + optionally supplied in the request. + + Returns: + Callable[[~.FetchStaticIpsRequest], + Awaitable[~.FetchStaticIpsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'fetch_static_ips' not in self._stubs: + self._stubs['fetch_static_ips'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/FetchStaticIps', + request_serializer=datastream.FetchStaticIpsRequest.serialize, + response_deserializer=datastream.FetchStaticIpsResponse.deserialize, + ) + return self._stubs['fetch_static_ips'] + + @property + def create_private_connection(self) -> Callable[ + [datastream.CreatePrivateConnectionRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the create private connection method over gRPC. + + Use this method to create a private connectivity + configuration. + + Returns: + Callable[[~.CreatePrivateConnectionRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_private_connection' not in self._stubs: + self._stubs['create_private_connection'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/CreatePrivateConnection', + request_serializer=datastream.CreatePrivateConnectionRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_private_connection'] + + @property + def get_private_connection(self) -> Callable[ + [datastream.GetPrivateConnectionRequest], + Awaitable[datastream_resources.PrivateConnection]]: + r"""Return a callable for the get private connection method over gRPC. + + Use this method to get details about a private + connectivity configuration. + + Returns: + Callable[[~.GetPrivateConnectionRequest], + Awaitable[~.PrivateConnection]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_private_connection' not in self._stubs: + self._stubs['get_private_connection'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/GetPrivateConnection', + request_serializer=datastream.GetPrivateConnectionRequest.serialize, + response_deserializer=datastream_resources.PrivateConnection.deserialize, + ) + return self._stubs['get_private_connection'] + + @property + def list_private_connections(self) -> Callable[ + [datastream.ListPrivateConnectionsRequest], + Awaitable[datastream.ListPrivateConnectionsResponse]]: + r"""Return a callable for the list private connections method over gRPC. + + Use this method to list private connectivity + configurations in a project and location. + + Returns: + Callable[[~.ListPrivateConnectionsRequest], + Awaitable[~.ListPrivateConnectionsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_private_connections' not in self._stubs: + self._stubs['list_private_connections'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/ListPrivateConnections', + request_serializer=datastream.ListPrivateConnectionsRequest.serialize, + response_deserializer=datastream.ListPrivateConnectionsResponse.deserialize, + ) + return self._stubs['list_private_connections'] + + @property + def delete_private_connection(self) -> Callable[ + [datastream.DeletePrivateConnectionRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the delete private connection method over gRPC. + + Use this method to delete a private connectivity + configuration. + + Returns: + Callable[[~.DeletePrivateConnectionRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_private_connection' not in self._stubs: + self._stubs['delete_private_connection'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/DeletePrivateConnection', + request_serializer=datastream.DeletePrivateConnectionRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['delete_private_connection'] + + @property + def create_route(self) -> Callable[ + [datastream.CreateRouteRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the create route method over gRPC. + + Use this method to create a route for a private + connectivity in a project and location. + + Returns: + Callable[[~.CreateRouteRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_route' not in self._stubs: + self._stubs['create_route'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/CreateRoute', + request_serializer=datastream.CreateRouteRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_route'] + + @property + def get_route(self) -> Callable[ + [datastream.GetRouteRequest], + Awaitable[datastream_resources.Route]]: + r"""Return a callable for the get route method over gRPC. + + Use this method to get details about a route. + + Returns: + Callable[[~.GetRouteRequest], + Awaitable[~.Route]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_route' not in self._stubs: + self._stubs['get_route'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/GetRoute', + request_serializer=datastream.GetRouteRequest.serialize, + response_deserializer=datastream_resources.Route.deserialize, + ) + return self._stubs['get_route'] + + @property + def list_routes(self) -> Callable[ + [datastream.ListRoutesRequest], + Awaitable[datastream.ListRoutesResponse]]: + r"""Return a callable for the list routes method over gRPC. + + Use this method to list routes created for a private + connectivity in a project and location. + + Returns: + Callable[[~.ListRoutesRequest], + Awaitable[~.ListRoutesResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_routes' not in self._stubs: + self._stubs['list_routes'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/ListRoutes', + request_serializer=datastream.ListRoutesRequest.serialize, + response_deserializer=datastream.ListRoutesResponse.deserialize, + ) + return self._stubs['list_routes'] + + @property + def delete_route(self) -> Callable[ + [datastream.DeleteRouteRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the delete route method over gRPC. + + Use this method to delete a route. + + Returns: + Callable[[~.DeleteRouteRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_route' not in self._stubs: + self._stubs['delete_route'] = self.grpc_channel.unary_unary( + '/google.cloud.datastream.v1alpha1.Datastream/DeleteRoute', + request_serializer=datastream.DeleteRouteRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['delete_route'] + + def close(self): + return self.grpc_channel.close() + + +__all__ = ( + 'DatastreamGrpcAsyncIOTransport', +) diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/types/__init__.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/types/__init__.py new file mode 100644 index 0000000..06aee29 --- /dev/null +++ b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/types/__init__.py @@ -0,0 +1,148 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from .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 .datastream_resources import ( + AvroFileFormat, + ConnectionProfile, + DestinationConfig, + Error, + ForwardSshTunnelConnectivity, + GcsDestinationConfig, + GcsProfile, + JsonFileFormat, + MysqlColumn, + MysqlDatabase, + MysqlProfile, + MysqlRdbms, + MysqlSourceConfig, + MysqlSslConfig, + MysqlTable, + NoConnectivitySettings, + OracleColumn, + OracleProfile, + OracleRdbms, + OracleSchema, + OracleSourceConfig, + OracleTable, + PrivateConnection, + PrivateConnectivity, + Route, + SourceConfig, + StaticServiceIpConnectivity, + Stream, + Validation, + ValidationMessage, + ValidationResult, + VpcPeeringConfig, + GcsFileFormat, + SchemaFileFormat, +) + +__all__ = ( + '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', + 'AvroFileFormat', + 'ConnectionProfile', + 'DestinationConfig', + 'Error', + 'ForwardSshTunnelConnectivity', + 'GcsDestinationConfig', + 'GcsProfile', + 'JsonFileFormat', + 'MysqlColumn', + 'MysqlDatabase', + 'MysqlProfile', + 'MysqlRdbms', + 'MysqlSourceConfig', + 'MysqlSslConfig', + 'MysqlTable', + 'NoConnectivitySettings', + 'OracleColumn', + 'OracleProfile', + 'OracleRdbms', + 'OracleSchema', + 'OracleSourceConfig', + 'OracleTable', + 'PrivateConnection', + 'PrivateConnectivity', + 'Route', + 'SourceConfig', + 'StaticServiceIpConnectivity', + 'Stream', + 'Validation', + 'ValidationMessage', + 'ValidationResult', + 'VpcPeeringConfig', + 'GcsFileFormat', + 'SchemaFileFormat', +) diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/types/datastream.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/types/datastream.py new file mode 100644 index 0000000..826f807 --- /dev/null +++ b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/types/datastream.py @@ -0,0 +1,1205 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from typing import MutableMapping, MutableSequence + +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 + + +__protobuf__ = proto.module( + package='google.cloud.datastream.v1alpha1', + manifest={ + 'DiscoverConnectionProfileRequest', + 'DiscoverConnectionProfileResponse', + 'FetchStaticIpsRequest', + 'FetchStaticIpsResponse', + 'FetchErrorsRequest', + 'FetchErrorsResponse', + 'ListConnectionProfilesRequest', + 'ListConnectionProfilesResponse', + 'GetConnectionProfileRequest', + 'CreateConnectionProfileRequest', + 'UpdateConnectionProfileRequest', + 'DeleteConnectionProfileRequest', + 'ListStreamsRequest', + 'ListStreamsResponse', + 'GetStreamRequest', + 'CreateStreamRequest', + 'UpdateStreamRequest', + 'DeleteStreamRequest', + 'OperationMetadata', + 'CreatePrivateConnectionRequest', + 'ListPrivateConnectionsRequest', + 'ListPrivateConnectionsResponse', + 'DeletePrivateConnectionRequest', + 'GetPrivateConnectionRequest', + 'CreateRouteRequest', + 'ListRoutesRequest', + 'ListRoutesResponse', + 'DeleteRouteRequest', + 'GetRouteRequest', + }, +) + + +class DiscoverConnectionProfileRequest(proto.Message): + r"""Request message for 'discover' ConnectionProfile request. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + parent (str): + Required. The parent resource of the ConnectionProfile type. + Must be in the format ``projects/*/locations/*``. + connection_profile (google.cloud.datastream_v1alpha1.types.ConnectionProfile): + An ad-hoc ConnectionProfile configuration. + + This field is a member of `oneof`_ ``target``. + connection_profile_name (str): + A reference to an existing ConnectionProfile. + + This field is a member of `oneof`_ ``target``. + recursive (bool): + Whether to retrieve the full hierarchy of + data objects (TRUE) or only the current level + (FALSE). + + This field is a member of `oneof`_ ``depth``. + recursion_depth (int): + The number of hierarchy levels below the + current level to be retrieved. + + This field is a member of `oneof`_ ``depth``. + oracle_rdbms (google.cloud.datastream_v1alpha1.types.OracleRdbms): + Oracle RDBMS to enrich with child data + objects and metadata. + + This field is a member of `oneof`_ ``data_object``. + mysql_rdbms (google.cloud.datastream_v1alpha1.types.MysqlRdbms): + MySQL RDBMS to enrich with child data objects + and metadata. + + This field is a member of `oneof`_ ``data_object``. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + connection_profile: datastream_resources.ConnectionProfile = proto.Field( + proto.MESSAGE, + number=200, + oneof='target', + message=datastream_resources.ConnectionProfile, + ) + connection_profile_name: str = proto.Field( + proto.STRING, + number=201, + oneof='target', + ) + recursive: bool = proto.Field( + proto.BOOL, + number=3, + oneof='depth', + ) + recursion_depth: int = proto.Field( + proto.INT32, + number=4, + oneof='depth', + ) + oracle_rdbms: datastream_resources.OracleRdbms = proto.Field( + proto.MESSAGE, + number=100, + oneof='data_object', + message=datastream_resources.OracleRdbms, + ) + mysql_rdbms: datastream_resources.MysqlRdbms = proto.Field( + proto.MESSAGE, + number=101, + oneof='data_object', + message=datastream_resources.MysqlRdbms, + ) + + +class DiscoverConnectionProfileResponse(proto.Message): + r""" + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + oracle_rdbms (google.cloud.datastream_v1alpha1.types.OracleRdbms): + Enriched Oracle RDBMS object. + + This field is a member of `oneof`_ ``data_object``. + mysql_rdbms (google.cloud.datastream_v1alpha1.types.MysqlRdbms): + Enriched MySQL RDBMS object. + + This field is a member of `oneof`_ ``data_object``. + """ + + oracle_rdbms: datastream_resources.OracleRdbms = proto.Field( + proto.MESSAGE, + number=100, + oneof='data_object', + message=datastream_resources.OracleRdbms, + ) + mysql_rdbms: datastream_resources.MysqlRdbms = proto.Field( + proto.MESSAGE, + number=101, + oneof='data_object', + message=datastream_resources.MysqlRdbms, + ) + + +class FetchStaticIpsRequest(proto.Message): + r"""Request message for 'FetchStaticIps' request. + + Attributes: + name (str): + Required. The name resource of the Response type. Must be in + the format ``projects/*/locations/*``. + page_size (int): + Maximum number of Ips to return, will likely + not be specified. + page_token (str): + A page token, received from a previous ``ListStaticIps`` + call. will likely not be specified. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + page_size: int = proto.Field( + proto.INT32, + number=2, + ) + page_token: str = proto.Field( + proto.STRING, + number=3, + ) + + +class FetchStaticIpsResponse(proto.Message): + r"""Response message for a 'FetchStaticIps' response. + + Attributes: + static_ips (MutableSequence[str]): + list of static ips by account + next_page_token (str): + A token that can be sent as ``page_token`` to retrieve the + next page. If this field is omitted, there are no subsequent + pages. + """ + + @property + def raw_page(self): + return self + + static_ips: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=1, + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + + +class FetchErrorsRequest(proto.Message): + r"""Request message for 'FetchErrors' request. + + Attributes: + stream (str): + Name of the Stream resource for which to + fetch any errors. + """ + + stream: str = proto.Field( + proto.STRING, + number=1, + ) + + +class FetchErrorsResponse(proto.Message): + r"""Response message for a 'FetchErrors' response. + + Attributes: + errors (MutableSequence[google.cloud.datastream_v1alpha1.types.Error]): + The list of errors on the Stream. + """ + + errors: MutableSequence[datastream_resources.Error] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=datastream_resources.Error, + ) + + +class ListConnectionProfilesRequest(proto.Message): + r""" + + Attributes: + parent (str): + Required. The parent that owns the collection + of connection profiles. + page_size (int): + Maximum number of connection profiles to + return. If unspecified, at most 50 connection + profiles will be returned. The maximum value is + 1000; values above 1000 will be coerced to 1000. + page_token (str): + Page token received from a previous + ``ListConnectionProfiles`` call. Provide this to retrieve + the subsequent page. + + When paginating, all other parameters provided to + ``ListConnectionProfiles`` must match the call that provided + the page token. + filter (str): + Filter request. + order_by (str): + Order by fields for the result. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + page_size: int = proto.Field( + proto.INT32, + number=2, + ) + page_token: str = proto.Field( + proto.STRING, + number=3, + ) + filter: str = proto.Field( + proto.STRING, + number=4, + ) + order_by: str = proto.Field( + proto.STRING, + number=5, + ) + + +class ListConnectionProfilesResponse(proto.Message): + r""" + + Attributes: + connection_profiles (MutableSequence[google.cloud.datastream_v1alpha1.types.ConnectionProfile]): + List of connection profiles. + next_page_token (str): + A token, which can be sent as ``page_token`` to retrieve the + next page. If this field is omitted, there are no subsequent + pages. + unreachable (MutableSequence[str]): + Locations that could not be reached. + """ + + @property + def raw_page(self): + return self + + connection_profiles: MutableSequence[datastream_resources.ConnectionProfile] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=datastream_resources.ConnectionProfile, + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + unreachable: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + + +class GetConnectionProfileRequest(proto.Message): + r""" + + Attributes: + name (str): + Required. The name of the connection profile + resource to get. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class CreateConnectionProfileRequest(proto.Message): + r""" + + Attributes: + parent (str): + Required. The parent that owns the collection + of ConnectionProfiles. + connection_profile_id (str): + Required. The connection profile identifier. + connection_profile (google.cloud.datastream_v1alpha1.types.ConnectionProfile): + Required. The connection profile resource to + create. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes since the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + connection_profile_id: str = proto.Field( + proto.STRING, + number=2, + ) + connection_profile: datastream_resources.ConnectionProfile = proto.Field( + proto.MESSAGE, + number=3, + message=datastream_resources.ConnectionProfile, + ) + request_id: str = proto.Field( + proto.STRING, + number=4, + ) + + +class UpdateConnectionProfileRequest(proto.Message): + r""" + + Attributes: + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Optional. Field mask is used to specify the fields to be + overwritten in the ConnectionProfile resource by the update. + The fields specified in the update_mask are relative to the + resource, not the full request. A field will be overwritten + if it is in the mask. If the user does not provide a mask + then all fields will be overwritten. + connection_profile (google.cloud.datastream_v1alpha1.types.ConnectionProfile): + Required. The ConnectionProfile to update. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes since the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + update_mask: field_mask_pb2.FieldMask = proto.Field( + proto.MESSAGE, + number=1, + message=field_mask_pb2.FieldMask, + ) + connection_profile: datastream_resources.ConnectionProfile = proto.Field( + proto.MESSAGE, + number=2, + message=datastream_resources.ConnectionProfile, + ) + request_id: str = proto.Field( + proto.STRING, + number=3, + ) + + +class DeleteConnectionProfileRequest(proto.Message): + r""" + + Attributes: + name (str): + Required. The name of the connection profile + resource to delete. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes after the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + request_id: str = proto.Field( + proto.STRING, + number=2, + ) + + +class ListStreamsRequest(proto.Message): + r""" + + Attributes: + parent (str): + Required. The parent that owns the collection + of streams. + page_size (int): + Maximum number of streams to return. + If unspecified, at most 50 streams will be + returned. The maximum value is 1000; values + above 1000 will be coerced to 1000. + page_token (str): + Page token received from a previous ``ListStreams`` call. + Provide this to retrieve the subsequent page. + + When paginating, all other parameters provided to + ``ListStreams`` must match the call that provided the page + token. + filter (str): + Filter request. + order_by (str): + Order by fields for the result. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + page_size: int = proto.Field( + proto.INT32, + number=2, + ) + page_token: str = proto.Field( + proto.STRING, + number=3, + ) + filter: str = proto.Field( + proto.STRING, + number=4, + ) + order_by: str = proto.Field( + proto.STRING, + number=5, + ) + + +class ListStreamsResponse(proto.Message): + r""" + + Attributes: + streams (MutableSequence[google.cloud.datastream_v1alpha1.types.Stream]): + List of streams + next_page_token (str): + A token, which can be sent as ``page_token`` to retrieve the + next page. If this field is omitted, there are no subsequent + pages. + unreachable (MutableSequence[str]): + Locations that could not be reached. + """ + + @property + def raw_page(self): + return self + + streams: MutableSequence[datastream_resources.Stream] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=datastream_resources.Stream, + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + unreachable: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + + +class GetStreamRequest(proto.Message): + r""" + + Attributes: + name (str): + Required. The name of the stream resource to + get. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class CreateStreamRequest(proto.Message): + r""" + + Attributes: + parent (str): + Required. The parent that owns the collection + of streams. + stream_id (str): + Required. The stream identifier. + stream (google.cloud.datastream_v1alpha1.types.Stream): + Required. The stream resource to create. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes since the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + validate_only (bool): + Optional. Only validate the stream, but do + not create any resources. The default is false. + force (bool): + Optional. Create the stream without + validating it. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + stream_id: str = proto.Field( + proto.STRING, + number=2, + ) + stream: datastream_resources.Stream = proto.Field( + proto.MESSAGE, + number=3, + message=datastream_resources.Stream, + ) + request_id: str = proto.Field( + proto.STRING, + number=4, + ) + validate_only: bool = proto.Field( + proto.BOOL, + number=5, + ) + force: bool = proto.Field( + proto.BOOL, + number=6, + ) + + +class UpdateStreamRequest(proto.Message): + r""" + + Attributes: + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Optional. Field mask is used to specify the fields to be + overwritten in the stream resource by the update. The fields + specified in the update_mask are relative to the resource, + not the full request. A field will be overwritten if it is + in the mask. If the user does not provide a mask then all + fields will be overwritten. + stream (google.cloud.datastream_v1alpha1.types.Stream): + Required. The stream resource to update. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes since the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + validate_only (bool): + Optional. Only validate the stream with the + changes, without actually updating it. The + default is false. + force (bool): + Optional. Execute the update without + validating it. + """ + + update_mask: field_mask_pb2.FieldMask = proto.Field( + proto.MESSAGE, + number=1, + message=field_mask_pb2.FieldMask, + ) + stream: datastream_resources.Stream = proto.Field( + proto.MESSAGE, + number=2, + message=datastream_resources.Stream, + ) + request_id: str = proto.Field( + proto.STRING, + number=3, + ) + validate_only: bool = proto.Field( + proto.BOOL, + number=4, + ) + force: bool = proto.Field( + proto.BOOL, + number=5, + ) + + +class DeleteStreamRequest(proto.Message): + r""" + + Attributes: + name (str): + Required. The name of the stream resource to + delete. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes after the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + request_id: str = proto.Field( + proto.STRING, + number=2, + ) + + +class OperationMetadata(proto.Message): + r"""Represents the metadata of the long-running operation. + + Attributes: + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time the operation was + created. + end_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time the operation finished + running. + target (str): + Output only. Server-defined resource path for + the target of the operation. + verb (str): + Output only. Name of the verb executed by the + operation. + status_message (str): + Output only. Human-readable status of the + operation, if any. + requested_cancellation (bool): + Output only. Identifies whether the user has requested + cancellation of the operation. Operations that have + successfully been cancelled have [Operation.error][] value + with a [google.rpc.Status.code][google.rpc.Status.code] of + 1, corresponding to ``Code.CANCELLED``. + api_version (str): + Output only. API version used to start the + operation. + validation_result (google.cloud.datastream_v1alpha1.types.ValidationResult): + Output only. Results of executed validations + if there are any. + """ + + create_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + end_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + target: str = proto.Field( + proto.STRING, + number=3, + ) + verb: str = proto.Field( + proto.STRING, + number=4, + ) + status_message: str = proto.Field( + proto.STRING, + number=5, + ) + requested_cancellation: bool = proto.Field( + proto.BOOL, + number=6, + ) + api_version: str = proto.Field( + proto.STRING, + number=7, + ) + validation_result: datastream_resources.ValidationResult = proto.Field( + proto.MESSAGE, + number=8, + message=datastream_resources.ValidationResult, + ) + + +class CreatePrivateConnectionRequest(proto.Message): + r""" + + Attributes: + parent (str): + Required. The parent that owns the collection + of PrivateConnections. + private_connection_id (str): + Required. The private connectivity + identifier. + private_connection (google.cloud.datastream_v1alpha1.types.PrivateConnection): + Required. The Private Connectivity resource + to create. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes since the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + private_connection_id: str = proto.Field( + proto.STRING, + number=2, + ) + private_connection: datastream_resources.PrivateConnection = proto.Field( + proto.MESSAGE, + number=3, + message=datastream_resources.PrivateConnection, + ) + request_id: str = proto.Field( + proto.STRING, + number=4, + ) + + +class ListPrivateConnectionsRequest(proto.Message): + r""" + + Attributes: + parent (str): + Required. The parent that owns the collection + of private connectivity configurations. + page_size (int): + Maximum number of private connectivity + configurations to return. If unspecified, at + most 50 private connectivity configurations that + will be returned. The maximum value is 1000; + values above 1000 will be coerced to 1000. + page_token (str): + Page token received from a previous + ``ListPrivateConnections`` call. Provide this to retrieve + the subsequent page. + + When paginating, all other parameters provided to + ``ListPrivateConnections`` must match the call that provided + the page token. + filter (str): + Filter request. + order_by (str): + Order by fields for the result. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + page_size: int = proto.Field( + proto.INT32, + number=2, + ) + page_token: str = proto.Field( + proto.STRING, + number=3, + ) + filter: str = proto.Field( + proto.STRING, + number=4, + ) + order_by: str = proto.Field( + proto.STRING, + number=5, + ) + + +class ListPrivateConnectionsResponse(proto.Message): + r""" + + Attributes: + private_connections (MutableSequence[google.cloud.datastream_v1alpha1.types.PrivateConnection]): + List of private connectivity configurations. + next_page_token (str): + A token, which can be sent as ``page_token`` to retrieve the + next page. If this field is omitted, there are no subsequent + pages. + unreachable (MutableSequence[str]): + Locations that could not be reached. + """ + + @property + def raw_page(self): + return self + + private_connections: MutableSequence[datastream_resources.PrivateConnection] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=datastream_resources.PrivateConnection, + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + unreachable: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + + +class DeletePrivateConnectionRequest(proto.Message): + r""" + + Attributes: + name (str): + Required. The name of the private + connectivity configuration to delete. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes after the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + force (bool): + Optional. If set to true, any child routes + that belong to this PrivateConnection will also + be deleted. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + request_id: str = proto.Field( + proto.STRING, + number=2, + ) + force: bool = proto.Field( + proto.BOOL, + number=3, + ) + + +class GetPrivateConnectionRequest(proto.Message): + r""" + + Attributes: + name (str): + Required. The name of the private + connectivity configuration to get. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class CreateRouteRequest(proto.Message): + r"""route creation request + + Attributes: + parent (str): + Required. The parent that owns the collection + of Routes. + route_id (str): + Required. The Route identifier. + route (google.cloud.datastream_v1alpha1.types.Route): + Required. The Route resource to create. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes since the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + route_id: str = proto.Field( + proto.STRING, + number=2, + ) + route: datastream_resources.Route = proto.Field( + proto.MESSAGE, + number=3, + message=datastream_resources.Route, + ) + request_id: str = proto.Field( + proto.STRING, + number=4, + ) + + +class ListRoutesRequest(proto.Message): + r"""route list request + + Attributes: + parent (str): + Required. The parent that owns the collection + of Routess. + page_size (int): + Maximum number of Routes to return. The + service may return fewer than this value. If + unspecified, at most 50 Routes will be returned. + The maximum value is 1000; values above 1000 + will be coerced to 1000. + page_token (str): + Page token received from a previous ``ListRoutes`` call. + Provide this to retrieve the subsequent page. + + When paginating, all other parameters provided to + ``ListRoutes`` must match the call that provided the page + token. + filter (str): + Filter request. + order_by (str): + Order by fields for the result. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + page_size: int = proto.Field( + proto.INT32, + number=2, + ) + page_token: str = proto.Field( + proto.STRING, + number=3, + ) + filter: str = proto.Field( + proto.STRING, + number=4, + ) + order_by: str = proto.Field( + proto.STRING, + number=5, + ) + + +class ListRoutesResponse(proto.Message): + r"""route list response + + Attributes: + routes (MutableSequence[google.cloud.datastream_v1alpha1.types.Route]): + List of Routes. + next_page_token (str): + A token, which can be sent as ``page_token`` to retrieve the + next page. If this field is omitted, there are no subsequent + pages. + unreachable (MutableSequence[str]): + Locations that could not be reached. + """ + + @property + def raw_page(self): + return self + + routes: MutableSequence[datastream_resources.Route] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=datastream_resources.Route, + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + unreachable: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + + +class DeleteRouteRequest(proto.Message): + r"""route deletion request + + Attributes: + name (str): + Required. The name of the Route resource to + delete. + request_id (str): + Optional. A request ID to identify requests. + Specify a unique request ID so that if you must + retry your request, the server will know to + ignore the request if it has already been + completed. The server will guarantee that for at + least 60 minutes after the first request. + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + request_id: str = proto.Field( + proto.STRING, + number=2, + ) + + +class GetRouteRequest(proto.Message): + r"""route get request + + Attributes: + name (str): + Required. The name of the Route resource to + get. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/types/datastream_resources.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/types/datastream_resources.py new file mode 100644 index 0000000..0c6e29b --- /dev/null +++ b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/types/datastream_resources.py @@ -0,0 +1,1413 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from typing import MutableMapping, MutableSequence + +import proto # type: ignore + +from google.protobuf import duration_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore + + +__protobuf__ = proto.module( + package='google.cloud.datastream.v1alpha1', + manifest={ + 'GcsFileFormat', + 'SchemaFileFormat', + 'OracleProfile', + 'MysqlProfile', + 'GcsProfile', + 'NoConnectivitySettings', + 'StaticServiceIpConnectivity', + 'ForwardSshTunnelConnectivity', + 'VpcPeeringConfig', + 'PrivateConnection', + 'PrivateConnectivity', + 'Route', + 'MysqlSslConfig', + 'ConnectionProfile', + 'OracleColumn', + 'OracleTable', + 'OracleSchema', + 'OracleRdbms', + 'OracleSourceConfig', + 'MysqlColumn', + 'MysqlTable', + 'MysqlDatabase', + 'MysqlRdbms', + 'MysqlSourceConfig', + 'SourceConfig', + 'AvroFileFormat', + 'JsonFileFormat', + 'GcsDestinationConfig', + 'DestinationConfig', + 'Stream', + 'Error', + 'ValidationResult', + 'Validation', + 'ValidationMessage', + }, +) + + +class GcsFileFormat(proto.Enum): + r"""File format in Cloud Storage. + + Values: + GCS_FILE_FORMAT_UNSPECIFIED (0): + Unspecified Cloud Storage file format. + AVRO (1): + Avro file format + """ + _pb_options = {'deprecated': True} + GCS_FILE_FORMAT_UNSPECIFIED = 0 + AVRO = 1 + + +class SchemaFileFormat(proto.Enum): + r"""Schema file format. + + Values: + SCHEMA_FILE_FORMAT_UNSPECIFIED (0): + Unspecified schema file format. + NO_SCHEMA_FILE (1): + Do not attach schema file. + AVRO_SCHEMA_FILE (2): + Avro schema format. + """ + SCHEMA_FILE_FORMAT_UNSPECIFIED = 0 + NO_SCHEMA_FILE = 1 + AVRO_SCHEMA_FILE = 2 + + +class OracleProfile(proto.Message): + r"""Oracle database profile. + + Attributes: + hostname (str): + Required. Hostname for the Oracle connection. + port (int): + Port for the Oracle connection, default value + is 1521. + username (str): + Required. Username for the Oracle connection. + password (str): + Required. Password for the Oracle connection. + database_service (str): + Required. Database for the Oracle connection. + connection_attributes (MutableMapping[str, str]): + Connection string attributes + """ + + hostname: str = proto.Field( + proto.STRING, + number=1, + ) + port: int = proto.Field( + proto.INT32, + number=2, + ) + username: str = proto.Field( + proto.STRING, + number=3, + ) + password: str = proto.Field( + proto.STRING, + number=4, + ) + database_service: str = proto.Field( + proto.STRING, + number=5, + ) + connection_attributes: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=6, + ) + + +class MysqlProfile(proto.Message): + r"""MySQL database profile. + + Attributes: + hostname (str): + Required. Hostname for the MySQL connection. + port (int): + Port for the MySQL connection, default value + is 3306. + username (str): + Required. Username for the MySQL connection. + password (str): + Required. Input only. Password for the MySQL + connection. + ssl_config (google.cloud.datastream_v1alpha1.types.MysqlSslConfig): + SSL configuration for the MySQL connection. + """ + + hostname: str = proto.Field( + proto.STRING, + number=1, + ) + port: int = proto.Field( + proto.INT32, + number=2, + ) + username: str = proto.Field( + proto.STRING, + number=3, + ) + password: str = proto.Field( + proto.STRING, + number=4, + ) + ssl_config: 'MysqlSslConfig' = proto.Field( + proto.MESSAGE, + number=5, + message='MysqlSslConfig', + ) + + +class GcsProfile(proto.Message): + r"""Cloud Storage bucket profile. + + Attributes: + bucket_name (str): + Required. The full project and resource path + for Cloud Storage bucket including the name. + root_path (str): + The root path inside the Cloud Storage + bucket. + """ + + bucket_name: str = proto.Field( + proto.STRING, + number=1, + ) + root_path: str = proto.Field( + proto.STRING, + number=2, + ) + + +class NoConnectivitySettings(proto.Message): + r"""No connectivity settings. + """ + + +class StaticServiceIpConnectivity(proto.Message): + r"""Static IP address connectivity. + """ + + +class ForwardSshTunnelConnectivity(proto.Message): + r"""Forward SSH Tunnel connectivity. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + hostname (str): + Required. Hostname for the SSH tunnel. + username (str): + Required. Username for the SSH tunnel. + port (int): + Port for the SSH tunnel, default value is 22. + password (str): + Input only. SSH password. + + This field is a member of `oneof`_ ``authentication_method``. + private_key (str): + Input only. SSH private key. + + This field is a member of `oneof`_ ``authentication_method``. + """ + + hostname: str = proto.Field( + proto.STRING, + number=1, + ) + username: str = proto.Field( + proto.STRING, + number=2, + ) + port: int = proto.Field( + proto.INT32, + number=3, + ) + password: str = proto.Field( + proto.STRING, + number=100, + oneof='authentication_method', + ) + private_key: str = proto.Field( + proto.STRING, + number=101, + oneof='authentication_method', + ) + + +class VpcPeeringConfig(proto.Message): + r"""The VPC Peering configuration is used to create VPC peering + between Datastream and the consumer's VPC. + + Attributes: + vpc_name (str): + Required. fully qualified name of the VPC + Datastream will peer to. + subnet (str): + Required. A free subnet for peering. (CIDR of + /29) + """ + + vpc_name: str = proto.Field( + proto.STRING, + number=1, + ) + subnet: str = proto.Field( + proto.STRING, + number=2, + ) + + +class PrivateConnection(proto.Message): + r"""The PrivateConnection resource is used to establish private + connectivity between Datastream and a customer's network. + + Attributes: + name (str): + Output only. The resource's name. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The create time of the resource. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The update time of the resource. + labels (MutableMapping[str, str]): + Labels. + display_name (str): + Required. Display name. + state (google.cloud.datastream_v1alpha1.types.PrivateConnection.State): + Output only. The state of the Private + Connection. + error (google.cloud.datastream_v1alpha1.types.Error): + Output only. In case of error, the details of + the error in a user-friendly format. + vpc_peering_config (google.cloud.datastream_v1alpha1.types.VpcPeeringConfig): + VPC Peering Config + """ + class State(proto.Enum): + r"""Private Connection state. + + Values: + STATE_UNSPECIFIED (0): + No description available. + CREATING (1): + The private connection is in creation state - + creating resources. + CREATED (2): + The private connection has been created with + all of it's resources. + FAILED (3): + The private connection creation has failed. + """ + STATE_UNSPECIFIED = 0 + CREATING = 1 + CREATED = 2 + FAILED = 3 + + name: str = proto.Field( + proto.STRING, + number=1, + ) + create_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + update_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + display_name: str = proto.Field( + proto.STRING, + number=5, + ) + state: State = proto.Field( + proto.ENUM, + number=6, + enum=State, + ) + error: 'Error' = proto.Field( + proto.MESSAGE, + number=7, + message='Error', + ) + vpc_peering_config: 'VpcPeeringConfig' = proto.Field( + proto.MESSAGE, + number=100, + message='VpcPeeringConfig', + ) + + +class PrivateConnectivity(proto.Message): + r"""Private Connectivity + + Attributes: + private_connection_name (str): + + """ + + private_connection_name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class Route(proto.Message): + r"""The Route resource is the child of the PrivateConnection + resource. It used to define a route for a PrivateConnection + setup. + + Attributes: + name (str): + Output only. The resource's name. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The create time of the resource. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The update time of the resource. + labels (MutableMapping[str, str]): + Labels. + display_name (str): + Required. Display name. + destination_address (str): + Required. Destination address for connection + destination_port (int): + Destination port for connection + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + create_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + update_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + display_name: str = proto.Field( + proto.STRING, + number=5, + ) + destination_address: str = proto.Field( + proto.STRING, + number=6, + ) + destination_port: int = proto.Field( + proto.INT32, + number=7, + ) + + +class MysqlSslConfig(proto.Message): + r"""MySQL SSL configuration information. + + Attributes: + client_key (str): + Input only. PEM-encoded private key associated with the + Client Certificate. If this field is used then the + 'client_certificate' and the 'ca_certificate' fields are + mandatory. + client_key_set (bool): + Output only. Indicates whether the client_key field is set. + client_certificate (str): + Input only. PEM-encoded certificate that will be used by the + replica to authenticate against the source database server. + If this field is used then the 'client_key' and the + 'ca_certificate' fields are mandatory. + client_certificate_set (bool): + Output only. Indicates whether the client_certificate field + is set. + ca_certificate (str): + Input only. PEM-encoded certificate of the CA + that signed the source database server's + certificate. + ca_certificate_set (bool): + Output only. Indicates whether the ca_certificate field is + set. + """ + + client_key: str = proto.Field( + proto.STRING, + number=11, + ) + client_key_set: bool = proto.Field( + proto.BOOL, + number=12, + ) + client_certificate: str = proto.Field( + proto.STRING, + number=13, + ) + client_certificate_set: bool = proto.Field( + proto.BOOL, + number=14, + ) + ca_certificate: str = proto.Field( + proto.STRING, + number=15, + ) + ca_certificate_set: bool = proto.Field( + proto.BOOL, + number=16, + ) + + +class ConnectionProfile(proto.Message): + r""" + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + name (str): + Output only. The resource's name. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The create time of the resource. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The update time of the resource. + labels (MutableMapping[str, str]): + Labels. + display_name (str): + Required. Display name. + oracle_profile (google.cloud.datastream_v1alpha1.types.OracleProfile): + Oracle ConnectionProfile configuration. + + This field is a member of `oneof`_ ``profile``. + gcs_profile (google.cloud.datastream_v1alpha1.types.GcsProfile): + Cloud Storage ConnectionProfile + configuration. + + This field is a member of `oneof`_ ``profile``. + mysql_profile (google.cloud.datastream_v1alpha1.types.MysqlProfile): + MySQL ConnectionProfile configuration. + + This field is a member of `oneof`_ ``profile``. + no_connectivity (google.cloud.datastream_v1alpha1.types.NoConnectivitySettings): + No connectivity option chosen. + + This field is a member of `oneof`_ ``connectivity``. + static_service_ip_connectivity (google.cloud.datastream_v1alpha1.types.StaticServiceIpConnectivity): + Static Service IP connectivity. + + This field is a member of `oneof`_ ``connectivity``. + forward_ssh_connectivity (google.cloud.datastream_v1alpha1.types.ForwardSshTunnelConnectivity): + Forward SSH tunnel connectivity. + + This field is a member of `oneof`_ ``connectivity``. + private_connectivity (google.cloud.datastream_v1alpha1.types.PrivateConnectivity): + Private connectivity. + + This field is a member of `oneof`_ ``connectivity``. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + create_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + update_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + display_name: str = proto.Field( + proto.STRING, + number=5, + ) + oracle_profile: 'OracleProfile' = proto.Field( + proto.MESSAGE, + number=100, + oneof='profile', + message='OracleProfile', + ) + gcs_profile: 'GcsProfile' = proto.Field( + proto.MESSAGE, + number=101, + oneof='profile', + message='GcsProfile', + ) + mysql_profile: 'MysqlProfile' = proto.Field( + proto.MESSAGE, + number=102, + oneof='profile', + message='MysqlProfile', + ) + no_connectivity: 'NoConnectivitySettings' = proto.Field( + proto.MESSAGE, + number=200, + oneof='connectivity', + message='NoConnectivitySettings', + ) + static_service_ip_connectivity: 'StaticServiceIpConnectivity' = proto.Field( + proto.MESSAGE, + number=201, + oneof='connectivity', + message='StaticServiceIpConnectivity', + ) + forward_ssh_connectivity: 'ForwardSshTunnelConnectivity' = proto.Field( + proto.MESSAGE, + number=202, + oneof='connectivity', + message='ForwardSshTunnelConnectivity', + ) + private_connectivity: 'PrivateConnectivity' = proto.Field( + proto.MESSAGE, + number=203, + oneof='connectivity', + message='PrivateConnectivity', + ) + + +class OracleColumn(proto.Message): + r"""Oracle Column. + + Attributes: + column_name (str): + Column name. + data_type (str): + The Oracle data type. + length (int): + Column length. + precision (int): + Column precision. + scale (int): + Column scale. + encoding (str): + Column encoding. + primary_key (bool): + Whether or not the column represents a + primary key. + nullable (bool): + Whether or not the column can accept a null + value. + ordinal_position (int): + The ordinal position of the column in the + table. + """ + + column_name: str = proto.Field( + proto.STRING, + number=1, + ) + data_type: str = proto.Field( + proto.STRING, + number=2, + ) + length: int = proto.Field( + proto.INT32, + number=3, + ) + precision: int = proto.Field( + proto.INT32, + number=4, + ) + scale: int = proto.Field( + proto.INT32, + number=5, + ) + encoding: str = proto.Field( + proto.STRING, + number=6, + ) + primary_key: bool = proto.Field( + proto.BOOL, + number=7, + ) + nullable: bool = proto.Field( + proto.BOOL, + number=8, + ) + ordinal_position: int = proto.Field( + proto.INT32, + number=9, + ) + + +class OracleTable(proto.Message): + r"""Oracle table. + + Attributes: + table_name (str): + Table name. + oracle_columns (MutableSequence[google.cloud.datastream_v1alpha1.types.OracleColumn]): + Oracle columns in the schema. + When unspecified as part of inclue/exclude + lists, includes/excludes everything. + """ + + table_name: str = proto.Field( + proto.STRING, + number=1, + ) + oracle_columns: MutableSequence['OracleColumn'] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message='OracleColumn', + ) + + +class OracleSchema(proto.Message): + r"""Oracle schema. + + Attributes: + schema_name (str): + Schema name. + oracle_tables (MutableSequence[google.cloud.datastream_v1alpha1.types.OracleTable]): + Tables in the schema. + """ + + schema_name: str = proto.Field( + proto.STRING, + number=1, + ) + oracle_tables: MutableSequence['OracleTable'] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message='OracleTable', + ) + + +class OracleRdbms(proto.Message): + r"""Oracle database structure. + + Attributes: + oracle_schemas (MutableSequence[google.cloud.datastream_v1alpha1.types.OracleSchema]): + Oracle schemas/databases in the database + server. + """ + + oracle_schemas: MutableSequence['OracleSchema'] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='OracleSchema', + ) + + +class OracleSourceConfig(proto.Message): + r"""Oracle data source configuration + + Attributes: + allowlist (google.cloud.datastream_v1alpha1.types.OracleRdbms): + Oracle objects to include in the stream. + rejectlist (google.cloud.datastream_v1alpha1.types.OracleRdbms): + Oracle objects to exclude from the stream. + """ + + allowlist: 'OracleRdbms' = proto.Field( + proto.MESSAGE, + number=1, + message='OracleRdbms', + ) + rejectlist: 'OracleRdbms' = proto.Field( + proto.MESSAGE, + number=2, + message='OracleRdbms', + ) + + +class MysqlColumn(proto.Message): + r"""MySQL Column. + + Attributes: + column_name (str): + Column name. + data_type (str): + The MySQL data type. Full data types list can + be found here: + https://dev.mysql.com/doc/refman/8.0/en/data-types.html + length (int): + Column length. + collation (str): + Column collation. + primary_key (bool): + Whether or not the column represents a + primary key. + nullable (bool): + Whether or not the column can accept a null + value. + ordinal_position (int): + The ordinal position of the column in the + table. + """ + + column_name: str = proto.Field( + proto.STRING, + number=1, + ) + data_type: str = proto.Field( + proto.STRING, + number=2, + ) + length: int = proto.Field( + proto.INT32, + number=3, + ) + collation: str = proto.Field( + proto.STRING, + number=4, + ) + primary_key: bool = proto.Field( + proto.BOOL, + number=5, + ) + nullable: bool = proto.Field( + proto.BOOL, + number=6, + ) + ordinal_position: int = proto.Field( + proto.INT32, + number=7, + ) + + +class MysqlTable(proto.Message): + r"""MySQL table. + + Attributes: + table_name (str): + Table name. + mysql_columns (MutableSequence[google.cloud.datastream_v1alpha1.types.MysqlColumn]): + MySQL columns in the database. + When unspecified as part of include/exclude + lists, includes/excludes everything. + """ + + table_name: str = proto.Field( + proto.STRING, + number=1, + ) + mysql_columns: MutableSequence['MysqlColumn'] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message='MysqlColumn', + ) + + +class MysqlDatabase(proto.Message): + r"""MySQL database. + + Attributes: + database_name (str): + Database name. + mysql_tables (MutableSequence[google.cloud.datastream_v1alpha1.types.MysqlTable]): + Tables in the database. + """ + + database_name: str = proto.Field( + proto.STRING, + number=1, + ) + mysql_tables: MutableSequence['MysqlTable'] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message='MysqlTable', + ) + + +class MysqlRdbms(proto.Message): + r"""MySQL database structure + + Attributes: + mysql_databases (MutableSequence[google.cloud.datastream_v1alpha1.types.MysqlDatabase]): + Mysql databases on the server + """ + + mysql_databases: MutableSequence['MysqlDatabase'] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='MysqlDatabase', + ) + + +class MysqlSourceConfig(proto.Message): + r"""MySQL source configuration + + Attributes: + allowlist (google.cloud.datastream_v1alpha1.types.MysqlRdbms): + MySQL objects to retrieve from the source. + rejectlist (google.cloud.datastream_v1alpha1.types.MysqlRdbms): + MySQL objects to exclude from the stream. + """ + + allowlist: 'MysqlRdbms' = proto.Field( + proto.MESSAGE, + number=1, + message='MysqlRdbms', + ) + rejectlist: 'MysqlRdbms' = proto.Field( + proto.MESSAGE, + number=2, + message='MysqlRdbms', + ) + + +class SourceConfig(proto.Message): + r"""The configuration of the stream source. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + source_connection_profile_name (str): + Required. Source connection profile + identifier. + oracle_source_config (google.cloud.datastream_v1alpha1.types.OracleSourceConfig): + Oracle data source configuration + + This field is a member of `oneof`_ ``source_stream_config``. + mysql_source_config (google.cloud.datastream_v1alpha1.types.MysqlSourceConfig): + MySQL data source configuration + + This field is a member of `oneof`_ ``source_stream_config``. + """ + + source_connection_profile_name: str = proto.Field( + proto.STRING, + number=1, + ) + oracle_source_config: 'OracleSourceConfig' = proto.Field( + proto.MESSAGE, + number=100, + oneof='source_stream_config', + message='OracleSourceConfig', + ) + mysql_source_config: 'MysqlSourceConfig' = proto.Field( + proto.MESSAGE, + number=101, + oneof='source_stream_config', + message='MysqlSourceConfig', + ) + + +class AvroFileFormat(proto.Message): + r"""AVRO file format configuration. + """ + + +class JsonFileFormat(proto.Message): + r"""JSON file format configuration. + + Attributes: + schema_file_format (google.cloud.datastream_v1alpha1.types.SchemaFileFormat): + The schema file format along JSON data files. + compression (google.cloud.datastream_v1alpha1.types.JsonFileFormat.JsonCompression): + Compression of the loaded JSON file. + """ + class JsonCompression(proto.Enum): + r"""Json file compression. + + Values: + JSON_COMPRESSION_UNSPECIFIED (0): + Unspecified json file compression. + NO_COMPRESSION (1): + Do not compress JSON file. + GZIP (2): + Gzip compression. + """ + JSON_COMPRESSION_UNSPECIFIED = 0 + NO_COMPRESSION = 1 + GZIP = 2 + + schema_file_format: 'SchemaFileFormat' = proto.Field( + proto.ENUM, + number=1, + enum='SchemaFileFormat', + ) + compression: JsonCompression = proto.Field( + proto.ENUM, + number=2, + enum=JsonCompression, + ) + + +class GcsDestinationConfig(proto.Message): + r"""Google Cloud Storage destination configuration + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + path (str): + Path inside the Cloud Storage bucket to write + data to. + gcs_file_format (google.cloud.datastream_v1alpha1.types.GcsFileFormat): + File format that data should be written in. Deprecated field + - use file_format instead. + file_rotation_mb (int): + The maximum file size to be saved in the + bucket. + file_rotation_interval (google.protobuf.duration_pb2.Duration): + The maximum duration for which new events are + added before a file is closed and a new file is + created. + avro_file_format (google.cloud.datastream_v1alpha1.types.AvroFileFormat): + AVRO file format configuration. + + This field is a member of `oneof`_ ``file_format``. + json_file_format (google.cloud.datastream_v1alpha1.types.JsonFileFormat): + JSON file format configuration. + + This field is a member of `oneof`_ ``file_format``. + """ + + path: str = proto.Field( + proto.STRING, + number=1, + ) + gcs_file_format: 'GcsFileFormat' = proto.Field( + proto.ENUM, + number=2, + enum='GcsFileFormat', + ) + file_rotation_mb: int = proto.Field( + proto.INT32, + number=3, + ) + file_rotation_interval: duration_pb2.Duration = proto.Field( + proto.MESSAGE, + number=4, + message=duration_pb2.Duration, + ) + avro_file_format: 'AvroFileFormat' = proto.Field( + proto.MESSAGE, + number=100, + oneof='file_format', + message='AvroFileFormat', + ) + json_file_format: 'JsonFileFormat' = proto.Field( + proto.MESSAGE, + number=101, + oneof='file_format', + message='JsonFileFormat', + ) + + +class DestinationConfig(proto.Message): + r"""The configuration of the stream destination. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + destination_connection_profile_name (str): + Required. Destination connection profile + identifier. + gcs_destination_config (google.cloud.datastream_v1alpha1.types.GcsDestinationConfig): + + This field is a member of `oneof`_ ``destination_stream_config``. + """ + + destination_connection_profile_name: str = proto.Field( + proto.STRING, + number=1, + ) + gcs_destination_config: 'GcsDestinationConfig' = proto.Field( + proto.MESSAGE, + number=100, + oneof='destination_stream_config', + message='GcsDestinationConfig', + ) + + +class Stream(proto.Message): + r""" + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + name (str): + Output only. The stream's name. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The creation time of the stream. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The last update time of the + stream. + labels (MutableMapping[str, str]): + Labels. + display_name (str): + Required. Display name. + source_config (google.cloud.datastream_v1alpha1.types.SourceConfig): + Required. Source connection profile + configuration. + destination_config (google.cloud.datastream_v1alpha1.types.DestinationConfig): + Required. Destination connection profile + configuration. + state (google.cloud.datastream_v1alpha1.types.Stream.State): + The state of the stream. + backfill_all (google.cloud.datastream_v1alpha1.types.Stream.BackfillAllStrategy): + Automatically backfill objects included in + the stream source configuration. Specific + objects can be excluded. + + This field is a member of `oneof`_ ``backfill_strategy``. + backfill_none (google.cloud.datastream_v1alpha1.types.Stream.BackfillNoneStrategy): + Do not automatically backfill any objects. + + This field is a member of `oneof`_ ``backfill_strategy``. + errors (MutableSequence[google.cloud.datastream_v1alpha1.types.Error]): + Output only. Errors on the Stream. + """ + class State(proto.Enum): + r"""Stream state. + + Values: + STATE_UNSPECIFIED (0): + Unspecified stream state. + CREATED (1): + The stream has been created. + RUNNING (2): + The stream is running. + PAUSED (3): + The stream is paused. + MAINTENANCE (4): + The stream is in maintenance mode. + Updates are rejected on the resource in this + state. + FAILED (5): + The stream is experiencing an error that is + preventing data from being streamed. + FAILED_PERMANENTLY (6): + The stream has experienced a terminal + failure. + STARTING (7): + The stream is starting, but not yet running. + DRAINING (8): + The Stream is no longer reading new events, + but still writing events in the buffer. + """ + STATE_UNSPECIFIED = 0 + CREATED = 1 + RUNNING = 2 + PAUSED = 3 + MAINTENANCE = 4 + FAILED = 5 + FAILED_PERMANENTLY = 6 + STARTING = 7 + DRAINING = 8 + + class BackfillAllStrategy(proto.Message): + r"""Backfill strategy to automatically backfill the Stream's + objects. Specific objects can be excluded. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + oracle_excluded_objects (google.cloud.datastream_v1alpha1.types.OracleRdbms): + Oracle data source objects to avoid + backfilling. + + This field is a member of `oneof`_ ``excluded_objects``. + mysql_excluded_objects (google.cloud.datastream_v1alpha1.types.MysqlRdbms): + MySQL data source objects to avoid + backfilling. + + This field is a member of `oneof`_ ``excluded_objects``. + """ + + oracle_excluded_objects: 'OracleRdbms' = proto.Field( + proto.MESSAGE, + number=1, + oneof='excluded_objects', + message='OracleRdbms', + ) + mysql_excluded_objects: 'MysqlRdbms' = proto.Field( + proto.MESSAGE, + number=2, + oneof='excluded_objects', + message='MysqlRdbms', + ) + + class BackfillNoneStrategy(proto.Message): + r"""Backfill strategy to disable automatic backfill for the + Stream's objects. + + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + create_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + update_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + display_name: str = proto.Field( + proto.STRING, + number=5, + ) + source_config: 'SourceConfig' = proto.Field( + proto.MESSAGE, + number=6, + message='SourceConfig', + ) + destination_config: 'DestinationConfig' = proto.Field( + proto.MESSAGE, + number=7, + message='DestinationConfig', + ) + state: State = proto.Field( + proto.ENUM, + number=8, + enum=State, + ) + backfill_all: BackfillAllStrategy = proto.Field( + proto.MESSAGE, + number=101, + oneof='backfill_strategy', + message=BackfillAllStrategy, + ) + backfill_none: BackfillNoneStrategy = proto.Field( + proto.MESSAGE, + number=102, + oneof='backfill_strategy', + message=BackfillNoneStrategy, + ) + errors: MutableSequence['Error'] = proto.RepeatedField( + proto.MESSAGE, + number=9, + message='Error', + ) + + +class Error(proto.Message): + r"""Represent a user-facing Error. + + Attributes: + reason (str): + A title that explains the reason for the + error. + error_uuid (str): + A unique identifier for this specific error, + allowing it to be traced throughout the system + in logs and API responses. + message (str): + A message containing more information about + the error that occurred. + error_time (google.protobuf.timestamp_pb2.Timestamp): + The time when the error occurred. + details (MutableMapping[str, str]): + Additional information about the error. + """ + + reason: str = proto.Field( + proto.STRING, + number=1, + ) + error_uuid: str = proto.Field( + proto.STRING, + number=2, + ) + message: str = proto.Field( + proto.STRING, + number=3, + ) + error_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) + details: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=5, + ) + + +class ValidationResult(proto.Message): + r"""Contains the current validation results. + + Attributes: + validations (MutableSequence[google.cloud.datastream_v1alpha1.types.Validation]): + A list of validations (includes both executed + as well as not executed validations). + """ + + validations: MutableSequence['Validation'] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='Validation', + ) + + +class Validation(proto.Message): + r""" + + Attributes: + description (str): + A short description of the validation. + status (google.cloud.datastream_v1alpha1.types.Validation.Status): + Validation execution status. + message (MutableSequence[google.cloud.datastream_v1alpha1.types.ValidationMessage]): + Messages reflecting the validation results. + code (str): + A custom code identifying this validation. + """ + class Status(proto.Enum): + r"""Validation execution status. + + Values: + STATUS_UNSPECIFIED (0): + Unspecified status. + NOT_EXECUTED (1): + Validation did not execute. + FAILED (2): + Validation failed. + PASSED (3): + Validation passed. + """ + STATUS_UNSPECIFIED = 0 + NOT_EXECUTED = 1 + FAILED = 2 + PASSED = 3 + + description: str = proto.Field( + proto.STRING, + number=1, + ) + status: Status = proto.Field( + proto.ENUM, + number=2, + enum=Status, + ) + message: MutableSequence['ValidationMessage'] = proto.RepeatedField( + proto.MESSAGE, + number=3, + message='ValidationMessage', + ) + code: str = proto.Field( + proto.STRING, + number=4, + ) + + +class ValidationMessage(proto.Message): + r"""Represent user-facing validation result message. + + Attributes: + message (str): + The result of the validation. + level (google.cloud.datastream_v1alpha1.types.ValidationMessage.Level): + Message severity level (warning or error). + metadata (MutableMapping[str, str]): + Additional metadata related to the result. + code (str): + A custom code identifying this specific + message. + """ + class Level(proto.Enum): + r"""Validation message level. + + Values: + LEVEL_UNSPECIFIED (0): + Unspecified level. + WARNING (1): + Potentially cause issues with the Stream. + ERROR (2): + Definitely cause issues with the Stream. + """ + LEVEL_UNSPECIFIED = 0 + WARNING = 1 + ERROR = 2 + + message: str = proto.Field( + proto.STRING, + number=1, + ) + level: Level = proto.Field( + proto.ENUM, + number=2, + enum=Level, + ) + metadata: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=3, + ) + code: str = proto.Field( + proto.STRING, + number=4, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1alpha1/mypy.ini b/owl-bot-staging/v1alpha1/mypy.ini new file mode 100644 index 0000000..574c5ae --- /dev/null +++ b/owl-bot-staging/v1alpha1/mypy.ini @@ -0,0 +1,3 @@ +[mypy] +python_version = 3.7 +namespace_packages = True diff --git a/owl-bot-staging/v1alpha1/noxfile.py b/owl-bot-staging/v1alpha1/noxfile.py new file mode 100644 index 0000000..a812ff8 --- /dev/null +++ b/owl-bot-staging/v1alpha1/noxfile.py @@ -0,0 +1,184 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import os +import pathlib +import shutil +import subprocess +import sys + + +import nox # type: ignore + +ALL_PYTHON = [ + "3.7", + "3.8", + "3.9", + "3.10", + "3.11", +] + +CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() + +LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" +PACKAGE_NAME = subprocess.check_output([sys.executable, "setup.py", "--name"], encoding="utf-8") + +BLACK_VERSION = "black==22.3.0" +BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"] +DEFAULT_PYTHON_VERSION = "3.11" + +nox.sessions = [ + "unit", + "cover", + "mypy", + "check_lower_bounds" + # exclude update_lower_bounds from default + "docs", + "blacken", + "lint", + "lint_setup_py", +] + +@nox.session(python=ALL_PYTHON) +def unit(session): + """Run the unit test suite.""" + + session.install('coverage', 'pytest', 'pytest-cov', 'pytest-asyncio', 'asyncmock; python_version < "3.8"') + session.install('-e', '.') + + session.run( + 'py.test', + '--quiet', + '--cov=google/cloud/datastream_v1alpha1/', + '--cov=tests/', + '--cov-config=.coveragerc', + '--cov-report=term', + '--cov-report=html', + os.path.join('tests', 'unit', ''.join(session.posargs)) + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def cover(session): + """Run the final coverage report. + This outputs the coverage report aggregating coverage from the unit + test runs (not system test runs), and then erases coverage data. + """ + session.install("coverage", "pytest-cov") + session.run("coverage", "report", "--show-missing", "--fail-under=100") + + session.run("coverage", "erase") + + +@nox.session(python=ALL_PYTHON) +def mypy(session): + """Run the type checker.""" + session.install( + 'mypy', + 'types-requests', + 'types-protobuf' + ) + session.install('.') + session.run( + 'mypy', + '--explicit-package-bases', + 'google', + ) + + +@nox.session +def update_lower_bounds(session): + """Update lower bounds in constraints.txt to match setup.py""" + session.install('google-cloud-testutils') + session.install('.') + + session.run( + 'lower-bound-checker', + 'update', + '--package-name', + PACKAGE_NAME, + '--constraints-file', + str(LOWER_BOUND_CONSTRAINTS_FILE), + ) + + +@nox.session +def check_lower_bounds(session): + """Check lower bounds in setup.py are reflected in constraints file""" + session.install('google-cloud-testutils') + session.install('.') + + session.run( + 'lower-bound-checker', + 'check', + '--package-name', + PACKAGE_NAME, + '--constraints-file', + str(LOWER_BOUND_CONSTRAINTS_FILE), + ) + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def docs(session): + """Build the docs for this library.""" + + session.install("-e", ".") + session.install("sphinx==4.0.1", "alabaster", "recommonmark") + + shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) + session.run( + "sphinx-build", + "-W", # warnings as errors + "-T", # show full traceback on exception + "-N", # no colors + "-b", + "html", + "-d", + os.path.join("docs", "_build", "doctrees", ""), + os.path.join("docs", ""), + os.path.join("docs", "_build", "html", ""), + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def lint(session): + """Run linters. + + Returns a failure if the linters find linting errors or sufficiently + serious code quality issues. + """ + session.install("flake8", BLACK_VERSION) + session.run( + "black", + "--check", + *BLACK_PATHS, + ) + session.run("flake8", "google", "tests", "samples") + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def blacken(session): + """Run black. Format code to uniform standard.""" + session.install(BLACK_VERSION) + session.run( + "black", + *BLACK_PATHS, + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def lint_setup_py(session): + """Verify that setup.py is valid (including RST check).""" + session.install("docutils", "pygments") + session.run("python", "setup.py", "check", "--restructuredtext", "--strict") diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_connection_profile_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_connection_profile_async.py new file mode 100644 index 0000000..cb89c2c --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_connection_profile_async.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateConnectionProfile +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_CreateConnectionProfile_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +async def sample_create_connection_profile(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + connection_profile = datastream_v1alpha1.ConnectionProfile() + connection_profile.oracle_profile.hostname = "hostname_value" + connection_profile.oracle_profile.username = "username_value" + connection_profile.oracle_profile.password = "password_value" + connection_profile.oracle_profile.database_service = "database_service_value" + connection_profile.display_name = "display_name_value" + + request = datastream_v1alpha1.CreateConnectionProfileRequest( + parent="parent_value", + connection_profile_id="connection_profile_id_value", + connection_profile=connection_profile, + ) + + # Make the request + operation = client.create_connection_profile(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_CreateConnectionProfile_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_connection_profile_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_connection_profile_sync.py new file mode 100644 index 0000000..8f1c8df --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_connection_profile_sync.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateConnectionProfile +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_CreateConnectionProfile_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +def sample_create_connection_profile(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + connection_profile = datastream_v1alpha1.ConnectionProfile() + connection_profile.oracle_profile.hostname = "hostname_value" + connection_profile.oracle_profile.username = "username_value" + connection_profile.oracle_profile.password = "password_value" + connection_profile.oracle_profile.database_service = "database_service_value" + connection_profile.display_name = "display_name_value" + + request = datastream_v1alpha1.CreateConnectionProfileRequest( + parent="parent_value", + connection_profile_id="connection_profile_id_value", + connection_profile=connection_profile, + ) + + # Make the request + operation = client.create_connection_profile(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_CreateConnectionProfile_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_private_connection_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_private_connection_async.py new file mode 100644 index 0000000..b907d14 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_private_connection_async.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreatePrivateConnection +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_CreatePrivateConnection_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +async def sample_create_private_connection(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + private_connection = datastream_v1alpha1.PrivateConnection() + private_connection.display_name = "display_name_value" + + request = datastream_v1alpha1.CreatePrivateConnectionRequest( + parent="parent_value", + private_connection_id="private_connection_id_value", + private_connection=private_connection, + ) + + # Make the request + operation = client.create_private_connection(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_CreatePrivateConnection_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_private_connection_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_private_connection_sync.py new file mode 100644 index 0000000..78ba491 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_private_connection_sync.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreatePrivateConnection +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_CreatePrivateConnection_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +def sample_create_private_connection(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + private_connection = datastream_v1alpha1.PrivateConnection() + private_connection.display_name = "display_name_value" + + request = datastream_v1alpha1.CreatePrivateConnectionRequest( + parent="parent_value", + private_connection_id="private_connection_id_value", + private_connection=private_connection, + ) + + # Make the request + operation = client.create_private_connection(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_CreatePrivateConnection_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_route_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_route_async.py new file mode 100644 index 0000000..befa784 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_route_async.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateRoute +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_CreateRoute_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +async def sample_create_route(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + route = datastream_v1alpha1.Route() + route.display_name = "display_name_value" + route.destination_address = "destination_address_value" + + request = datastream_v1alpha1.CreateRouteRequest( + parent="parent_value", + route_id="route_id_value", + route=route, + ) + + # Make the request + operation = client.create_route(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_CreateRoute_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_route_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_route_sync.py new file mode 100644 index 0000000..ff204d7 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_route_sync.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateRoute +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_CreateRoute_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +def sample_create_route(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + route = datastream_v1alpha1.Route() + route.display_name = "display_name_value" + route.destination_address = "destination_address_value" + + request = datastream_v1alpha1.CreateRouteRequest( + parent="parent_value", + route_id="route_id_value", + route=route, + ) + + # Make the request + operation = client.create_route(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_CreateRoute_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_stream_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_stream_async.py new file mode 100644 index 0000000..6dee5e8 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_stream_async.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateStream +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_CreateStream_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +async def sample_create_stream(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + stream = datastream_v1alpha1.Stream() + stream.display_name = "display_name_value" + stream.source_config.source_connection_profile_name = "source_connection_profile_name_value" + stream.destination_config.destination_connection_profile_name = "destination_connection_profile_name_value" + + request = datastream_v1alpha1.CreateStreamRequest( + parent="parent_value", + stream_id="stream_id_value", + stream=stream, + ) + + # Make the request + operation = client.create_stream(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_CreateStream_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_stream_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_stream_sync.py new file mode 100644 index 0000000..0c4db6b --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_stream_sync.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateStream +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_CreateStream_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +def sample_create_stream(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + stream = datastream_v1alpha1.Stream() + stream.display_name = "display_name_value" + stream.source_config.source_connection_profile_name = "source_connection_profile_name_value" + stream.destination_config.destination_connection_profile_name = "destination_connection_profile_name_value" + + request = datastream_v1alpha1.CreateStreamRequest( + parent="parent_value", + stream_id="stream_id_value", + stream=stream, + ) + + # Make the request + operation = client.create_stream(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_CreateStream_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_connection_profile_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_connection_profile_async.py new file mode 100644 index 0000000..77394fb --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_connection_profile_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteConnectionProfile +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_DeleteConnectionProfile_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +async def sample_delete_connection_profile(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.DeleteConnectionProfileRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_connection_profile(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_DeleteConnectionProfile_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_connection_profile_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_connection_profile_sync.py new file mode 100644 index 0000000..4d71597 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_connection_profile_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteConnectionProfile +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_DeleteConnectionProfile_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +def sample_delete_connection_profile(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.DeleteConnectionProfileRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_connection_profile(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_DeleteConnectionProfile_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_private_connection_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_private_connection_async.py new file mode 100644 index 0000000..228fd3a --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_private_connection_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeletePrivateConnection +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_DeletePrivateConnection_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +async def sample_delete_private_connection(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.DeletePrivateConnectionRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_private_connection(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_DeletePrivateConnection_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_private_connection_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_private_connection_sync.py new file mode 100644 index 0000000..46eeb51 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_private_connection_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeletePrivateConnection +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_DeletePrivateConnection_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +def sample_delete_private_connection(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.DeletePrivateConnectionRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_private_connection(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_DeletePrivateConnection_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_route_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_route_async.py new file mode 100644 index 0000000..6c899da --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_route_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteRoute +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_DeleteRoute_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +async def sample_delete_route(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.DeleteRouteRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_route(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_DeleteRoute_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_route_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_route_sync.py new file mode 100644 index 0000000..005ffed --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_route_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteRoute +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_DeleteRoute_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +def sample_delete_route(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.DeleteRouteRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_route(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_DeleteRoute_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_stream_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_stream_async.py new file mode 100644 index 0000000..59a6e6e --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_stream_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteStream +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_DeleteStream_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +async def sample_delete_stream(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.DeleteStreamRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_stream(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_DeleteStream_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_stream_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_stream_sync.py new file mode 100644 index 0000000..c8bd332 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_stream_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteStream +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_DeleteStream_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +def sample_delete_stream(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.DeleteStreamRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_stream(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_DeleteStream_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_discover_connection_profile_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_discover_connection_profile_async.py new file mode 100644 index 0000000..b463e03 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_discover_connection_profile_async.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DiscoverConnectionProfile +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_DiscoverConnectionProfile_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +async def sample_discover_connection_profile(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + connection_profile = datastream_v1alpha1.ConnectionProfile() + connection_profile.oracle_profile.hostname = "hostname_value" + connection_profile.oracle_profile.username = "username_value" + connection_profile.oracle_profile.password = "password_value" + connection_profile.oracle_profile.database_service = "database_service_value" + connection_profile.display_name = "display_name_value" + + request = datastream_v1alpha1.DiscoverConnectionProfileRequest( + connection_profile=connection_profile, + recursive=True, + parent="parent_value", + ) + + # Make the request + response = await client.discover_connection_profile(request=request) + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_DiscoverConnectionProfile_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_discover_connection_profile_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_discover_connection_profile_sync.py new file mode 100644 index 0000000..449f11e --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_discover_connection_profile_sync.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DiscoverConnectionProfile +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_DiscoverConnectionProfile_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +def sample_discover_connection_profile(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + connection_profile = datastream_v1alpha1.ConnectionProfile() + connection_profile.oracle_profile.hostname = "hostname_value" + connection_profile.oracle_profile.username = "username_value" + connection_profile.oracle_profile.password = "password_value" + connection_profile.oracle_profile.database_service = "database_service_value" + connection_profile.display_name = "display_name_value" + + request = datastream_v1alpha1.DiscoverConnectionProfileRequest( + connection_profile=connection_profile, + recursive=True, + parent="parent_value", + ) + + # Make the request + response = client.discover_connection_profile(request=request) + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_DiscoverConnectionProfile_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_errors_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_errors_async.py new file mode 100644 index 0000000..6677448 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_errors_async.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for FetchErrors +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_FetchErrors_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +async def sample_fetch_errors(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.FetchErrorsRequest( + ) + + # Make the request + operation = client.fetch_errors(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_FetchErrors_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_errors_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_errors_sync.py new file mode 100644 index 0000000..8550d43 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_errors_sync.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for FetchErrors +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_FetchErrors_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +def sample_fetch_errors(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.FetchErrorsRequest( + ) + + # Make the request + operation = client.fetch_errors(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_FetchErrors_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_static_ips_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_static_ips_async.py new file mode 100644 index 0000000..e66262d --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_static_ips_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for FetchStaticIps +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_FetchStaticIps_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +async def sample_fetch_static_ips(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.FetchStaticIpsRequest( + name="name_value", + ) + + # Make the request + page_result = client.fetch_static_ips(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END datastream_v1alpha1_generated_Datastream_FetchStaticIps_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_static_ips_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_static_ips_sync.py new file mode 100644 index 0000000..d6591be --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_static_ips_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for FetchStaticIps +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_FetchStaticIps_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +def sample_fetch_static_ips(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.FetchStaticIpsRequest( + name="name_value", + ) + + # Make the request + page_result = client.fetch_static_ips(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END datastream_v1alpha1_generated_Datastream_FetchStaticIps_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_connection_profile_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_connection_profile_async.py new file mode 100644 index 0000000..a0bc412 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_connection_profile_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetConnectionProfile +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_GetConnectionProfile_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +async def sample_get_connection_profile(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.GetConnectionProfileRequest( + name="name_value", + ) + + # Make the request + response = await client.get_connection_profile(request=request) + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_GetConnectionProfile_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_connection_profile_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_connection_profile_sync.py new file mode 100644 index 0000000..00f1b9b --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_connection_profile_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetConnectionProfile +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_GetConnectionProfile_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +def sample_get_connection_profile(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.GetConnectionProfileRequest( + name="name_value", + ) + + # Make the request + response = client.get_connection_profile(request=request) + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_GetConnectionProfile_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_private_connection_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_private_connection_async.py new file mode 100644 index 0000000..fb242ce --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_private_connection_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetPrivateConnection +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_GetPrivateConnection_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +async def sample_get_private_connection(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.GetPrivateConnectionRequest( + name="name_value", + ) + + # Make the request + response = await client.get_private_connection(request=request) + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_GetPrivateConnection_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_private_connection_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_private_connection_sync.py new file mode 100644 index 0000000..46f2e57 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_private_connection_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetPrivateConnection +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_GetPrivateConnection_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +def sample_get_private_connection(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.GetPrivateConnectionRequest( + name="name_value", + ) + + # Make the request + response = client.get_private_connection(request=request) + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_GetPrivateConnection_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_route_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_route_async.py new file mode 100644 index 0000000..663e74a --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_route_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetRoute +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_GetRoute_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +async def sample_get_route(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.GetRouteRequest( + name="name_value", + ) + + # Make the request + response = await client.get_route(request=request) + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_GetRoute_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_route_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_route_sync.py new file mode 100644 index 0000000..3176bae --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_route_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetRoute +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_GetRoute_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +def sample_get_route(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.GetRouteRequest( + name="name_value", + ) + + # Make the request + response = client.get_route(request=request) + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_GetRoute_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_stream_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_stream_async.py new file mode 100644 index 0000000..b1c1572 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_stream_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetStream +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_GetStream_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +async def sample_get_stream(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.GetStreamRequest( + name="name_value", + ) + + # Make the request + response = await client.get_stream(request=request) + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_GetStream_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_stream_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_stream_sync.py new file mode 100644 index 0000000..4610194 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_stream_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetStream +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_GetStream_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +def sample_get_stream(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.GetStreamRequest( + name="name_value", + ) + + # Make the request + response = client.get_stream(request=request) + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_GetStream_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_connection_profiles_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_connection_profiles_async.py new file mode 100644 index 0000000..6a2bf11 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_connection_profiles_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListConnectionProfiles +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_ListConnectionProfiles_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +async def sample_list_connection_profiles(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.ListConnectionProfilesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_connection_profiles(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END datastream_v1alpha1_generated_Datastream_ListConnectionProfiles_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_connection_profiles_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_connection_profiles_sync.py new file mode 100644 index 0000000..07ae1d8 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_connection_profiles_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListConnectionProfiles +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_ListConnectionProfiles_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +def sample_list_connection_profiles(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.ListConnectionProfilesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_connection_profiles(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END datastream_v1alpha1_generated_Datastream_ListConnectionProfiles_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_private_connections_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_private_connections_async.py new file mode 100644 index 0000000..0cd574b --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_private_connections_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListPrivateConnections +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_ListPrivateConnections_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +async def sample_list_private_connections(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.ListPrivateConnectionsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_private_connections(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END datastream_v1alpha1_generated_Datastream_ListPrivateConnections_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_private_connections_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_private_connections_sync.py new file mode 100644 index 0000000..b8d2ef4 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_private_connections_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListPrivateConnections +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_ListPrivateConnections_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +def sample_list_private_connections(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.ListPrivateConnectionsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_private_connections(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END datastream_v1alpha1_generated_Datastream_ListPrivateConnections_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_routes_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_routes_async.py new file mode 100644 index 0000000..4013559 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_routes_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListRoutes +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_ListRoutes_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +async def sample_list_routes(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.ListRoutesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_routes(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END datastream_v1alpha1_generated_Datastream_ListRoutes_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_routes_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_routes_sync.py new file mode 100644 index 0000000..fdb0da2 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_routes_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListRoutes +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_ListRoutes_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +def sample_list_routes(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.ListRoutesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_routes(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END datastream_v1alpha1_generated_Datastream_ListRoutes_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_streams_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_streams_async.py new file mode 100644 index 0000000..eb4d921 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_streams_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListStreams +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_ListStreams_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +async def sample_list_streams(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.ListStreamsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_streams(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END datastream_v1alpha1_generated_Datastream_ListStreams_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_streams_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_streams_sync.py new file mode 100644 index 0000000..c661d4c --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_streams_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListStreams +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_ListStreams_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +def sample_list_streams(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + request = datastream_v1alpha1.ListStreamsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_streams(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END datastream_v1alpha1_generated_Datastream_ListStreams_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_connection_profile_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_connection_profile_async.py new file mode 100644 index 0000000..d1eb5ff --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_connection_profile_async.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateConnectionProfile +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_UpdateConnectionProfile_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +async def sample_update_connection_profile(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + connection_profile = datastream_v1alpha1.ConnectionProfile() + connection_profile.oracle_profile.hostname = "hostname_value" + connection_profile.oracle_profile.username = "username_value" + connection_profile.oracle_profile.password = "password_value" + connection_profile.oracle_profile.database_service = "database_service_value" + connection_profile.display_name = "display_name_value" + + request = datastream_v1alpha1.UpdateConnectionProfileRequest( + connection_profile=connection_profile, + ) + + # Make the request + operation = client.update_connection_profile(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_UpdateConnectionProfile_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_connection_profile_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_connection_profile_sync.py new file mode 100644 index 0000000..f2a14a1 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_connection_profile_sync.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateConnectionProfile +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_UpdateConnectionProfile_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +def sample_update_connection_profile(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + connection_profile = datastream_v1alpha1.ConnectionProfile() + connection_profile.oracle_profile.hostname = "hostname_value" + connection_profile.oracle_profile.username = "username_value" + connection_profile.oracle_profile.password = "password_value" + connection_profile.oracle_profile.database_service = "database_service_value" + connection_profile.display_name = "display_name_value" + + request = datastream_v1alpha1.UpdateConnectionProfileRequest( + connection_profile=connection_profile, + ) + + # Make the request + operation = client.update_connection_profile(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_UpdateConnectionProfile_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_stream_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_stream_async.py new file mode 100644 index 0000000..63ceab0 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_stream_async.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateStream +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_UpdateStream_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +async def sample_update_stream(): + # Create a client + client = datastream_v1alpha1.DatastreamAsyncClient() + + # Initialize request argument(s) + stream = datastream_v1alpha1.Stream() + stream.display_name = "display_name_value" + stream.source_config.source_connection_profile_name = "source_connection_profile_name_value" + stream.destination_config.destination_connection_profile_name = "destination_connection_profile_name_value" + + request = datastream_v1alpha1.UpdateStreamRequest( + stream=stream, + ) + + # Make the request + operation = client.update_stream(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_UpdateStream_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_stream_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_stream_sync.py new file mode 100644 index 0000000..46e0350 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_stream_sync.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateStream +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-datastream + + +# [START datastream_v1alpha1_generated_Datastream_UpdateStream_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import datastream_v1alpha1 + + +def sample_update_stream(): + # Create a client + client = datastream_v1alpha1.DatastreamClient() + + # Initialize request argument(s) + stream = datastream_v1alpha1.Stream() + stream.display_name = "display_name_value" + stream.source_config.source_connection_profile_name = "source_connection_profile_name_value" + stream.destination_config.destination_connection_profile_name = "destination_connection_profile_name_value" + + request = datastream_v1alpha1.UpdateStreamRequest( + stream=stream, + ) + + # Make the request + operation = client.update_stream(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END datastream_v1alpha1_generated_Datastream_UpdateStream_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/snippet_metadata_google.cloud.datastream.v1alpha1.json b/owl-bot-staging/v1alpha1/samples/generated_samples/snippet_metadata_google.cloud.datastream.v1alpha1.json new file mode 100644 index 0000000..09dea00 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated_samples/snippet_metadata_google.cloud.datastream.v1alpha1.json @@ -0,0 +1,3460 @@ +{ + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.datastream.v1alpha1", + "version": "v1alpha1" + } + ], + "language": "PYTHON", + "name": "google-cloud-datastream", + "version": "0.1.0" + }, + "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": [ + { + "end": 64, + "start": 27, + "type": "FULL" + }, + { + "end": 64, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 54, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 61, + "start": 55, + "type": "REQUEST_EXECUTION" + }, + { + "end": 65, + "start": 62, + "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": [ + { + "end": 64, + "start": 27, + "type": "FULL" + }, + { + "end": 64, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 54, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 61, + "start": 55, + "type": "REQUEST_EXECUTION" + }, + { + "end": 65, + "start": 62, + "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": [ + { + "end": 60, + "start": 27, + "type": "FULL" + }, + { + "end": 60, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 57, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 61, + "start": 58, + "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": [ + { + "end": 60, + "start": 27, + "type": "FULL" + }, + { + "end": 60, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 57, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 61, + "start": 58, + "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": [ + { + "end": 61, + "start": 27, + "type": "FULL" + }, + { + "end": 61, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 51, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 58, + "start": 52, + "type": "REQUEST_EXECUTION" + }, + { + "end": 62, + "start": 59, + "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": [ + { + "end": 61, + "start": 27, + "type": "FULL" + }, + { + "end": 61, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 51, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 58, + "start": 52, + "type": "REQUEST_EXECUTION" + }, + { + "end": 62, + "start": 59, + "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": [ + { + "end": 62, + "start": 27, + "type": "FULL" + }, + { + "end": 62, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 52, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 59, + "start": 53, + "type": "REQUEST_EXECUTION" + }, + { + "end": 63, + "start": 60, + "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": [ + { + "end": 62, + "start": 27, + "type": "FULL" + }, + { + "end": 62, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 52, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 59, + "start": 53, + "type": "REQUEST_EXECUTION" + }, + { + "end": 63, + "start": 60, + "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": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "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": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "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": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "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": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "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": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "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": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "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": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "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": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "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": [ + { + "end": 60, + "start": 27, + "type": "FULL" + }, + { + "end": 60, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 54, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 57, + "start": 55, + "type": "REQUEST_EXECUTION" + }, + { + "end": 61, + "start": 58, + "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": [ + { + "end": 60, + "start": 27, + "type": "FULL" + }, + { + "end": 60, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 54, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 57, + "start": 55, + "type": "REQUEST_EXECUTION" + }, + { + "end": 61, + "start": 58, + "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": [ + { + "end": 54, + "start": 27, + "type": "FULL" + }, + { + "end": 54, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 51, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 55, + "start": 52, + "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": [ + { + "end": 54, + "start": 27, + "type": "FULL" + }, + { + "end": 54, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 51, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 55, + "start": 52, + "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": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "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": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "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": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "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": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "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": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "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": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "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": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "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": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "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": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "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": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "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": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "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": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "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": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "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": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "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": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "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": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "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": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "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": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "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": [ + { + "end": 62, + "start": 27, + "type": "FULL" + }, + { + "end": 62, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 52, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 59, + "start": 53, + "type": "REQUEST_EXECUTION" + }, + { + "end": 63, + "start": 60, + "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": [ + { + "end": 62, + "start": 27, + "type": "FULL" + }, + { + "end": 62, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 52, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 59, + "start": 53, + "type": "REQUEST_EXECUTION" + }, + { + "end": 63, + "start": 60, + "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": [ + { + "end": 60, + "start": 27, + "type": "FULL" + }, + { + "end": 60, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 57, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 61, + "start": 58, + "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": [ + { + "end": 60, + "start": 27, + "type": "FULL" + }, + { + "end": 60, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 57, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 61, + "start": 58, + "type": "RESPONSE_HANDLING" + } + ], + "title": "datastream_v1alpha1_generated_datastream_update_stream_sync.py" + } + ] +} diff --git a/owl-bot-staging/v1alpha1/scripts/fixup_datastream_v1alpha1_keywords.py b/owl-bot-staging/v1alpha1/scripts/fixup_datastream_v1alpha1_keywords.py new file mode 100644 index 0000000..74accfd --- /dev/null +++ b/owl-bot-staging/v1alpha1/scripts/fixup_datastream_v1alpha1_keywords.py @@ -0,0 +1,196 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import argparse +import os +import libcst as cst +import pathlib +import sys +from typing import (Any, Callable, Dict, List, Sequence, Tuple) + + +def partition( + predicate: Callable[[Any], bool], + iterator: Sequence[Any] +) -> Tuple[List[Any], List[Any]]: + """A stable, out-of-place partition.""" + results = ([], []) + + for i in iterator: + results[int(predicate(i))].append(i) + + # Returns trueList, falseList + return results[1], results[0] + + +class datastreamCallTransformer(cst.CSTTransformer): + CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') + METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { + 'create_connection_profile': ('parent', 'connection_profile_id', 'connection_profile', 'request_id', ), + 'create_private_connection': ('parent', 'private_connection_id', 'private_connection', 'request_id', ), + 'create_route': ('parent', 'route_id', 'route', 'request_id', ), + 'create_stream': ('parent', 'stream_id', 'stream', 'request_id', 'validate_only', 'force', ), + 'delete_connection_profile': ('name', 'request_id', ), + 'delete_private_connection': ('name', 'request_id', 'force', ), + 'delete_route': ('name', 'request_id', ), + 'delete_stream': ('name', 'request_id', ), + 'discover_connection_profile': ('parent', 'connection_profile', 'connection_profile_name', 'recursive', 'recursion_depth', 'oracle_rdbms', 'mysql_rdbms', ), + 'fetch_errors': ('stream', ), + 'fetch_static_ips': ('name', 'page_size', 'page_token', ), + 'get_connection_profile': ('name', ), + 'get_private_connection': ('name', ), + 'get_route': ('name', ), + 'get_stream': ('name', ), + 'list_connection_profiles': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), + 'list_private_connections': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), + 'list_routes': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), + 'list_streams': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), + 'update_connection_profile': ('connection_profile', 'update_mask', 'request_id', ), + 'update_stream': ('stream', 'update_mask', 'request_id', 'validate_only', 'force', ), + } + + def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: + try: + key = original.func.attr.value + kword_params = self.METHOD_TO_PARAMS[key] + except (AttributeError, KeyError): + # Either not a method from the API or too convoluted to be sure. + return updated + + # If the existing code is valid, keyword args come after positional args. + # Therefore, all positional args must map to the first parameters. + args, kwargs = partition(lambda a: not bool(a.keyword), updated.args) + if any(k.keyword.value == "request" for k in kwargs): + # We've already fixed this file, don't fix it again. + return updated + + kwargs, ctrl_kwargs = partition( + lambda a: a.keyword.value not in self.CTRL_PARAMS, + kwargs + ) + + args, ctrl_args = args[:len(kword_params)], args[len(kword_params):] + ctrl_kwargs.extend(cst.Arg(value=a.value, keyword=cst.Name(value=ctrl)) + for a, ctrl in zip(ctrl_args, self.CTRL_PARAMS)) + + request_arg = cst.Arg( + value=cst.Dict([ + cst.DictElement( + cst.SimpleString("'{}'".format(name)), +cst.Element(value=arg.value) + ) + # Note: the args + kwargs looks silly, but keep in mind that + # the control parameters had to be stripped out, and that + # those could have been passed positionally or by keyword. + for name, arg in zip(kword_params, args + kwargs)]), + keyword=cst.Name("request") + ) + + return updated.with_changes( + args=[request_arg] + ctrl_kwargs + ) + + +def fix_files( + in_dir: pathlib.Path, + out_dir: pathlib.Path, + *, + transformer=datastreamCallTransformer(), +): + """Duplicate the input dir to the output dir, fixing file method calls. + + Preconditions: + * in_dir is a real directory + * out_dir is a real, empty directory + """ + pyfile_gen = ( + pathlib.Path(os.path.join(root, f)) + for root, _, files in os.walk(in_dir) + for f in files if os.path.splitext(f)[1] == ".py" + ) + + for fpath in pyfile_gen: + with open(fpath, 'r') as f: + src = f.read() + + # Parse the code and insert method call fixes. + tree = cst.parse_module(src) + updated = tree.visit(transformer) + + # Create the path and directory structure for the new file. + updated_path = out_dir.joinpath(fpath.relative_to(in_dir)) + updated_path.parent.mkdir(parents=True, exist_ok=True) + + # Generate the updated source file at the corresponding path. + with open(updated_path, 'w') as f: + f.write(updated.code) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser( + description="""Fix up source that uses the datastream client library. + +The existing sources are NOT overwritten but are copied to output_dir with changes made. + +Note: This tool operates at a best-effort level at converting positional + parameters in client method calls to keyword based parameters. + Cases where it WILL FAIL include + A) * or ** expansion in a method call. + B) Calls via function or method alias (includes free function calls) + C) Indirect or dispatched calls (e.g. the method is looked up dynamically) + + These all constitute false negatives. The tool will also detect false + positives when an API method shares a name with another method. +""") + parser.add_argument( + '-d', + '--input-directory', + required=True, + dest='input_dir', + help='the input directory to walk for python files to fix up', + ) + parser.add_argument( + '-o', + '--output-directory', + required=True, + dest='output_dir', + help='the directory to output files fixed via un-flattening', + ) + args = parser.parse_args() + input_dir = pathlib.Path(args.input_dir) + output_dir = pathlib.Path(args.output_dir) + if not input_dir.is_dir(): + print( + f"input directory '{input_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if not output_dir.is_dir(): + print( + f"output directory '{output_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if os.listdir(output_dir): + print( + f"output directory '{output_dir}' is not empty", + file=sys.stderr, + ) + sys.exit(-1) + + fix_files(input_dir, output_dir) diff --git a/owl-bot-staging/v1alpha1/setup.py b/owl-bot-staging/v1alpha1/setup.py new file mode 100644 index 0000000..1ca4c70 --- /dev/null +++ b/owl-bot-staging/v1alpha1/setup.py @@ -0,0 +1,90 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import io +import os + +import setuptools # type: ignore + +package_root = os.path.abspath(os.path.dirname(__file__)) + +name = 'google-cloud-datastream' + + +description = "Google Cloud Datastream API client library" + +version = {} +with open(os.path.join(package_root, 'google/cloud/datastream/gapic_version.py')) as fp: + exec(fp.read(), version) +version = version["__version__"] + +if version[0] == "0": + release_status = "Development Status :: 4 - Beta" +else: + release_status = "Development Status :: 5 - Production/Stable" + +dependencies = [ + "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", + "proto-plus >= 1.22.0, <2.0.0dev", + "proto-plus >= 1.22.2, <2.0.0dev; python_version>='3.11'", + "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", +] +url = "https://github.com/googleapis/python-datastream" + +package_root = os.path.abspath(os.path.dirname(__file__)) + +readme_filename = os.path.join(package_root, "README.rst") +with io.open(readme_filename, encoding="utf-8") as readme_file: + readme = readme_file.read() + +packages = [ + package + for package in setuptools.PEP420PackageFinder.find() + if package.startswith("google") +] + +namespaces = ["google", "google.cloud"] + +setuptools.setup( + name=name, + version=version, + description=description, + long_description=readme, + author="Google LLC", + author_email="googleapis-packages@google.com", + license="Apache 2.0", + url=url, + classifiers=[ + release_status, + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Operating System :: OS Independent", + "Topic :: Internet", + ], + platforms="Posix; MacOS X; Windows", + packages=packages, + python_requires=">=3.7", + namespace_packages=namespaces, + install_requires=dependencies, + include_package_data=True, + zip_safe=False, +) diff --git a/owl-bot-staging/v1alpha1/testing/constraints-3.10.txt b/owl-bot-staging/v1alpha1/testing/constraints-3.10.txt new file mode 100644 index 0000000..ed7f9ae --- /dev/null +++ b/owl-bot-staging/v1alpha1/testing/constraints-3.10.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/owl-bot-staging/v1alpha1/testing/constraints-3.11.txt b/owl-bot-staging/v1alpha1/testing/constraints-3.11.txt new file mode 100644 index 0000000..ed7f9ae --- /dev/null +++ b/owl-bot-staging/v1alpha1/testing/constraints-3.11.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/owl-bot-staging/v1alpha1/testing/constraints-3.12.txt b/owl-bot-staging/v1alpha1/testing/constraints-3.12.txt new file mode 100644 index 0000000..ed7f9ae --- /dev/null +++ b/owl-bot-staging/v1alpha1/testing/constraints-3.12.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/owl-bot-staging/v1alpha1/testing/constraints-3.7.txt b/owl-bot-staging/v1alpha1/testing/constraints-3.7.txt new file mode 100644 index 0000000..6c44adf --- /dev/null +++ b/owl-bot-staging/v1alpha1/testing/constraints-3.7.txt @@ -0,0 +1,9 @@ +# This constraints file is used to check that lower bounds +# are correct in setup.py +# List all library dependencies and extras in this file. +# Pin the version to the lower bound. +# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", +# Then this file should have google-cloud-foo==1.14.0 +google-api-core==1.34.0 +proto-plus==1.22.0 +protobuf==3.19.5 diff --git a/owl-bot-staging/v1alpha1/testing/constraints-3.8.txt b/owl-bot-staging/v1alpha1/testing/constraints-3.8.txt new file mode 100644 index 0000000..ed7f9ae --- /dev/null +++ b/owl-bot-staging/v1alpha1/testing/constraints-3.8.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/owl-bot-staging/v1alpha1/testing/constraints-3.9.txt b/owl-bot-staging/v1alpha1/testing/constraints-3.9.txt new file mode 100644 index 0000000..ed7f9ae --- /dev/null +++ b/owl-bot-staging/v1alpha1/testing/constraints-3.9.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/owl-bot-staging/v1alpha1/tests/__init__.py b/owl-bot-staging/v1alpha1/tests/__init__.py new file mode 100644 index 0000000..231bc12 --- /dev/null +++ b/owl-bot-staging/v1alpha1/tests/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1alpha1/tests/unit/__init__.py b/owl-bot-staging/v1alpha1/tests/unit/__init__.py new file mode 100644 index 0000000..231bc12 --- /dev/null +++ b/owl-bot-staging/v1alpha1/tests/unit/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1alpha1/tests/unit/gapic/__init__.py b/owl-bot-staging/v1alpha1/tests/unit/gapic/__init__.py new file mode 100644 index 0000000..231bc12 --- /dev/null +++ b/owl-bot-staging/v1alpha1/tests/unit/gapic/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1alpha1/tests/unit/gapic/datastream_v1alpha1/__init__.py b/owl-bot-staging/v1alpha1/tests/unit/gapic/datastream_v1alpha1/__init__.py new file mode 100644 index 0000000..231bc12 --- /dev/null +++ b/owl-bot-staging/v1alpha1/tests/unit/gapic/datastream_v1alpha1/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1alpha1/tests/unit/gapic/datastream_v1alpha1/test_datastream.py b/owl-bot-staging/v1alpha1/tests/unit/gapic/datastream_v1alpha1/test_datastream.py new file mode 100644 index 0000000..5716ba5 --- /dev/null +++ b/owl-bot-staging/v1alpha1/tests/unit/gapic/datastream_v1alpha1/test_datastream.py @@ -0,0 +1,7069 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import os +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock # pragma: NO COVER +except ImportError: # pragma: NO COVER + import mock + +import grpc +from grpc.experimental import aio +import math +import pytest +from proto.marshal.rules.dates import DurationRule, TimestampRule +from proto.marshal.rules import wrappers + +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 +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 empty_pb2 # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore +import google.auth + + +def client_cert_source_callback(): + return b"cert bytes", b"key bytes" + + +# If default endpoint is localhost, then default mtls endpoint will be the same. +# This method modifies the default endpoint so the client can produce a different +# mtls endpoint for endpoint testing purposes. +def modify_default_endpoint(client): + return "foo.googleapis.com" if ("localhost" in client.DEFAULT_ENDPOINT) else client.DEFAULT_ENDPOINT + + +def test__get_default_mtls_endpoint(): + api_endpoint = "example.googleapis.com" + api_mtls_endpoint = "example.mtls.googleapis.com" + sandbox_endpoint = "example.sandbox.googleapis.com" + sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" + non_googleapi = "api.example.com" + + assert DatastreamClient._get_default_mtls_endpoint(None) is None + assert DatastreamClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint + assert DatastreamClient._get_default_mtls_endpoint(api_mtls_endpoint) == api_mtls_endpoint + assert DatastreamClient._get_default_mtls_endpoint(sandbox_endpoint) == sandbox_mtls_endpoint + assert DatastreamClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) == sandbox_mtls_endpoint + assert DatastreamClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi + + +@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, transport=transport_name) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + assert client.transport._host == ( + 'datastream.googleapis.com:443' + ) + + +@pytest.mark.parametrize("transport_class,transport_name", [ + (transports.DatastreamGrpcTransport, "grpc"), + (transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio"), +]) +def test_datastream_client_service_account_always_use_jwt(transport_class, transport_name): + with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) + + with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + + +@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", transport=transport_name) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + 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' + ) + + +def test_datastream_client_get_transport_class(): + transport = DatastreamClient.get_transport_class() + available_transports = [ + transports.DatastreamGrpcTransport, + ] + assert transport in available_transports + + transport = DatastreamClient.get_transport_class("grpc") + assert transport == transports.DatastreamGrpcTransport + + +@pytest.mark.parametrize("client_class,transport_class,transport_name", [ + (DatastreamClient, transports.DatastreamGrpcTransport, "grpc"), + (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio"), +]) +@mock.patch.object(DatastreamClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DatastreamClient)) +@mock.patch.object(DatastreamAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DatastreamAsyncClient)) +def test_datastream_client_client_options(client_class, transport_class, transport_name): + # Check that if channel is provided we won't create a new one. + with mock.patch.object(DatastreamClient, 'get_transport_class') as gtc: + transport = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ) + client = client_class(transport=transport) + gtc.assert_not_called() + + # Check that if channel is provided via str we will create a new one. + with mock.patch.object(DatastreamClient, 'get_transport_class') as gtc: + client = client_class(transport=transport_name) + gtc.assert_called() + + # Check the case api_endpoint is provided. + options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(transport=transport_name, client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is + # "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is + # "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has + # unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): + with pytest.raises(MutualTLSChannelError): + client = client_class(transport=transport_name) + + # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}): + with pytest.raises(ValueError): + client = client_class(transport=transport_name) + + # Check the case quota_project_id is provided + options = client_options.ClientOptions(quota_project_id="octopus") + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id="octopus", + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + # Check the case api_endpoint is provided + options = client_options.ClientOptions(api_audience="https://language.googleapis.com") + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience="https://language.googleapis.com" + ) + +@pytest.mark.parametrize("client_class,transport_class,transport_name,use_client_cert_env", [ + (DatastreamClient, transports.DatastreamGrpcTransport, "grpc", "true"), + (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio", "true"), + (DatastreamClient, transports.DatastreamGrpcTransport, "grpc", "false"), + (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio", "false"), +]) +@mock.patch.object(DatastreamClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DatastreamClient)) +@mock.patch.object(DatastreamAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DatastreamAsyncClient)) +@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) +def test_datastream_client_mtls_env_auto(client_class, transport_class, transport_name, use_client_cert_env): + # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default + # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. + + # Check the case client_cert_source is provided. Whether client cert is used depends on + # GOOGLE_API_USE_CLIENT_CERTIFICATE value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): + options = client_options.ClientOptions(client_cert_source=client_cert_source_callback) + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT + + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case ADC client cert is provided. Whether client cert is used depends on + # GOOGLE_API_USE_CLIENT_CERTIFICATE value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): + with mock.patch.object(transport_class, '__init__') as patched: + with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): + with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=client_cert_source_callback): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback + + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): + with mock.patch.object(transport_class, '__init__') as patched: + with mock.patch("google.auth.transport.mtls.has_default_client_cert_source", return_value=False): + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + +@pytest.mark.parametrize("client_class", [ + DatastreamClient, DatastreamAsyncClient +]) +@mock.patch.object(DatastreamClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DatastreamClient)) +@mock.patch.object(DatastreamAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DatastreamAsyncClient)) +def test_datastream_client_get_mtls_endpoint_and_cert_source(client_class): + mock_client_cert_source = mock.Mock() + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + mock_api_endpoint = "foo" + options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) + assert api_endpoint == mock_api_endpoint + assert cert_source == mock_client_cert_source + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): + mock_client_cert_source = mock.Mock() + mock_api_endpoint = "foo" + options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) + assert api_endpoint == mock_api_endpoint + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=False): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): + with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=mock_client_cert_source): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source == mock_client_cert_source + + +@pytest.mark.parametrize("client_class,transport_class,transport_name", [ + (DatastreamClient, transports.DatastreamGrpcTransport, "grpc"), + (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio"), +]) +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"], + ) + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=["1", "2"], + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + +@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ + (DatastreamClient, transports.DatastreamGrpcTransport, "grpc", grpc_helpers), + (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), +]) +def test_datastream_client_client_options_credentials_file(client_class, transport_class, transport_name, grpc_helpers): + # Check the case credentials file is provided. + options = client_options.ClientOptions( + credentials_file="credentials.json" + ) + + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + +def test_datastream_client_client_options_from_dict(): + with mock.patch('google.cloud.datastream_v1alpha1.services.datastream.transports.DatastreamGrpcTransport.__init__') as grpc_transport: + grpc_transport.return_value = None + client = DatastreamClient( + client_options={'api_endpoint': 'squid.clam.whelk'} + ) + grpc_transport.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + +@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ + (DatastreamClient, transports.DatastreamGrpcTransport, "grpc", grpc_helpers), + (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), +]) +def test_datastream_client_create_channel_credentials_file(client_class, transport_class, transport_name, grpc_helpers): + # Check the case credentials file is provided. + options = client_options.ClientOptions( + credentials_file="credentials.json" + ) + + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # test that the credentials from file are saved and used as the credentials. + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel" + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() + load_creds.return_value = (file_creds, None) + adc.return_value = (creds, None) + client = client_class(client_options=options, transport=transport_name) + create_channel.assert_called_with( + "datastream.googleapis.com:443", + credentials=file_creds, + credentials_file=None, + quota_project_id=None, + default_scopes=( + 'https://www.googleapis.com/auth/cloud-platform', +), + scopes=None, + default_host="datastream.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize("request_type", [ + datastream.ListConnectionProfilesRequest, + dict, +]) +def test_list_connection_profiles(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_connection_profiles), + '__call__') 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'], + ) + response = client.list_connection_profiles(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListConnectionProfilesRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListConnectionProfilesPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_connection_profiles), + '__call__') as call: + client.list_connection_profiles() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListConnectionProfilesRequest() + +@pytest.mark.asyncio +async def test_list_connection_profiles_async(transport: str = 'grpc_asyncio', request_type=datastream.ListConnectionProfilesRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_connection_profiles), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListConnectionProfilesResponse( + next_page_token='next_page_token_value', + unreachable=['unreachable_value'], + )) + response = await client.list_connection_profiles(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListConnectionProfilesRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListConnectionProfilesAsyncPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +@pytest.mark.asyncio +async def test_list_connection_profiles_async_from_dict(): + await test_list_connection_profiles_async(request_type=dict) + + +def test_list_connection_profiles_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_connection_profiles), + '__call__') as call: + call.return_value = datastream.ListConnectionProfilesResponse() + client.list_connection_profiles(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_connection_profiles), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListConnectionProfilesResponse()) + await client.list_connection_profiles(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_connection_profiles_flattened(): + 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_connection_profiles), + '__call__') as call: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_connection_profiles_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_list_connection_profiles_flattened_async(): + 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_connection_profiles), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream.ListConnectionProfilesResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListConnectionProfilesResponse()) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_connection_profiles_flattened_error_async(): + 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', + ) + + +def test_list_connection_profiles_pager(transport_name: str = "grpc"): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_connection_profiles), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListConnectionProfilesResponse( + connection_profiles=[ + datastream_resources.ConnectionProfile(), + datastream_resources.ConnectionProfile(), + datastream_resources.ConnectionProfile(), + ], + next_page_token='abc', + ), + datastream.ListConnectionProfilesResponse( + connection_profiles=[], + next_page_token='def', + ), + datastream.ListConnectionProfilesResponse( + connection_profiles=[ + datastream_resources.ConnectionProfile(), + ], + next_page_token='ghi', + ), + datastream.ListConnectionProfilesResponse( + connection_profiles=[ + datastream_resources.ConnectionProfile(), + datastream_resources.ConnectionProfile(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_connection_profiles(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, datastream_resources.ConnectionProfile) + for i in results) +def test_list_connection_profiles_pages(transport_name: str = "grpc"): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_connection_profiles), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListConnectionProfilesResponse( + connection_profiles=[ + datastream_resources.ConnectionProfile(), + datastream_resources.ConnectionProfile(), + datastream_resources.ConnectionProfile(), + ], + next_page_token='abc', + ), + datastream.ListConnectionProfilesResponse( + connection_profiles=[], + next_page_token='def', + ), + datastream.ListConnectionProfilesResponse( + connection_profiles=[ + datastream_resources.ConnectionProfile(), + ], + next_page_token='ghi', + ), + datastream.ListConnectionProfilesResponse( + connection_profiles=[ + datastream_resources.ConnectionProfile(), + datastream_resources.ConnectionProfile(), + ], + ), + RuntimeError, + ) + pages = list(client.list_connection_profiles(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_connection_profiles_async_pager(): + 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_connection_profiles), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListConnectionProfilesResponse( + connection_profiles=[ + datastream_resources.ConnectionProfile(), + datastream_resources.ConnectionProfile(), + datastream_resources.ConnectionProfile(), + ], + next_page_token='abc', + ), + datastream.ListConnectionProfilesResponse( + connection_profiles=[], + next_page_token='def', + ), + datastream.ListConnectionProfilesResponse( + connection_profiles=[ + datastream_resources.ConnectionProfile(), + ], + next_page_token='ghi', + ), + datastream.ListConnectionProfilesResponse( + connection_profiles=[ + datastream_resources.ConnectionProfile(), + datastream_resources.ConnectionProfile(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_connection_profiles(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, datastream_resources.ConnectionProfile) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_connection_profiles_async_pages(): + 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_connection_profiles), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListConnectionProfilesResponse( + connection_profiles=[ + datastream_resources.ConnectionProfile(), + datastream_resources.ConnectionProfile(), + datastream_resources.ConnectionProfile(), + ], + next_page_token='abc', + ), + datastream.ListConnectionProfilesResponse( + connection_profiles=[], + next_page_token='def', + ), + datastream.ListConnectionProfilesResponse( + connection_profiles=[ + datastream_resources.ConnectionProfile(), + ], + next_page_token='ghi', + ), + datastream.ListConnectionProfilesResponse( + connection_profiles=[ + datastream_resources.ConnectionProfile(), + datastream_resources.ConnectionProfile(), + ], + ), + RuntimeError, + ) + 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, +]) +def test_get_connection_profile(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream_resources.ConnectionProfile( + name='name_value', + display_name='display_name_value', + oracle_profile=datastream_resources.OracleProfile(hostname='hostname_value'), + no_connectivity=None, + ) + response = client.get_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetConnectionProfileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream_resources.ConnectionProfile) + assert response.name == 'name_value' + assert response.display_name == 'display_name_value' + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_connection_profile), + '__call__') as call: + client.get_connection_profile() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetConnectionProfileRequest() + +@pytest.mark.asyncio +async def test_get_connection_profile_async(transport: str = 'grpc_asyncio', request_type=datastream.GetConnectionProfileRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_connection_profile), + '__call__') as call: + # 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', + )) + response = await client.get_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetConnectionProfileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream_resources.ConnectionProfile) + assert response.name == 'name_value' + assert response.display_name == 'display_name_value' + + +@pytest.mark.asyncio +async def test_get_connection_profile_async_from_dict(): + await test_get_connection_profile_async(request_type=dict) + + +def test_get_connection_profile_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_connection_profile), + '__call__') as call: + call.return_value = datastream_resources.ConnectionProfile() + client.get_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_connection_profile), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.ConnectionProfile()) + await client.get_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_connection_profile_flattened(): + 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_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_connection_profile_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_get_connection_profile_flattened_async(): + 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_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream_resources.ConnectionProfile() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.ConnectionProfile()) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_connection_profile_flattened_error_async(): + 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', + ) + + +@pytest.mark.parametrize("request_type", [ + datastream.CreateConnectionProfileRequest, + dict, +]) +def test_create_connection_profile(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.create_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.CreateConnectionProfileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_connection_profile), + '__call__') as call: + client.create_connection_profile() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.CreateConnectionProfileRequest() + +@pytest.mark.asyncio +async def test_create_connection_profile_async(transport: str = 'grpc_asyncio', request_type=datastream.CreateConnectionProfileRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.create_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.CreateConnectionProfileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_create_connection_profile_async_from_dict(): + await test_create_connection_profile_async(request_type=dict) + + +def test_create_connection_profile_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_connection_profile), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.create_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_connection_profile), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.create_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_create_connection_profile_flattened(): + 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_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + 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.create_connection_profile( + parent='parent_value', + connection_profile=datastream_resources.ConnectionProfile(name='name_value'), + connection_profile_id='connection_profile_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].connection_profile + mock_val = datastream_resources.ConnectionProfile(name='name_value') + assert arg == mock_val + arg = args[0].connection_profile_id + mock_val = 'connection_profile_id_value' + assert arg == mock_val + + +def test_create_connection_profile_flattened_error(): + 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.create_connection_profile( + datastream.CreateConnectionProfileRequest(), + parent='parent_value', + connection_profile=datastream_resources.ConnectionProfile(name='name_value'), + connection_profile_id='connection_profile_id_value', + ) + +@pytest.mark.asyncio +async def test_create_connection_profile_flattened_async(): + 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_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_connection_profile( + parent='parent_value', + connection_profile=datastream_resources.ConnectionProfile(name='name_value'), + connection_profile_id='connection_profile_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].connection_profile + mock_val = datastream_resources.ConnectionProfile(name='name_value') + assert arg == mock_val + arg = args[0].connection_profile_id + mock_val = 'connection_profile_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_create_connection_profile_flattened_error_async(): + 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.create_connection_profile( + datastream.CreateConnectionProfileRequest(), + parent='parent_value', + connection_profile=datastream_resources.ConnectionProfile(name='name_value'), + connection_profile_id='connection_profile_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + datastream.UpdateConnectionProfileRequest, + dict, +]) +def test_update_connection_profile(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.update_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.UpdateConnectionProfileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_connection_profile), + '__call__') as call: + client.update_connection_profile() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.UpdateConnectionProfileRequest() + +@pytest.mark.asyncio +async def test_update_connection_profile_async(transport: str = 'grpc_asyncio', request_type=datastream.UpdateConnectionProfileRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.update_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.UpdateConnectionProfileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_update_connection_profile_async_from_dict(): + await test_update_connection_profile_async(request_type=dict) + + +def test_update_connection_profile_field_headers(): + 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 = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_connection_profile), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.update_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + '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(), + ) + + # 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 = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_connection_profile), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.update_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'connection_profile.name=name_value', + ) in kw['metadata'] + + +def test_update_connection_profile_flattened(): + 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_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + 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.update_connection_profile( + connection_profile=datastream_resources.ConnectionProfile(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].connection_profile + mock_val = datastream_resources.ConnectionProfile(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + + +def test_update_connection_profile_flattened_error(): + 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.update_connection_profile( + datastream.UpdateConnectionProfileRequest(), + connection_profile=datastream_resources.ConnectionProfile(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + +@pytest.mark.asyncio +async def test_update_connection_profile_flattened_async(): + 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_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_connection_profile( + connection_profile=datastream_resources.ConnectionProfile(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].connection_profile + mock_val = datastream_resources.ConnectionProfile(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + +@pytest.mark.asyncio +async def test_update_connection_profile_flattened_error_async(): + 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.update_connection_profile( + datastream.UpdateConnectionProfileRequest(), + connection_profile=datastream_resources.ConnectionProfile(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + +@pytest.mark.parametrize("request_type", [ + datastream.DeleteConnectionProfileRequest, + dict, +]) +def test_delete_connection_profile(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.delete_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DeleteConnectionProfileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_connection_profile), + '__call__') as call: + client.delete_connection_profile() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DeleteConnectionProfileRequest() + +@pytest.mark.asyncio +async def test_delete_connection_profile_async(transport: str = 'grpc_asyncio', request_type=datastream.DeleteConnectionProfileRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.delete_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DeleteConnectionProfileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_delete_connection_profile_async_from_dict(): + await test_delete_connection_profile_async(request_type=dict) + + +def test_delete_connection_profile_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_connection_profile), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.delete_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_connection_profile), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.delete_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_delete_connection_profile_flattened(): + 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_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_delete_connection_profile_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_delete_connection_profile_flattened_async(): + 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_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_delete_connection_profile_flattened_error_async(): + 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', + ) + + +@pytest.mark.parametrize("request_type", [ + datastream.DiscoverConnectionProfileRequest, + dict, +]) +def test_discover_connection_profile(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.discover_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream.DiscoverConnectionProfileResponse( + oracle_rdbms=datastream_resources.OracleRdbms(oracle_schemas=[datastream_resources.OracleSchema(schema_name='schema_name_value')]), + ) + response = client.discover_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DiscoverConnectionProfileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream.DiscoverConnectionProfileResponse) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.discover_connection_profile), + '__call__') as call: + client.discover_connection_profile() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DiscoverConnectionProfileRequest() + +@pytest.mark.asyncio +async def test_discover_connection_profile_async(transport: str = 'grpc_asyncio', request_type=datastream.DiscoverConnectionProfileRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.discover_connection_profile), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.DiscoverConnectionProfileResponse( + )) + response = await client.discover_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DiscoverConnectionProfileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream.DiscoverConnectionProfileResponse) + + +@pytest.mark.asyncio +async def test_discover_connection_profile_async_from_dict(): + await test_discover_connection_profile_async(request_type=dict) + + +def test_discover_connection_profile_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.discover_connection_profile), + '__call__') as call: + call.return_value = datastream.DiscoverConnectionProfileResponse() + client.discover_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.discover_connection_profile), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.DiscoverConnectionProfileResponse()) + await client.discover_connection_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@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, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + 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'], + ) + response = client.list_streams(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListStreamsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListStreamsPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_streams), + '__call__') as call: + client.list_streams() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListStreamsRequest() + +@pytest.mark.asyncio +async def test_list_streams_async(transport: str = 'grpc_asyncio', request_type=datastream.ListStreamsRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_streams), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListStreamsResponse( + next_page_token='next_page_token_value', + unreachable=['unreachable_value'], + )) + response = await client.list_streams(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListStreamsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListStreamsAsyncPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +@pytest.mark.asyncio +async def test_list_streams_async_from_dict(): + await test_list_streams_async(request_type=dict) + + +def test_list_streams_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_streams), + '__call__') as call: + call.return_value = datastream.ListStreamsResponse() + client.list_streams(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_streams), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListStreamsResponse()) + await client.list_streams(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_streams_flattened(): + 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: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_streams_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_list_streams_flattened_async(): + 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: + # Designate an appropriate return value for the call. + call.return_value = datastream.ListStreamsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListStreamsResponse()) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_streams_flattened_error_async(): + 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', + ) + + +def test_list_streams_pager(transport_name: str = "grpc"): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_streams), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListStreamsResponse( + streams=[ + datastream_resources.Stream(), + datastream_resources.Stream(), + datastream_resources.Stream(), + ], + next_page_token='abc', + ), + datastream.ListStreamsResponse( + streams=[], + next_page_token='def', + ), + datastream.ListStreamsResponse( + streams=[ + datastream_resources.Stream(), + ], + next_page_token='ghi', + ), + datastream.ListStreamsResponse( + streams=[ + datastream_resources.Stream(), + datastream_resources.Stream(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_streams(request={}) + + assert pager._metadata == metadata + + 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, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_streams), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListStreamsResponse( + streams=[ + datastream_resources.Stream(), + datastream_resources.Stream(), + datastream_resources.Stream(), + ], + next_page_token='abc', + ), + datastream.ListStreamsResponse( + streams=[], + next_page_token='def', + ), + datastream.ListStreamsResponse( + streams=[ + datastream_resources.Stream(), + ], + next_page_token='ghi', + ), + datastream.ListStreamsResponse( + streams=[ + datastream_resources.Stream(), + datastream_resources.Stream(), + ], + ), + RuntimeError, + ) + pages = list(client.list_streams(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_streams_async_pager(): + 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__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListStreamsResponse( + streams=[ + datastream_resources.Stream(), + datastream_resources.Stream(), + datastream_resources.Stream(), + ], + next_page_token='abc', + ), + datastream.ListStreamsResponse( + streams=[], + next_page_token='def', + ), + datastream.ListStreamsResponse( + 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={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, datastream_resources.Stream) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_streams_async_pages(): + 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__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListStreamsResponse( + streams=[ + datastream_resources.Stream(), + datastream_resources.Stream(), + datastream_resources.Stream(), + ], + next_page_token='abc', + ), + datastream.ListStreamsResponse( + streams=[], + next_page_token='def', + ), + datastream.ListStreamsResponse( + 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: # 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, +]) +def test_get_stream(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_stream), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream_resources.Stream( + name='name_value', + display_name='display_name_value', + state=datastream_resources.Stream.State.CREATED, + backfill_all=datastream_resources.Stream.BackfillAllStrategy(oracle_excluded_objects=datastream_resources.OracleRdbms(oracle_schemas=[datastream_resources.OracleSchema(schema_name='schema_name_value')])), + ) + response = client.get_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetStreamRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream_resources.Stream) + assert response.name == 'name_value' + assert response.display_name == 'display_name_value' + assert response.state == datastream_resources.Stream.State.CREATED + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_stream), + '__call__') as call: + client.get_stream() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetStreamRequest() + +@pytest.mark.asyncio +async def test_get_stream_async(transport: str = 'grpc_asyncio', request_type=datastream.GetStreamRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_stream), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.Stream( + name='name_value', + display_name='display_name_value', + state=datastream_resources.Stream.State.CREATED, + )) + response = await client.get_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetStreamRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream_resources.Stream) + assert response.name == 'name_value' + assert response.display_name == 'display_name_value' + assert response.state == datastream_resources.Stream.State.CREATED + + +@pytest.mark.asyncio +async def test_get_stream_async_from_dict(): + await test_get_stream_async(request_type=dict) + + +def test_get_stream_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_stream), + '__call__') as call: + call.return_value = datastream_resources.Stream() + client.get_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_stream), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.Stream()) + await client.get_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_stream_flattened(): + 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: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_stream_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_get_stream_flattened_async(): + 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: + # Designate an appropriate return value for the call. + call.return_value = datastream_resources.Stream() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.Stream()) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_stream_flattened_error_async(): + 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', + ) + + +@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, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_stream), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.create_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.CreateStreamRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_stream), + '__call__') as call: + client.create_stream() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.CreateStreamRequest() + +@pytest.mark.asyncio +async def test_create_stream_async(transport: str = 'grpc_asyncio', request_type=datastream.CreateStreamRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_stream), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.create_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.CreateStreamRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_create_stream_async_from_dict(): + await test_create_stream_async(request_type=dict) + + +def test_create_stream_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_stream), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.create_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_stream), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.create_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_create_stream_flattened(): + 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: + # Designate an appropriate return value for the call. + 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.create_stream( + parent='parent_value', + stream=datastream_resources.Stream(name='name_value'), + stream_id='stream_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].stream + mock_val = datastream_resources.Stream(name='name_value') + assert arg == mock_val + arg = args[0].stream_id + mock_val = 'stream_id_value' + assert arg == mock_val + + +def test_create_stream_flattened_error(): + 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.create_stream( + datastream.CreateStreamRequest(), + parent='parent_value', + stream=datastream_resources.Stream(name='name_value'), + stream_id='stream_id_value', + ) + +@pytest.mark.asyncio +async def test_create_stream_flattened_async(): + 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: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_stream( + parent='parent_value', + stream=datastream_resources.Stream(name='name_value'), + stream_id='stream_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].stream + mock_val = datastream_resources.Stream(name='name_value') + assert arg == mock_val + arg = args[0].stream_id + mock_val = 'stream_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_create_stream_flattened_error_async(): + 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.create_stream( + datastream.CreateStreamRequest(), + parent='parent_value', + stream=datastream_resources.Stream(name='name_value'), + stream_id='stream_id_value', + ) + + +@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, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_stream), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.update_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.UpdateStreamRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_stream), + '__call__') as call: + client.update_stream() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.UpdateStreamRequest() + +@pytest.mark.asyncio +async def test_update_stream_async(transport: str = 'grpc_asyncio', request_type=datastream.UpdateStreamRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_stream), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.update_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.UpdateStreamRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_update_stream_async_from_dict(): + await test_update_stream_async(request_type=dict) + + +def test_update_stream_field_headers(): + 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 = '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: + call.return_value = operations_pb2.Operation(name='operations/op') + client.update_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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 = '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: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.update_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'stream.name=name_value', + ) in kw['metadata'] + + +def test_update_stream_flattened(): + 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: + # Designate an appropriate return value for the call. + 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.update_stream( + stream=datastream_resources.Stream(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].stream + mock_val = datastream_resources.Stream(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + + +def test_update_stream_flattened_error(): + 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.update_stream( + datastream.UpdateStreamRequest(), + stream=datastream_resources.Stream(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + +@pytest.mark.asyncio +async def test_update_stream_flattened_async(): + 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: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_stream( + stream=datastream_resources.Stream(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].stream + mock_val = datastream_resources.Stream(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + +@pytest.mark.asyncio +async def test_update_stream_flattened_error_async(): + 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.update_stream( + datastream.UpdateStreamRequest(), + stream=datastream_resources.Stream(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + +@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, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_stream), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.delete_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DeleteStreamRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_stream), + '__call__') as call: + client.delete_stream() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DeleteStreamRequest() + +@pytest.mark.asyncio +async def test_delete_stream_async(transport: str = 'grpc_asyncio', request_type=datastream.DeleteStreamRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_stream), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.delete_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DeleteStreamRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_delete_stream_async_from_dict(): + await test_delete_stream_async(request_type=dict) + + +def test_delete_stream_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_stream), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.delete_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_stream), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.delete_stream(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_delete_stream_flattened(): + 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: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_delete_stream_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_delete_stream_flattened_async(): + 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: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_delete_stream_flattened_error_async(): + 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', + ) + + +@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, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_errors), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.fetch_errors(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.FetchErrorsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_errors), + '__call__') as call: + client.fetch_errors() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.FetchErrorsRequest() + +@pytest.mark.asyncio +async def test_fetch_errors_async(transport: str = 'grpc_asyncio', request_type=datastream.FetchErrorsRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_errors), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.fetch_errors(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.FetchErrorsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_fetch_errors_async_from_dict(): + await test_fetch_errors_async(request_type=dict) + + +def test_fetch_errors_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_errors), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.fetch_errors(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_errors), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.fetch_errors(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'stream=stream_value', + ) in kw['metadata'] + + +@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, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # 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: + # 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', + ) + response = client.fetch_static_ips(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.FetchStaticIpsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.FetchStaticIpsPager) + assert response.static_ips == ['static_ips_value'] + assert response.next_page_token == 'next_page_token_value' + + +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', + ) + + # 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: + client.fetch_static_ips() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.FetchStaticIpsRequest() + +@pytest.mark.asyncio +async def test_fetch_static_ips_async(transport: str = 'grpc_asyncio', request_type=datastream.FetchStaticIpsRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # 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: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.FetchStaticIpsResponse( + static_ips=['static_ips_value'], + next_page_token='next_page_token_value', + )) + response = await client.fetch_static_ips(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.FetchStaticIpsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.FetchStaticIpsAsyncPager) + assert response.static_ips == ['static_ips_value'] + assert response.next_page_token == 'next_page_token_value' + + +@pytest.mark.asyncio +async def test_fetch_static_ips_async_from_dict(): + await test_fetch_static_ips_async(request_type=dict) + + +def test_fetch_static_ips_field_headers(): + 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' + + # 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: + call.return_value = datastream.FetchStaticIpsResponse() + client.fetch_static_ips(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # 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: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.FetchStaticIpsResponse()) + await client.fetch_static_ips(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_fetch_static_ips_flattened(): + 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: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_fetch_static_ips_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_fetch_static_ips_flattened_async(): + 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: + # Designate an appropriate return value for the call. + call.return_value = datastream.FetchStaticIpsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.FetchStaticIpsResponse()) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_fetch_static_ips_flattened_error_async(): + 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', + ) + + +def test_fetch_static_ips_pager(transport_name: str = "grpc"): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # 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: + # Set the response to a series of pages. + call.side_effect = ( + datastream.FetchStaticIpsResponse( + 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=[ + str(), + str(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('name', ''), + )), + ) + pager = client.fetch_static_ips(request={}) + + assert pager._metadata == metadata + + 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, + ) + + # 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: + # Set the response to a series of pages. + call.side_effect = ( + datastream.FetchStaticIpsResponse( + 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=[ + str(), + str(), + ], + ), + RuntimeError, + ) + pages = list(client.fetch_static_ips(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_fetch_static_ips_async_pager(): + 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__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.FetchStaticIpsResponse( + 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=[ + str(), + str(), + ], + ), + RuntimeError, + ) + async_pager = await client.fetch_static_ips(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, str) + for i in responses) + + +@pytest.mark.asyncio +async def test_fetch_static_ips_async_pages(): + 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__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.FetchStaticIpsResponse( + 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=[ + str(), + str(), + ], + ), + RuntimeError, + ) + 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, +]) +def test_create_private_connection(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_private_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.create_private_connection(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.CreatePrivateConnectionRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_private_connection), + '__call__') as call: + client.create_private_connection() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.CreatePrivateConnectionRequest() + +@pytest.mark.asyncio +async def test_create_private_connection_async(transport: str = 'grpc_asyncio', request_type=datastream.CreatePrivateConnectionRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_private_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.create_private_connection(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.CreatePrivateConnectionRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_create_private_connection_async_from_dict(): + await test_create_private_connection_async(request_type=dict) + + +def test_create_private_connection_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_private_connection), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.create_private_connection(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_private_connection), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.create_private_connection(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_create_private_connection_flattened(): + 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_private_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + 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.create_private_connection( + parent='parent_value', + private_connection=datastream_resources.PrivateConnection(name='name_value'), + private_connection_id='private_connection_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].private_connection + mock_val = datastream_resources.PrivateConnection(name='name_value') + assert arg == mock_val + arg = args[0].private_connection_id + mock_val = 'private_connection_id_value' + assert arg == mock_val + + +def test_create_private_connection_flattened_error(): + 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.create_private_connection( + datastream.CreatePrivateConnectionRequest(), + parent='parent_value', + private_connection=datastream_resources.PrivateConnection(name='name_value'), + private_connection_id='private_connection_id_value', + ) + +@pytest.mark.asyncio +async def test_create_private_connection_flattened_async(): + 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_private_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_private_connection( + parent='parent_value', + private_connection=datastream_resources.PrivateConnection(name='name_value'), + private_connection_id='private_connection_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].private_connection + mock_val = datastream_resources.PrivateConnection(name='name_value') + assert arg == mock_val + arg = args[0].private_connection_id + mock_val = 'private_connection_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_create_private_connection_flattened_error_async(): + 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.create_private_connection( + datastream.CreatePrivateConnectionRequest(), + parent='parent_value', + private_connection=datastream_resources.PrivateConnection(name='name_value'), + private_connection_id='private_connection_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + datastream.GetPrivateConnectionRequest, + dict, +]) +def test_get_private_connection(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_private_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream_resources.PrivateConnection( + name='name_value', + display_name='display_name_value', + state=datastream_resources.PrivateConnection.State.CREATING, + ) + response = client.get_private_connection(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetPrivateConnectionRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream_resources.PrivateConnection) + assert response.name == 'name_value' + assert response.display_name == 'display_name_value' + assert response.state == datastream_resources.PrivateConnection.State.CREATING + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_private_connection), + '__call__') as call: + client.get_private_connection() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetPrivateConnectionRequest() + +@pytest.mark.asyncio +async def test_get_private_connection_async(transport: str = 'grpc_asyncio', request_type=datastream.GetPrivateConnectionRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_private_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.PrivateConnection( + name='name_value', + display_name='display_name_value', + state=datastream_resources.PrivateConnection.State.CREATING, + )) + response = await client.get_private_connection(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetPrivateConnectionRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream_resources.PrivateConnection) + assert response.name == 'name_value' + assert response.display_name == 'display_name_value' + assert response.state == datastream_resources.PrivateConnection.State.CREATING + + +@pytest.mark.asyncio +async def test_get_private_connection_async_from_dict(): + await test_get_private_connection_async(request_type=dict) + + +def test_get_private_connection_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_private_connection), + '__call__') as call: + call.return_value = datastream_resources.PrivateConnection() + client.get_private_connection(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_private_connection), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.PrivateConnection()) + await client.get_private_connection(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_private_connection_flattened(): + 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_private_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_private_connection_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_get_private_connection_flattened_async(): + 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_private_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream_resources.PrivateConnection() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.PrivateConnection()) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_private_connection_flattened_error_async(): + 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', + ) + + +@pytest.mark.parametrize("request_type", [ + datastream.ListPrivateConnectionsRequest, + dict, +]) +def test_list_private_connections(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_private_connections), + '__call__') 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'], + ) + response = client.list_private_connections(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListPrivateConnectionsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListPrivateConnectionsPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_private_connections), + '__call__') as call: + client.list_private_connections() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListPrivateConnectionsRequest() + +@pytest.mark.asyncio +async def test_list_private_connections_async(transport: str = 'grpc_asyncio', request_type=datastream.ListPrivateConnectionsRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_private_connections), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListPrivateConnectionsResponse( + next_page_token='next_page_token_value', + unreachable=['unreachable_value'], + )) + response = await client.list_private_connections(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListPrivateConnectionsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListPrivateConnectionsAsyncPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +@pytest.mark.asyncio +async def test_list_private_connections_async_from_dict(): + await test_list_private_connections_async(request_type=dict) + + +def test_list_private_connections_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_private_connections), + '__call__') as call: + call.return_value = datastream.ListPrivateConnectionsResponse() + client.list_private_connections(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_private_connections), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListPrivateConnectionsResponse()) + await client.list_private_connections(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_private_connections_flattened(): + 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_private_connections), + '__call__') as call: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_private_connections_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_list_private_connections_flattened_async(): + 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_private_connections), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream.ListPrivateConnectionsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListPrivateConnectionsResponse()) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_private_connections_flattened_error_async(): + 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', + ) + + +def test_list_private_connections_pager(transport_name: str = "grpc"): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_private_connections), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListPrivateConnectionsResponse( + private_connections=[ + datastream_resources.PrivateConnection(), + datastream_resources.PrivateConnection(), + datastream_resources.PrivateConnection(), + ], + next_page_token='abc', + ), + datastream.ListPrivateConnectionsResponse( + private_connections=[], + next_page_token='def', + ), + datastream.ListPrivateConnectionsResponse( + private_connections=[ + datastream_resources.PrivateConnection(), + ], + next_page_token='ghi', + ), + datastream.ListPrivateConnectionsResponse( + private_connections=[ + datastream_resources.PrivateConnection(), + datastream_resources.PrivateConnection(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_private_connections(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, datastream_resources.PrivateConnection) + for i in results) +def test_list_private_connections_pages(transport_name: str = "grpc"): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_private_connections), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListPrivateConnectionsResponse( + private_connections=[ + datastream_resources.PrivateConnection(), + datastream_resources.PrivateConnection(), + datastream_resources.PrivateConnection(), + ], + next_page_token='abc', + ), + datastream.ListPrivateConnectionsResponse( + private_connections=[], + next_page_token='def', + ), + datastream.ListPrivateConnectionsResponse( + private_connections=[ + datastream_resources.PrivateConnection(), + ], + next_page_token='ghi', + ), + datastream.ListPrivateConnectionsResponse( + private_connections=[ + datastream_resources.PrivateConnection(), + datastream_resources.PrivateConnection(), + ], + ), + RuntimeError, + ) + pages = list(client.list_private_connections(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_private_connections_async_pager(): + 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_private_connections), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListPrivateConnectionsResponse( + private_connections=[ + datastream_resources.PrivateConnection(), + datastream_resources.PrivateConnection(), + datastream_resources.PrivateConnection(), + ], + next_page_token='abc', + ), + datastream.ListPrivateConnectionsResponse( + private_connections=[], + next_page_token='def', + ), + datastream.ListPrivateConnectionsResponse( + private_connections=[ + datastream_resources.PrivateConnection(), + ], + next_page_token='ghi', + ), + datastream.ListPrivateConnectionsResponse( + private_connections=[ + datastream_resources.PrivateConnection(), + datastream_resources.PrivateConnection(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_private_connections(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, datastream_resources.PrivateConnection) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_private_connections_async_pages(): + 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_private_connections), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListPrivateConnectionsResponse( + private_connections=[ + datastream_resources.PrivateConnection(), + datastream_resources.PrivateConnection(), + datastream_resources.PrivateConnection(), + ], + next_page_token='abc', + ), + datastream.ListPrivateConnectionsResponse( + private_connections=[], + next_page_token='def', + ), + datastream.ListPrivateConnectionsResponse( + private_connections=[ + datastream_resources.PrivateConnection(), + ], + next_page_token='ghi', + ), + datastream.ListPrivateConnectionsResponse( + private_connections=[ + datastream_resources.PrivateConnection(), + datastream_resources.PrivateConnection(), + ], + ), + RuntimeError, + ) + 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, +]) +def test_delete_private_connection(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_private_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.delete_private_connection(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DeletePrivateConnectionRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_private_connection), + '__call__') as call: + client.delete_private_connection() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DeletePrivateConnectionRequest() + +@pytest.mark.asyncio +async def test_delete_private_connection_async(transport: str = 'grpc_asyncio', request_type=datastream.DeletePrivateConnectionRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_private_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.delete_private_connection(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DeletePrivateConnectionRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_delete_private_connection_async_from_dict(): + await test_delete_private_connection_async(request_type=dict) + + +def test_delete_private_connection_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_private_connection), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.delete_private_connection(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_private_connection), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.delete_private_connection(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_delete_private_connection_flattened(): + 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_private_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_delete_private_connection_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_delete_private_connection_flattened_async(): + 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_private_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_delete_private_connection_flattened_error_async(): + 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', + ) + + +@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, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_route), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.create_route(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.CreateRouteRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_route), + '__call__') as call: + client.create_route() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.CreateRouteRequest() + +@pytest.mark.asyncio +async def test_create_route_async(transport: str = 'grpc_asyncio', request_type=datastream.CreateRouteRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_route), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.create_route(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.CreateRouteRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_create_route_async_from_dict(): + await test_create_route_async(request_type=dict) + + +def test_create_route_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_route), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.create_route(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_route), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.create_route(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_create_route_flattened(): + 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: + # Designate an appropriate return value for the call. + 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.create_route( + parent='parent_value', + route=datastream_resources.Route(name='name_value'), + route_id='route_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].route + mock_val = datastream_resources.Route(name='name_value') + assert arg == mock_val + arg = args[0].route_id + mock_val = 'route_id_value' + assert arg == mock_val + + +def test_create_route_flattened_error(): + 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.create_route( + datastream.CreateRouteRequest(), + parent='parent_value', + route=datastream_resources.Route(name='name_value'), + route_id='route_id_value', + ) + +@pytest.mark.asyncio +async def test_create_route_flattened_async(): + 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: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_route( + parent='parent_value', + route=datastream_resources.Route(name='name_value'), + route_id='route_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].route + mock_val = datastream_resources.Route(name='name_value') + assert arg == mock_val + arg = args[0].route_id + mock_val = 'route_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_create_route_flattened_error_async(): + 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.create_route( + datastream.CreateRouteRequest(), + parent='parent_value', + route=datastream_resources.Route(name='name_value'), + route_id='route_id_value', + ) + + +@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, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_route), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = datastream_resources.Route( + name='name_value', + display_name='display_name_value', + destination_address='destination_address_value', + destination_port=1734, + ) + response = client.get_route(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetRouteRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream_resources.Route) + assert response.name == 'name_value' + assert response.display_name == 'display_name_value' + assert response.destination_address == 'destination_address_value' + assert response.destination_port == 1734 + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_route), + '__call__') as call: + client.get_route() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetRouteRequest() + +@pytest.mark.asyncio +async def test_get_route_async(transport: str = 'grpc_asyncio', request_type=datastream.GetRouteRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_route), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.Route( + name='name_value', + display_name='display_name_value', + destination_address='destination_address_value', + destination_port=1734, + )) + response = await client.get_route(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.GetRouteRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, datastream_resources.Route) + assert response.name == 'name_value' + assert response.display_name == 'display_name_value' + assert response.destination_address == 'destination_address_value' + assert response.destination_port == 1734 + + +@pytest.mark.asyncio +async def test_get_route_async_from_dict(): + await test_get_route_async(request_type=dict) + + +def test_get_route_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_route), + '__call__') as call: + call.return_value = datastream_resources.Route() + client.get_route(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_route), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.Route()) + await client.get_route(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_route_flattened(): + 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: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_route_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_get_route_flattened_async(): + 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: + # Designate an appropriate return value for the call. + call.return_value = datastream_resources.Route() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.Route()) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_route_flattened_error_async(): + 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', + ) + + +@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, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + 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'], + ) + response = client.list_routes(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListRoutesRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListRoutesPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_routes), + '__call__') as call: + client.list_routes() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListRoutesRequest() + +@pytest.mark.asyncio +async def test_list_routes_async(transport: str = 'grpc_asyncio', request_type=datastream.ListRoutesRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_routes), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListRoutesResponse( + next_page_token='next_page_token_value', + unreachable=['unreachable_value'], + )) + response = await client.list_routes(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.ListRoutesRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListRoutesAsyncPager) + assert response.next_page_token == 'next_page_token_value' + assert response.unreachable == ['unreachable_value'] + + +@pytest.mark.asyncio +async def test_list_routes_async_from_dict(): + await test_list_routes_async(request_type=dict) + + +def test_list_routes_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_routes), + '__call__') as call: + call.return_value = datastream.ListRoutesResponse() + client.list_routes(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_routes), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListRoutesResponse()) + await client.list_routes(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_routes_flattened(): + 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: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_routes_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_list_routes_flattened_async(): + 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: + # Designate an appropriate return value for the call. + call.return_value = datastream.ListRoutesResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListRoutesResponse()) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_routes_flattened_error_async(): + 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', + ) + + +def test_list_routes_pager(transport_name: str = "grpc"): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_routes), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + datastream_resources.Route(), + datastream_resources.Route(), + ], + next_page_token='abc', + ), + datastream.ListRoutesResponse( + routes=[], + next_page_token='def', + ), + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + ], + next_page_token='ghi', + ), + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + datastream_resources.Route(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_routes(request={}) + + assert pager._metadata == metadata + + 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, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_routes), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + datastream_resources.Route(), + datastream_resources.Route(), + ], + next_page_token='abc', + ), + datastream.ListRoutesResponse( + routes=[], + next_page_token='def', + ), + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + ], + next_page_token='ghi', + ), + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + datastream_resources.Route(), + ], + ), + RuntimeError, + ) + pages = list(client.list_routes(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_routes_async_pager(): + 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__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + datastream_resources.Route(), + datastream_resources.Route(), + ], + next_page_token='abc', + ), + datastream.ListRoutesResponse( + routes=[], + next_page_token='def', + ), + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + ], + next_page_token='ghi', + ), + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + datastream_resources.Route(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_routes(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, datastream_resources.Route) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_routes_async_pages(): + 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__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + datastream.ListRoutesResponse( + routes=[ + datastream_resources.Route(), + datastream_resources.Route(), + datastream_resources.Route(), + ], + next_page_token='abc', + ), + datastream.ListRoutesResponse( + routes=[], + next_page_token='def', + ), + datastream.ListRoutesResponse( + 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: # 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, +]) +def test_delete_route(request_type, transport: str = 'grpc'): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_route), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.delete_route(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DeleteRouteRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +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', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_route), + '__call__') as call: + client.delete_route() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DeleteRouteRequest() + +@pytest.mark.asyncio +async def test_delete_route_async(transport: str = 'grpc_asyncio', request_type=datastream.DeleteRouteRequest): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_route), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.delete_route(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == datastream.DeleteRouteRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_delete_route_async_from_dict(): + await test_delete_route_async(request_type=dict) + + +def test_delete_route_field_headers(): + 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_route), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.delete_route(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + 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(), + ) + + # 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' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_route), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.delete_route(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_delete_route_flattened(): + 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: + # Designate an appropriate return value for the call. + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_delete_route_flattened_error(): + 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', + ) + +@pytest.mark.asyncio +async def test_delete_route_flattened_async(): + 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: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_delete_route_flattened_error_async(): + 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', + ) + + +def test_credentials_transport_error(): + # It is an error to provide credentials and a transport instance. + transport = transports.DatastreamGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.DatastreamGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = DatastreamClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide an api_key and a transport instance. + transport = transports.DatastreamGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = DatastreamClient( + client_options=options, + transport=transport, + ) + + # It is an error to provide an api_key and a credential. + options = mock.Mock() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = DatastreamClient( + client_options=options, + credentials=ga_credentials.AnonymousCredentials() + ) + + # It is an error to provide scopes and a transport instance. + transport = transports.DatastreamGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = DatastreamClient( + client_options={"scopes": ["1", "2"]}, + transport=transport, + ) + + +def test_transport_instance(): + # A client may be instantiated with a custom transport instance. + transport = transports.DatastreamGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + client = DatastreamClient(transport=transport) + assert client.transport is transport + +def test_transport_get_channel(): + # A client may be instantiated with a custom transport instance. + transport = transports.DatastreamGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + transport = transports.DatastreamGrpcAsyncIOTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + +@pytest.mark.parametrize("transport_class", [ + transports.DatastreamGrpcTransport, + transports.DatastreamGrpcAsyncIOTransport, +]) +def test_transport_adc(transport_class): + # Test default credentials are used if not provided. + with mock.patch.object(google.auth, 'default') as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + 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, + ) + +def test_datastream_base_transport_error(): + # Passing both a credentials object and credentials_file should raise an error + with pytest.raises(core_exceptions.DuplicateCredentialArgs): + transport = transports.DatastreamTransport( + credentials=ga_credentials.AnonymousCredentials(), + credentials_file="credentials.json" + ) + + +def test_datastream_base_transport(): + # Instantiate the base transport. + with mock.patch('google.cloud.datastream_v1alpha1.services.datastream.transports.DatastreamTransport.__init__') as Transport: + Transport.return_value = None + transport = transports.DatastreamTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Every method on the transport should just blindly + # raise NotImplementedError. + methods = ( + 'list_connection_profiles', + 'get_connection_profile', + 'create_connection_profile', + 'update_connection_profile', + 'delete_connection_profile', + 'discover_connection_profile', + 'list_streams', + 'get_stream', + 'create_stream', + 'update_stream', + 'delete_stream', + 'fetch_errors', + 'fetch_static_ips', + 'create_private_connection', + 'get_private_connection', + 'list_private_connections', + 'delete_private_connection', + 'create_route', + 'get_route', + 'list_routes', + 'delete_route', + ) + for method in methods: + with pytest.raises(NotImplementedError): + getattr(transport, method)(request=object()) + + with pytest.raises(NotImplementedError): + transport.close() + + # Additionally, the LRO client (a property) should + # also raise NotImplementedError + 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 + with mock.patch.object(google.auth, 'load_credentials_from_file', autospec=True) as load_creds, mock.patch('google.cloud.datastream_v1alpha1.services.datastream.transports.DatastreamTransport._prep_wrapped_messages') as Transport: + Transport.return_value = None + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.DatastreamTransport( + credentials_file="credentials.json", + quota_project_id="octopus", + ) + load_creds.assert_called_once_with("credentials.json", + scopes=None, + default_scopes=( + 'https://www.googleapis.com/auth/cloud-platform', +), + quota_project_id="octopus", + ) + + +def test_datastream_base_transport_with_adc(): + # Test the default credentials are used if credentials and credentials_file are None. + with mock.patch.object(google.auth, 'default', autospec=True) as adc, mock.patch('google.cloud.datastream_v1alpha1.services.datastream.transports.DatastreamTransport._prep_wrapped_messages') as Transport: + Transport.return_value = None + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.DatastreamTransport() + adc.assert_called_once() + + +def test_datastream_auth_adc(): + # If no credentials are provided, we should use ADC credentials. + with mock.patch.object(google.auth, 'default', autospec=True) as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + DatastreamClient() + adc.assert_called_once_with( + scopes=None, + default_scopes=( + 'https://www.googleapis.com/auth/cloud-platform', +), + quota_project_id=None, + ) + + +@pytest.mark.parametrize( + "transport_class", + [ + transports.DatastreamGrpcTransport, + transports.DatastreamGrpcAsyncIOTransport, + ], +) +def test_datastream_transport_auth_adc(transport_class): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object(google.auth, 'default', autospec=True) as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport_class(quota_project_id="octopus", scopes=["1", "2"]) + adc.assert_called_once_with( + scopes=["1", "2"], + default_scopes=( 'https://www.googleapis.com/auth/cloud-platform',), + quota_project_id="octopus", + ) + + +@pytest.mark.parametrize( + "transport_class", + [ + transports.DatastreamGrpcTransport, + transports.DatastreamGrpcAsyncIOTransport, + ], +) +def test_datastream_transport_auth_gdch_credentials(transport_class): + host = 'https://language.com' + api_audience_tests = [None, 'https://language2.com'] + api_audience_expect = [host, 'https://language2.com'] + for t, e in zip(api_audience_tests, api_audience_expect): + with mock.patch.object(google.auth, 'default', autospec=True) as adc: + gdch_mock = mock.MagicMock() + type(gdch_mock).with_gdch_audience = mock.PropertyMock(return_value=gdch_mock) + adc.return_value = (gdch_mock, None) + transport_class(host=host, api_audience=t) + gdch_mock.with_gdch_audience.assert_called_once_with( + e + ) + + +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.DatastreamGrpcTransport, grpc_helpers), + (transports.DatastreamGrpcAsyncIOTransport, grpc_helpers_async) + ], +) +def test_datastream_transport_create_channel(transport_class, grpc_helpers): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch.object( + grpc_helpers, "create_channel", autospec=True + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + adc.return_value = (creds, None) + transport_class( + quota_project_id="octopus", + scopes=["1", "2"] + ) + + create_channel.assert_called_with( + "datastream.googleapis.com:443", + credentials=creds, + credentials_file=None, + quota_project_id="octopus", + default_scopes=( + 'https://www.googleapis.com/auth/cloud-platform', +), + scopes=["1", "2"], + default_host="datastream.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize("transport_class", [transports.DatastreamGrpcTransport, transports.DatastreamGrpcAsyncIOTransport]) +def test_datastream_grpc_transport_client_cert_source_for_mtls( + transport_class +): + cred = ga_credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=None, + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, + private_key=expected_key + ) + + +@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' + ) + +@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' + ) + +def test_datastream_grpc_transport_channel(): + channel = grpc.secure_channel('http://localhost/', grpc.local_channel_credentials()) + + # Check that channel is used if provided. + transport = transports.DatastreamGrpcTransport( + host="squid.clam.whelk", + channel=channel, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert transport._ssl_channel_credentials == None + + +def test_datastream_grpc_asyncio_transport_channel(): + channel = aio.secure_channel('http://localhost/', grpc.local_channel_credentials()) + + # Check that channel is used if provided. + transport = transports.DatastreamGrpcAsyncIOTransport( + host="squid.clam.whelk", + channel=channel, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert transport._ssl_channel_credentials == None + + +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. +@pytest.mark.parametrize("transport_class", [transports.DatastreamGrpcTransport, transports.DatastreamGrpcAsyncIOTransport]) +def test_datastream_transport_channel_mtls_with_client_cert_source( + transport_class +): + with mock.patch("grpc.ssl_channel_credentials", autospec=True) as grpc_ssl_channel_cred: + with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: + mock_ssl_cred = mock.Mock() + grpc_ssl_channel_cred.return_value = mock_ssl_cred + + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + cred = ga_credentials.AnonymousCredentials() + with pytest.warns(DeprecationWarning): + with mock.patch.object(google.auth, 'default') as adc: + adc.return_value = (cred, None) + transport = transport_class( + host="squid.clam.whelk", + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=client_cert_source_callback, + ) + adc.assert_called_once() + + grpc_ssl_channel_cred.assert_called_once_with( + certificate_chain=b"cert bytes", private_key=b"key bytes" + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=None, + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + assert transport.grpc_channel == mock_grpc_channel + assert transport._ssl_channel_credentials == mock_ssl_cred + + +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. +@pytest.mark.parametrize("transport_class", [transports.DatastreamGrpcTransport, transports.DatastreamGrpcAsyncIOTransport]) +def test_datastream_transport_channel_mtls_with_adc( + transport_class +): + mock_ssl_cred = mock.Mock() + with mock.patch.multiple( + "google.auth.transport.grpc.SslCredentials", + __init__=mock.Mock(return_value=None), + ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), + ): + with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + mock_cred = mock.Mock() + + with pytest.warns(DeprecationWarning): + transport = transport_class( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=None, + ) + + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=None, + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + assert transport.grpc_channel == mock_grpc_channel + + +def test_datastream_grpc_lro_client(): + client = DatastreamClient( + 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, + ) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + +def test_datastream_grpc_lro_async_client(): + client = DatastreamAsyncClient( + 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, + ) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + +def test_connection_profile_path(): + project = "squid" + location = "clam" + connection_profile = "whelk" + expected = "projects/{project}/locations/{location}/connectionProfiles/{connection_profile}".format(project=project, location=location, connection_profile=connection_profile, ) + actual = DatastreamClient.connection_profile_path(project, location, connection_profile) + assert expected == actual + + +def test_parse_connection_profile_path(): + expected = { + "project": "octopus", + "location": "oyster", + "connection_profile": "nudibranch", + } + path = DatastreamClient.connection_profile_path(**expected) + + # Check that the path construction is reversible. + actual = DatastreamClient.parse_connection_profile_path(path) + assert expected == actual + +def test_private_connection_path(): + project = "cuttlefish" + location = "mussel" + private_connection = "winkle" + expected = "projects/{project}/locations/{location}/privateConnections/{private_connection}".format(project=project, location=location, private_connection=private_connection, ) + actual = DatastreamClient.private_connection_path(project, location, private_connection) + assert expected == actual + + +def test_parse_private_connection_path(): + expected = { + "project": "nautilus", + "location": "scallop", + "private_connection": "abalone", + } + path = DatastreamClient.private_connection_path(**expected) + + # Check that the path construction is reversible. + actual = DatastreamClient.parse_private_connection_path(path) + assert expected == actual + +def test_route_path(): + project = "squid" + location = "clam" + private_connection = "whelk" + route = "octopus" + expected = "projects/{project}/locations/{location}/privateConnections/{private_connection}/routes/{route}".format(project=project, location=location, private_connection=private_connection, route=route, ) + actual = DatastreamClient.route_path(project, location, private_connection, route) + assert expected == actual + + +def test_parse_route_path(): + expected = { + "project": "oyster", + "location": "nudibranch", + "private_connection": "cuttlefish", + "route": "mussel", + } + path = DatastreamClient.route_path(**expected) + + # Check that the path construction is reversible. + actual = DatastreamClient.parse_route_path(path) + assert expected == actual + +def test_stream_path(): + project = "winkle" + location = "nautilus" + stream = "scallop" + expected = "projects/{project}/locations/{location}/streams/{stream}".format(project=project, location=location, stream=stream, ) + actual = DatastreamClient.stream_path(project, location, stream) + assert expected == actual + + +def test_parse_stream_path(): + expected = { + "project": "abalone", + "location": "squid", + "stream": "clam", + } + path = DatastreamClient.stream_path(**expected) + + # Check that the path construction is reversible. + actual = DatastreamClient.parse_stream_path(path) + assert expected == actual + +def test_common_billing_account_path(): + billing_account = "whelk" + expected = "billingAccounts/{billing_account}".format(billing_account=billing_account, ) + actual = DatastreamClient.common_billing_account_path(billing_account) + assert expected == actual + + +def test_parse_common_billing_account_path(): + expected = { + "billing_account": "octopus", + } + path = DatastreamClient.common_billing_account_path(**expected) + + # Check that the path construction is reversible. + actual = DatastreamClient.parse_common_billing_account_path(path) + assert expected == actual + +def test_common_folder_path(): + folder = "oyster" + expected = "folders/{folder}".format(folder=folder, ) + actual = DatastreamClient.common_folder_path(folder) + assert expected == actual + + +def test_parse_common_folder_path(): + expected = { + "folder": "nudibranch", + } + path = DatastreamClient.common_folder_path(**expected) + + # Check that the path construction is reversible. + actual = DatastreamClient.parse_common_folder_path(path) + assert expected == actual + +def test_common_organization_path(): + organization = "cuttlefish" + expected = "organizations/{organization}".format(organization=organization, ) + actual = DatastreamClient.common_organization_path(organization) + assert expected == actual + + +def test_parse_common_organization_path(): + expected = { + "organization": "mussel", + } + path = DatastreamClient.common_organization_path(**expected) + + # Check that the path construction is reversible. + actual = DatastreamClient.parse_common_organization_path(path) + assert expected == actual + +def test_common_project_path(): + project = "winkle" + expected = "projects/{project}".format(project=project, ) + actual = DatastreamClient.common_project_path(project) + assert expected == actual + + +def test_parse_common_project_path(): + expected = { + "project": "nautilus", + } + path = DatastreamClient.common_project_path(**expected) + + # Check that the path construction is reversible. + actual = DatastreamClient.parse_common_project_path(path) + assert expected == actual + +def test_common_location_path(): + project = "scallop" + location = "abalone" + expected = "projects/{project}/locations/{location}".format(project=project, location=location, ) + actual = DatastreamClient.common_location_path(project, location) + assert expected == actual + + +def test_parse_common_location_path(): + expected = { + "project": "squid", + "location": "clam", + } + path = DatastreamClient.common_location_path(**expected) + + # Check that the path construction is reversible. + actual = DatastreamClient.parse_common_location_path(path) + assert expected == actual + + +def test_client_with_default_client_info(): + client_info = gapic_v1.client_info.ClientInfo() + + with mock.patch.object(transports.DatastreamTransport, '_prep_wrapped_messages') as prep: + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + with mock.patch.object(transports.DatastreamTransport, '_prep_wrapped_messages') as prep: + transport_class = DatastreamClient.get_transport_class() + transport = transport_class( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + +@pytest.mark.asyncio +async def test_transport_close_async(): + client = DatastreamAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", + ) + with mock.patch.object(type(getattr(client.transport, "grpc_channel")), "close") as close: + async with client: + close.assert_not_called() + close.assert_called_once() + + +def test_transport_close(): + transports = { + "grpc": "_grpc_channel", + } + + for transport, close_name in transports.items(): + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport + ) + with mock.patch.object(type(getattr(client.transport, close_name)), "close") as close: + with client: + close.assert_not_called() + close.assert_called_once() + +def test_client_ctx(): + transports = [ + 'grpc', + ] + for transport in transports: + client = DatastreamClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport + ) + # Test client calls underlying transport. + with mock.patch.object(type(client.transport), "close") as close: + close.assert_not_called() + with client: + pass + close.assert_called() + +@pytest.mark.parametrize("client_class,transport_class", [ + (DatastreamClient, transports.DatastreamGrpcTransport), + (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport), +]) +def test_api_key_credentials(client_class, transport_class): + with mock.patch.object( + google.auth._default, "get_api_key_credentials", create=True + ) as get_api_key_credentials: + mock_cred = mock.Mock() + get_api_key_credentials.return_value = mock_cred + options = client_options.ClientOptions() + options.api_key = "api_key" + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=mock_cred, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) From 1810b81670ac77c675d1e0335c9572eb3c8eb583 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 7 Feb 2023 21:07:43 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- owl-bot-staging/v1/.coveragerc | 13 - owl-bot-staging/v1/.flake8 | 33 - owl-bot-staging/v1/MANIFEST.in | 2 - owl-bot-staging/v1/README.rst | 49 - owl-bot-staging/v1/docs/conf.py | 376 - .../v1/docs/datastream_v1/datastream.rst | 10 - .../v1/docs/datastream_v1/services.rst | 6 - .../v1/docs/datastream_v1/types.rst | 6 - owl-bot-staging/v1/docs/index.rst | 7 - .../v1/google/cloud/datastream/__init__.py | 181 - .../google/cloud/datastream/gapic_version.py | 16 - .../v1/google/cloud/datastream/py.typed | 2 - .../v1/google/cloud/datastream_v1/__init__.py | 182 - .../cloud/datastream_v1/gapic_metadata.json | 273 - .../cloud/datastream_v1/gapic_version.py | 16 - .../v1/google/cloud/datastream_v1/py.typed | 2 - .../cloud/datastream_v1/services/__init__.py | 15 - .../services/datastream/__init__.py | 22 - .../services/datastream/async_client.py | 3441 ------- .../services/datastream/client.py | 3685 ------- .../services/datastream/pagers.py | 745 -- .../datastream/transports/__init__.py | 33 - .../services/datastream/transports/base.py | 548 - .../services/datastream/transports/grpc.py | 1041 -- .../datastream/transports/grpc_asyncio.py | 1040 -- .../cloud/datastream_v1/types/__init__.py | 176 - .../cloud/datastream_v1/types/datastream.py | 1401 --- .../types/datastream_resources.py | 2091 ---- owl-bot-staging/v1/mypy.ini | 3 - owl-bot-staging/v1/noxfile.py | 184 - ...astream_create_connection_profile_async.py | 65 - ...tastream_create_connection_profile_sync.py | 65 - ...astream_create_private_connection_async.py | 61 - ...tastream_create_private_connection_sync.py | 61 - ...generated_datastream_create_route_async.py | 62 - ..._generated_datastream_create_route_sync.py | 62 - ...enerated_datastream_create_stream_async.py | 63 - ...generated_datastream_create_stream_sync.py | 63 - ...astream_delete_connection_profile_async.py | 56 - ...tastream_delete_connection_profile_sync.py | 56 - ...astream_delete_private_connection_async.py | 56 - ...tastream_delete_private_connection_sync.py | 56 - ...generated_datastream_delete_route_async.py | 56 - ..._generated_datastream_delete_route_sync.py | 56 - ...enerated_datastream_delete_stream_async.py | 56 - ...generated_datastream_delete_stream_sync.py | 56 - ...tream_discover_connection_profile_async.py | 61 - ...stream_discover_connection_profile_sync.py | 61 - ...rated_datastream_fetch_static_ips_async.py | 53 - ...erated_datastream_fetch_static_ips_sync.py | 53 - ...datastream_get_connection_profile_async.py | 52 - ..._datastream_get_connection_profile_sync.py | 52 - ...datastream_get_private_connection_async.py | 52 - ..._datastream_get_private_connection_sync.py | 52 - ...v1_generated_datastream_get_route_async.py | 52 - ..._v1_generated_datastream_get_route_sync.py | 52 - ...1_generated_datastream_get_stream_async.py | 52 - ...ated_datastream_get_stream_object_async.py | 52 - ...rated_datastream_get_stream_object_sync.py | 52 - ...v1_generated_datastream_get_stream_sync.py | 52 - ...tastream_list_connection_profiles_async.py | 53 - ...atastream_list_connection_profiles_sync.py | 53 - ...tastream_list_private_connections_async.py | 53 - ...atastream_list_private_connections_sync.py | 53 - ..._generated_datastream_list_routes_async.py | 53 - ...1_generated_datastream_list_routes_sync.py | 53 - ...ed_datastream_list_stream_objects_async.py | 53 - ...ted_datastream_list_stream_objects_sync.py | 53 - ...generated_datastream_list_streams_async.py | 53 - ..._generated_datastream_list_streams_sync.py | 53 - ...d_datastream_lookup_stream_object_async.py | 57 - ...ed_datastream_lookup_stream_object_sync.py | 57 - ...ted_datastream_start_backfill_job_async.py | 52 - ...ated_datastream_start_backfill_job_sync.py | 52 - ...ated_datastream_stop_backfill_job_async.py | 52 - ...rated_datastream_stop_backfill_job_sync.py | 52 - ...astream_update_connection_profile_async.py | 63 - ...tastream_update_connection_profile_sync.py | 63 - ...enerated_datastream_update_stream_async.py | 61 - ...generated_datastream_update_stream_sync.py | 61 - ...t_metadata_google.cloud.datastream.v1.json | 4104 -------- .../scripts/fixup_datastream_v1_keywords.py | 200 - owl-bot-staging/v1/setup.py | 91 - .../v1/testing/constraints-3.10.txt | 7 - .../v1/testing/constraints-3.11.txt | 7 - .../v1/testing/constraints-3.12.txt | 7 - .../v1/testing/constraints-3.7.txt | 10 - .../v1/testing/constraints-3.8.txt | 7 - .../v1/testing/constraints-3.9.txt | 7 - owl-bot-staging/v1/tests/__init__.py | 16 - owl-bot-staging/v1/tests/unit/__init__.py | 16 - .../v1/tests/unit/gapic/__init__.py | 16 - .../unit/gapic/datastream_v1/__init__.py | 16 - .../gapic/datastream_v1/test_datastream.py | 9022 ----------------- owl-bot-staging/v1alpha1/.coveragerc | 13 - owl-bot-staging/v1alpha1/.flake8 | 33 - owl-bot-staging/v1alpha1/MANIFEST.in | 2 - owl-bot-staging/v1alpha1/README.rst | 49 - owl-bot-staging/v1alpha1/docs/conf.py | 376 - .../docs/datastream_v1alpha1/datastream.rst | 10 - .../docs/datastream_v1alpha1/services.rst | 6 - .../docs/datastream_v1alpha1/types.rst | 6 - owl-bot-staging/v1alpha1/docs/index.rst | 7 - .../google/cloud/datastream/__init__.py | 153 - .../google/cloud/datastream/gapic_version.py | 16 - .../v1alpha1/google/cloud/datastream/py.typed | 2 - .../cloud/datastream_v1alpha1/__init__.py | 154 - .../datastream_v1alpha1/gapic_metadata.json | 233 - .../datastream_v1alpha1/gapic_version.py | 16 - .../google/cloud/datastream_v1alpha1/py.typed | 2 - .../datastream_v1alpha1/services/__init__.py | 15 - .../services/datastream/__init__.py | 22 - .../services/datastream/async_client.py | 2690 ----- .../services/datastream/client.py | 2921 ------ .../services/datastream/pagers.py | 624 -- .../datastream/transports/__init__.py | 33 - .../services/datastream/transports/base.py | 436 - .../services/datastream/transports/grpc.py | 824 -- .../datastream/transports/grpc_asyncio.py | 823 -- .../datastream_v1alpha1/types/__init__.py | 148 - .../datastream_v1alpha1/types/datastream.py | 1205 --- .../types/datastream_resources.py | 1413 --- owl-bot-staging/v1alpha1/mypy.ini | 3 - owl-bot-staging/v1alpha1/noxfile.py | 184 - ...astream_create_connection_profile_async.py | 65 - ...tastream_create_connection_profile_sync.py | 65 - ...astream_create_private_connection_async.py | 61 - ...tastream_create_private_connection_sync.py | 61 - ...generated_datastream_create_route_async.py | 62 - ..._generated_datastream_create_route_sync.py | 62 - ...enerated_datastream_create_stream_async.py | 63 - ...generated_datastream_create_stream_sync.py | 63 - ...astream_delete_connection_profile_async.py | 56 - ...tastream_delete_connection_profile_sync.py | 56 - ...astream_delete_private_connection_async.py | 56 - ...tastream_delete_private_connection_sync.py | 56 - ...generated_datastream_delete_route_async.py | 56 - ..._generated_datastream_delete_route_sync.py | 56 - ...enerated_datastream_delete_stream_async.py | 56 - ...generated_datastream_delete_stream_sync.py | 56 - ...tream_discover_connection_profile_async.py | 61 - ...stream_discover_connection_profile_sync.py | 61 - ...generated_datastream_fetch_errors_async.py | 55 - ..._generated_datastream_fetch_errors_sync.py | 55 - ...rated_datastream_fetch_static_ips_async.py | 53 - ...erated_datastream_fetch_static_ips_sync.py | 53 - ...datastream_get_connection_profile_async.py | 52 - ..._datastream_get_connection_profile_sync.py | 52 - ...datastream_get_private_connection_async.py | 52 - ..._datastream_get_private_connection_sync.py | 52 - ...a1_generated_datastream_get_route_async.py | 52 - ...ha1_generated_datastream_get_route_sync.py | 52 - ...1_generated_datastream_get_stream_async.py | 52 - ...a1_generated_datastream_get_stream_sync.py | 52 - ...tastream_list_connection_profiles_async.py | 53 - ...atastream_list_connection_profiles_sync.py | 53 - ...tastream_list_private_connections_async.py | 53 - ...atastream_list_private_connections_sync.py | 53 - ..._generated_datastream_list_routes_async.py | 53 - ...1_generated_datastream_list_routes_sync.py | 53 - ...generated_datastream_list_streams_async.py | 53 - ..._generated_datastream_list_streams_sync.py | 53 - ...astream_update_connection_profile_async.py | 63 - ...tastream_update_connection_profile_sync.py | 63 - ...enerated_datastream_update_stream_async.py | 61 - ...generated_datastream_update_stream_sync.py | 61 - ...data_google.cloud.datastream.v1alpha1.json | 3460 ------- .../fixup_datastream_v1alpha1_keywords.py | 196 - owl-bot-staging/v1alpha1/setup.py | 90 - .../v1alpha1/testing/constraints-3.10.txt | 6 - .../v1alpha1/testing/constraints-3.11.txt | 6 - .../v1alpha1/testing/constraints-3.12.txt | 6 - .../v1alpha1/testing/constraints-3.7.txt | 9 - .../v1alpha1/testing/constraints-3.8.txt | 6 - .../v1alpha1/testing/constraints-3.9.txt | 6 - owl-bot-staging/v1alpha1/tests/__init__.py | 16 - .../v1alpha1/tests/unit/__init__.py | 16 - .../v1alpha1/tests/unit/gapic/__init__.py | 16 - .../gapic/datastream_v1alpha1/__init__.py | 16 - .../datastream_v1alpha1/test_datastream.py | 7069 ------------- setup.py | 4 +- 181 files changed, 1 insertion(+), 57639 deletions(-) delete mode 100644 owl-bot-staging/v1/.coveragerc delete mode 100644 owl-bot-staging/v1/.flake8 delete mode 100644 owl-bot-staging/v1/MANIFEST.in delete mode 100644 owl-bot-staging/v1/README.rst delete mode 100644 owl-bot-staging/v1/docs/conf.py delete mode 100644 owl-bot-staging/v1/docs/datastream_v1/datastream.rst delete mode 100644 owl-bot-staging/v1/docs/datastream_v1/services.rst delete mode 100644 owl-bot-staging/v1/docs/datastream_v1/types.rst delete mode 100644 owl-bot-staging/v1/docs/index.rst delete mode 100644 owl-bot-staging/v1/google/cloud/datastream/__init__.py delete mode 100644 owl-bot-staging/v1/google/cloud/datastream/gapic_version.py delete mode 100644 owl-bot-staging/v1/google/cloud/datastream/py.typed delete mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/__init__.py delete mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/gapic_version.py delete mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/py.typed delete mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/services/__init__.py delete mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/__init__.py delete mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/async_client.py delete mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/client.py delete mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/pagers.py delete mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/__init__.py delete mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/base.py delete mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/grpc.py delete mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/grpc_asyncio.py delete mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/types/__init__.py delete mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/types/datastream.py delete mode 100644 owl-bot-staging/v1/google/cloud/datastream_v1/types/datastream_resources.py delete mode 100644 owl-bot-staging/v1/mypy.ini delete mode 100644 owl-bot-staging/v1/noxfile.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_connection_profile_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_connection_profile_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_private_connection_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_private_connection_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_route_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_route_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_stream_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_stream_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_connection_profile_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_connection_profile_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_private_connection_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_private_connection_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_route_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_route_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_stream_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_stream_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_discover_connection_profile_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_discover_connection_profile_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_fetch_static_ips_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_fetch_static_ips_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_connection_profile_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_connection_profile_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_private_connection_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_private_connection_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_route_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_route_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_object_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_object_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_connection_profiles_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_connection_profiles_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_private_connections_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_private_connections_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_routes_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_routes_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_stream_objects_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_stream_objects_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_streams_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_streams_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_lookup_stream_object_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_lookup_stream_object_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_start_backfill_job_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_start_backfill_job_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_stop_backfill_job_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_stop_backfill_job_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_connection_profile_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_connection_profile_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_stream_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_stream_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/snippet_metadata_google.cloud.datastream.v1.json delete mode 100644 owl-bot-staging/v1/scripts/fixup_datastream_v1_keywords.py delete mode 100644 owl-bot-staging/v1/setup.py delete mode 100644 owl-bot-staging/v1/testing/constraints-3.10.txt delete mode 100644 owl-bot-staging/v1/testing/constraints-3.11.txt delete mode 100644 owl-bot-staging/v1/testing/constraints-3.12.txt delete mode 100644 owl-bot-staging/v1/testing/constraints-3.7.txt delete mode 100644 owl-bot-staging/v1/testing/constraints-3.8.txt delete mode 100644 owl-bot-staging/v1/testing/constraints-3.9.txt delete mode 100644 owl-bot-staging/v1/tests/__init__.py delete mode 100644 owl-bot-staging/v1/tests/unit/__init__.py delete mode 100644 owl-bot-staging/v1/tests/unit/gapic/__init__.py delete mode 100644 owl-bot-staging/v1/tests/unit/gapic/datastream_v1/__init__.py delete mode 100644 owl-bot-staging/v1/tests/unit/gapic/datastream_v1/test_datastream.py delete mode 100644 owl-bot-staging/v1alpha1/.coveragerc delete mode 100644 owl-bot-staging/v1alpha1/.flake8 delete mode 100644 owl-bot-staging/v1alpha1/MANIFEST.in delete mode 100644 owl-bot-staging/v1alpha1/README.rst delete mode 100644 owl-bot-staging/v1alpha1/docs/conf.py delete mode 100644 owl-bot-staging/v1alpha1/docs/datastream_v1alpha1/datastream.rst delete mode 100644 owl-bot-staging/v1alpha1/docs/datastream_v1alpha1/services.rst delete mode 100644 owl-bot-staging/v1alpha1/docs/datastream_v1alpha1/types.rst delete mode 100644 owl-bot-staging/v1alpha1/docs/index.rst delete mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream/__init__.py delete mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream/gapic_version.py delete mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream/py.typed delete mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/__init__.py delete mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/gapic_version.py delete mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/py.typed delete mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/__init__.py delete mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/__init__.py delete mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/async_client.py delete mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/client.py delete mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/pagers.py delete mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/__init__.py delete mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/base.py delete mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/grpc.py delete mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/grpc_asyncio.py delete mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/types/__init__.py delete mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/types/datastream.py delete mode 100644 owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/types/datastream_resources.py delete mode 100644 owl-bot-staging/v1alpha1/mypy.ini delete mode 100644 owl-bot-staging/v1alpha1/noxfile.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_connection_profile_async.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_connection_profile_sync.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_private_connection_async.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_private_connection_sync.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_route_async.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_route_sync.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_stream_async.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_stream_sync.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_connection_profile_async.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_connection_profile_sync.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_private_connection_async.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_private_connection_sync.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_route_async.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_route_sync.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_stream_async.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_stream_sync.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_discover_connection_profile_async.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_discover_connection_profile_sync.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_errors_async.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_errors_sync.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_static_ips_async.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_static_ips_sync.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_connection_profile_async.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_connection_profile_sync.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_private_connection_async.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_private_connection_sync.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_route_async.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_route_sync.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_stream_async.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_stream_sync.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_connection_profiles_async.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_connection_profiles_sync.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_private_connections_async.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_private_connections_sync.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_routes_async.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_routes_sync.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_streams_async.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_streams_sync.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_connection_profile_async.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_connection_profile_sync.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_stream_async.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_stream_sync.py delete mode 100644 owl-bot-staging/v1alpha1/samples/generated_samples/snippet_metadata_google.cloud.datastream.v1alpha1.json delete mode 100644 owl-bot-staging/v1alpha1/scripts/fixup_datastream_v1alpha1_keywords.py delete mode 100644 owl-bot-staging/v1alpha1/setup.py delete mode 100644 owl-bot-staging/v1alpha1/testing/constraints-3.10.txt delete mode 100644 owl-bot-staging/v1alpha1/testing/constraints-3.11.txt delete mode 100644 owl-bot-staging/v1alpha1/testing/constraints-3.12.txt delete mode 100644 owl-bot-staging/v1alpha1/testing/constraints-3.7.txt delete mode 100644 owl-bot-staging/v1alpha1/testing/constraints-3.8.txt delete mode 100644 owl-bot-staging/v1alpha1/testing/constraints-3.9.txt delete mode 100644 owl-bot-staging/v1alpha1/tests/__init__.py delete mode 100644 owl-bot-staging/v1alpha1/tests/unit/__init__.py delete mode 100644 owl-bot-staging/v1alpha1/tests/unit/gapic/__init__.py delete mode 100644 owl-bot-staging/v1alpha1/tests/unit/gapic/datastream_v1alpha1/__init__.py delete mode 100644 owl-bot-staging/v1alpha1/tests/unit/gapic/datastream_v1alpha1/test_datastream.py diff --git a/owl-bot-staging/v1/.coveragerc b/owl-bot-staging/v1/.coveragerc deleted file mode 100644 index 99bdb31..0000000 --- a/owl-bot-staging/v1/.coveragerc +++ /dev/null @@ -1,13 +0,0 @@ -[run] -branch = True - -[report] -show_missing = True -omit = - google/cloud/datastream/__init__.py - google/cloud/datastream/gapic_version.py -exclude_lines = - # Re-enable the standard pragma - pragma: NO COVER - # Ignore debug-only repr - def __repr__ diff --git a/owl-bot-staging/v1/.flake8 b/owl-bot-staging/v1/.flake8 deleted file mode 100644 index 29227d4..0000000 --- a/owl-bot-staging/v1/.flake8 +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Generated by synthtool. DO NOT EDIT! -[flake8] -ignore = E203, E266, E501, W503 -exclude = - # Exclude generated code. - **/proto/** - **/gapic/** - **/services/** - **/types/** - *_pb2.py - - # Standard linting exemptions. - **/.nox/** - __pycache__, - .git, - *.pyc, - conf.py diff --git a/owl-bot-staging/v1/MANIFEST.in b/owl-bot-staging/v1/MANIFEST.in deleted file mode 100644 index dbcd8cf..0000000 --- a/owl-bot-staging/v1/MANIFEST.in +++ /dev/null @@ -1,2 +0,0 @@ -recursive-include google/cloud/datastream *.py -recursive-include google/cloud/datastream_v1 *.py diff --git a/owl-bot-staging/v1/README.rst b/owl-bot-staging/v1/README.rst deleted file mode 100644 index 9a1922d..0000000 --- a/owl-bot-staging/v1/README.rst +++ /dev/null @@ -1,49 +0,0 @@ -Python Client for Google Cloud Datastream API -================================================= - -Quick Start ------------ - -In order to use this library, you first need to go through the following steps: - -1. `Select or create a Cloud Platform project.`_ -2. `Enable billing for your project.`_ -3. Enable the Google Cloud Datastream API. -4. `Setup Authentication.`_ - -.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project -.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project -.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html - -Installation -~~~~~~~~~~~~ - -Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to -create isolated Python environments. The basic problem it addresses is one of -dependencies and versions, and indirectly permissions. - -With `virtualenv`_, it's possible to install this library without needing system -install permissions, and without clashing with the installed system -dependencies. - -.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ - - -Mac/Linux -^^^^^^^^^ - -.. code-block:: console - - python3 -m venv - source /bin/activate - /bin/pip install /path/to/library - - -Windows -^^^^^^^ - -.. code-block:: console - - python3 -m venv - \Scripts\activate - \Scripts\pip.exe install \path\to\library diff --git a/owl-bot-staging/v1/docs/conf.py b/owl-bot-staging/v1/docs/conf.py deleted file mode 100644 index 38f6361..0000000 --- a/owl-bot-staging/v1/docs/conf.py +++ /dev/null @@ -1,376 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# google-cloud-datastream documentation build configuration file -# -# This file is execfile()d with the current directory set to its -# containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -import sys -import os -import shlex - -# 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 -# documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.insert(0, os.path.abspath("..")) - -__version__ = "0.1.0" - -# -- General configuration ------------------------------------------------ - -# If your documentation needs a minimal Sphinx version, state it here. -needs_sphinx = "4.0.1" - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - "sphinx.ext.autodoc", - "sphinx.ext.autosummary", - "sphinx.ext.intersphinx", - "sphinx.ext.coverage", - "sphinx.ext.napoleon", - "sphinx.ext.todo", - "sphinx.ext.viewcode", -] - -# autodoc/autosummary flags -autoclass_content = "both" -autodoc_default_flags = ["members"] -autosummary_generate = True - - -# Add any paths that contain templates here, relative to this directory. -templates_path = ["_templates"] - -# Allow markdown includes (so releases.md can include CHANGLEOG.md) -# http://www.sphinx-doc.org/en/master/markdown.html -source_parsers = {".md": "recommonmark.parser.CommonMarkParser"} - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: -source_suffix = [".rst", ".md"] - -# The encoding of source files. -# source_encoding = 'utf-8-sig' - -# The root toctree document. -root_doc = "index" - -# General information about the project. -project = u"google-cloud-datastream" -copyright = u"2022, Google, LLC" -author = u"Google APIs" # TODO: autogenerate this bit - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The full version, including alpha/beta/rc tags. -release = __version__ -# The short X.Y version. -version = ".".join(release.split(".")[0:2]) - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# -# This is also used if you do content translation via gettext catalogs. -# Usually you set "language" from the command line for these cases. -language = None - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -# today = '' -# Else, today_fmt is used as the format for a strftime call. -# today_fmt = '%B %d, %Y' - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -exclude_patterns = ["_build"] - -# The reST default role (used for this markup: `text`) to use for all -# documents. -# default_role = None - -# If true, '()' will be appended to :func: etc. cross-reference text. -# add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -# add_module_names = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -# show_authors = False - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = "sphinx" - -# A list of ignored prefixes for module index sorting. -# modindex_common_prefix = [] - -# If true, keep warnings as "system message" paragraphs in the built documents. -# keep_warnings = False - -# If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = True - - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -html_theme = "alabaster" - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -html_theme_options = { - "description": "Google Cloud Client Libraries for Python", - "github_user": "googleapis", - "github_repo": "google-cloud-python", - "github_banner": True, - "font_family": "'Roboto', Georgia, sans", - "head_font_family": "'Roboto', Georgia, serif", - "code_font_family": "'Roboto Mono', 'Consolas', monospace", -} - -# Add any paths that contain custom themes here, relative to this directory. -# html_theme_path = [] - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -# html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -# html_short_title = None - -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -# html_logo = None - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -# html_favicon = None - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ["_static"] - -# Add any extra paths that contain custom files (such as robots.txt or -# .htaccess) here, relative to this directory. These files are copied -# directly to the root of the documentation. -# html_extra_path = [] - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -# html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -# html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -# html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -# html_additional_pages = {} - -# If false, no module index is generated. -# html_domain_indices = True - -# If false, no index is generated. -# html_use_index = True - -# If true, the index is split into individual pages for each letter. -# html_split_index = False - -# If true, links to the reST sources are added to the pages. -# html_show_sourcelink = True - -# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -# html_show_sphinx = True - -# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -# html_show_copyright = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -# html_use_opensearch = '' - -# This is the file name suffix for HTML files (e.g. ".xhtml"). -# html_file_suffix = None - -# Language to be used for generating the HTML full-text search index. -# Sphinx supports the following languages: -# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' -# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' -# html_search_language = 'en' - -# A dictionary with options for the search language support, empty by default. -# Now only 'ja' uses this config value -# html_search_options = {'type': 'default'} - -# The name of a javascript file (relative to the configuration directory) that -# implements a search results scorer. If empty, the default will be used. -# html_search_scorer = 'scorer.js' - -# Output file base name for HTML help builder. -htmlhelp_basename = "google-cloud-datastream-doc" - -# -- Options for warnings ------------------------------------------------------ - - -suppress_warnings = [ - # Temporarily suppress this to avoid "more than one target found for - # cross-reference" warning, which are intractable for us to avoid while in - # a mono-repo. - # See https://github.com/sphinx-doc/sphinx/blob - # /2a65ffeef5c107c19084fabdd706cdff3f52d93c/sphinx/domains/python.py#L843 - "ref.python" -] - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). - # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. - # 'preamble': '', - # Latex figure (float) alignment - # 'figure_align': 'htbp', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - ( - root_doc, - "google-cloud-datastream.tex", - u"google-cloud-datastream Documentation", - author, - "manual", - ) -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -# latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -# latex_use_parts = False - -# If true, show page references after internal links. -# latex_show_pagerefs = False - -# If true, show URL addresses after external links. -# latex_show_urls = False - -# Documents to append as an appendix to all manuals. -# latex_appendices = [] - -# If false, no module index is generated. -# latex_domain_indices = True - - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - ( - root_doc, - "google-cloud-datastream", - u"Google Cloud Datastream Documentation", - [author], - 1, - ) -] - -# If true, show URL addresses after external links. -# man_show_urls = False - - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - ( - root_doc, - "google-cloud-datastream", - u"google-cloud-datastream Documentation", - author, - "google-cloud-datastream", - "GAPIC library for Google Cloud Datastream API", - "APIs", - ) -] - -# Documents to append as an appendix to all manuals. -# texinfo_appendices = [] - -# If false, no module index is generated. -# texinfo_domain_indices = True - -# How to display URL addresses: 'footnote', 'no', or 'inline'. -# texinfo_show_urls = 'footnote' - -# If true, do not generate a @detailmenu in the "Top" node's menu. -# texinfo_no_detailmenu = False - - -# Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = { - "python": ("http://python.readthedocs.org/en/latest/", None), - "gax": ("https://gax-python.readthedocs.org/en/latest/", None), - "google-auth": ("https://google-auth.readthedocs.io/en/stable", None), - "google-gax": ("https://gax-python.readthedocs.io/en/latest/", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None), - "grpc": ("https://grpc.io/grpc/python/", None), - "requests": ("http://requests.kennethreitz.org/en/stable/", None), - "proto": ("https://proto-plus-python.readthedocs.io/en/stable", None), - "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), -} - - -# Napoleon settings -napoleon_google_docstring = True -napoleon_numpy_docstring = True -napoleon_include_private_with_doc = False -napoleon_include_special_with_doc = True -napoleon_use_admonition_for_examples = False -napoleon_use_admonition_for_notes = False -napoleon_use_admonition_for_references = False -napoleon_use_ivar = False -napoleon_use_param = True -napoleon_use_rtype = True diff --git a/owl-bot-staging/v1/docs/datastream_v1/datastream.rst b/owl-bot-staging/v1/docs/datastream_v1/datastream.rst deleted file mode 100644 index b966db4..0000000 --- a/owl-bot-staging/v1/docs/datastream_v1/datastream.rst +++ /dev/null @@ -1,10 +0,0 @@ -Datastream ----------------------------- - -.. automodule:: google.cloud.datastream_v1.services.datastream - :members: - :inherited-members: - -.. automodule:: google.cloud.datastream_v1.services.datastream.pagers - :members: - :inherited-members: diff --git a/owl-bot-staging/v1/docs/datastream_v1/services.rst b/owl-bot-staging/v1/docs/datastream_v1/services.rst deleted file mode 100644 index ec9e529..0000000 --- a/owl-bot-staging/v1/docs/datastream_v1/services.rst +++ /dev/null @@ -1,6 +0,0 @@ -Services for Google Cloud Datastream v1 API -=========================================== -.. toctree:: - :maxdepth: 2 - - datastream diff --git a/owl-bot-staging/v1/docs/datastream_v1/types.rst b/owl-bot-staging/v1/docs/datastream_v1/types.rst deleted file mode 100644 index 38cae16..0000000 --- a/owl-bot-staging/v1/docs/datastream_v1/types.rst +++ /dev/null @@ -1,6 +0,0 @@ -Types for Google Cloud Datastream v1 API -======================================== - -.. automodule:: google.cloud.datastream_v1.types - :members: - :show-inheritance: diff --git a/owl-bot-staging/v1/docs/index.rst b/owl-bot-staging/v1/docs/index.rst deleted file mode 100644 index 00795af..0000000 --- a/owl-bot-staging/v1/docs/index.rst +++ /dev/null @@ -1,7 +0,0 @@ -API Reference -------------- -.. toctree:: - :maxdepth: 2 - - datastream_v1/services - datastream_v1/types diff --git a/owl-bot-staging/v1/google/cloud/datastream/__init__.py b/owl-bot-staging/v1/google/cloud/datastream/__init__.py deleted file mode 100644 index 801aabc..0000000 --- a/owl-bot-staging/v1/google/cloud/datastream/__init__.py +++ /dev/null @@ -1,181 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from google.cloud.datastream import gapic_version as package_version - -__version__ = package_version.__version__ - - -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.types.datastream import DiscoverConnectionProfileResponse -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 BigQueryDestinationConfig -from google.cloud.datastream_v1.types.datastream_resources import BigQueryProfile -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 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 PostgresqlColumn -from google.cloud.datastream_v1.types.datastream_resources import PostgresqlProfile -from google.cloud.datastream_v1.types.datastream_resources import PostgresqlRdbms -from google.cloud.datastream_v1.types.datastream_resources import PostgresqlSchema -from google.cloud.datastream_v1.types.datastream_resources import PostgresqlSourceConfig -from google.cloud.datastream_v1.types.datastream_resources import PostgresqlTable -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 StaticServiceIpConnectivity -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', - 'DatastreamAsyncClient', - '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', - 'AvroFileFormat', - 'BackfillJob', - 'BigQueryDestinationConfig', - 'BigQueryProfile', - 'ConnectionProfile', - 'DestinationConfig', - 'Error', - 'ForwardSshTunnelConnectivity', - 'GcsDestinationConfig', - 'GcsProfile', - 'JsonFileFormat', - 'MysqlColumn', - 'MysqlDatabase', - 'MysqlProfile', - 'MysqlRdbms', - 'MysqlSourceConfig', - 'MysqlSslConfig', - 'MysqlTable', - 'OracleColumn', - 'OracleProfile', - 'OracleRdbms', - 'OracleSchema', - 'OracleSourceConfig', - 'OracleTable', - 'PostgresqlColumn', - 'PostgresqlProfile', - 'PostgresqlRdbms', - 'PostgresqlSchema', - 'PostgresqlSourceConfig', - 'PostgresqlTable', - 'PrivateConnection', - 'PrivateConnectivity', - 'Route', - 'SourceConfig', - 'SourceObjectIdentifier', - 'StaticServiceIpConnectivity', - 'Stream', - 'StreamObject', - 'Validation', - 'ValidationMessage', - 'ValidationResult', - 'VpcPeeringConfig', -) diff --git a/owl-bot-staging/v1/google/cloud/datastream/gapic_version.py b/owl-bot-staging/v1/google/cloud/datastream/gapic_version.py deleted file mode 100644 index 405b1ce..0000000 --- a/owl-bot-staging/v1/google/cloud/datastream/gapic_version.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -__version__ = "0.1.0" # {x-release-please-version} diff --git a/owl-bot-staging/v1/google/cloud/datastream/py.typed b/owl-bot-staging/v1/google/cloud/datastream/py.typed deleted file mode 100644 index 38ae0fa..0000000 --- a/owl-bot-staging/v1/google/cloud/datastream/py.typed +++ /dev/null @@ -1,2 +0,0 @@ -# Marker file for PEP 561. -# The google-cloud-datastream package uses inline types. diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/__init__.py b/owl-bot-staging/v1/google/cloud/datastream_v1/__init__.py deleted file mode 100644 index 62798ec..0000000 --- a/owl-bot-staging/v1/google/cloud/datastream_v1/__init__.py +++ /dev/null @@ -1,182 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from google.cloud.datastream_v1 import gapic_version as package_version - -__version__ = package_version.__version__ - - -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 BigQueryDestinationConfig -from .types.datastream_resources import BigQueryProfile -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 PostgresqlColumn -from .types.datastream_resources import PostgresqlProfile -from .types.datastream_resources import PostgresqlRdbms -from .types.datastream_resources import PostgresqlSchema -from .types.datastream_resources import PostgresqlSourceConfig -from .types.datastream_resources import PostgresqlTable -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 - -__all__ = ( - 'DatastreamAsyncClient', -'AvroFileFormat', -'BackfillJob', -'BigQueryDestinationConfig', -'BigQueryProfile', -'ConnectionProfile', -'CreateConnectionProfileRequest', -'CreatePrivateConnectionRequest', -'CreateRouteRequest', -'CreateStreamRequest', -'DatastreamClient', -'DeleteConnectionProfileRequest', -'DeletePrivateConnectionRequest', -'DeleteRouteRequest', -'DeleteStreamRequest', -'DestinationConfig', -'DiscoverConnectionProfileRequest', -'DiscoverConnectionProfileResponse', -'Error', -'FetchStaticIpsRequest', -'FetchStaticIpsResponse', -'ForwardSshTunnelConnectivity', -'GcsDestinationConfig', -'GcsProfile', -'GetConnectionProfileRequest', -'GetPrivateConnectionRequest', -'GetRouteRequest', -'GetStreamObjectRequest', -'GetStreamRequest', -'JsonFileFormat', -'ListConnectionProfilesRequest', -'ListConnectionProfilesResponse', -'ListPrivateConnectionsRequest', -'ListPrivateConnectionsResponse', -'ListRoutesRequest', -'ListRoutesResponse', -'ListStreamObjectsRequest', -'ListStreamObjectsResponse', -'ListStreamsRequest', -'ListStreamsResponse', -'LookupStreamObjectRequest', -'MysqlColumn', -'MysqlDatabase', -'MysqlProfile', -'MysqlRdbms', -'MysqlSourceConfig', -'MysqlSslConfig', -'MysqlTable', -'OperationMetadata', -'OracleColumn', -'OracleProfile', -'OracleRdbms', -'OracleSchema', -'OracleSourceConfig', -'OracleTable', -'PostgresqlColumn', -'PostgresqlProfile', -'PostgresqlRdbms', -'PostgresqlSchema', -'PostgresqlSourceConfig', -'PostgresqlTable', -'PrivateConnection', -'PrivateConnectivity', -'Route', -'SourceConfig', -'SourceObjectIdentifier', -'StartBackfillJobRequest', -'StartBackfillJobResponse', -'StaticServiceIpConnectivity', -'StopBackfillJobRequest', -'StopBackfillJobResponse', -'Stream', -'StreamObject', -'UpdateConnectionProfileRequest', -'UpdateStreamRequest', -'Validation', -'ValidationMessage', -'ValidationResult', -'VpcPeeringConfig', -) diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/gapic_metadata.json b/owl-bot-staging/v1/google/cloud/datastream_v1/gapic_metadata.json deleted file mode 100644 index b6c5117..0000000 --- a/owl-bot-staging/v1/google/cloud/datastream_v1/gapic_metadata.json +++ /dev/null @@ -1,273 +0,0 @@ - { - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "python", - "libraryPackage": "google.cloud.datastream_v1", - "protoPackage": "google.cloud.datastream.v1", - "schema": "1.0", - "services": { - "Datastream": { - "clients": { - "grpc": { - "libraryClient": "DatastreamClient", - "rpcs": { - "CreateConnectionProfile": { - "methods": [ - "create_connection_profile" - ] - }, - "CreatePrivateConnection": { - "methods": [ - "create_private_connection" - ] - }, - "CreateRoute": { - "methods": [ - "create_route" - ] - }, - "CreateStream": { - "methods": [ - "create_stream" - ] - }, - "DeleteConnectionProfile": { - "methods": [ - "delete_connection_profile" - ] - }, - "DeletePrivateConnection": { - "methods": [ - "delete_private_connection" - ] - }, - "DeleteRoute": { - "methods": [ - "delete_route" - ] - }, - "DeleteStream": { - "methods": [ - "delete_stream" - ] - }, - "DiscoverConnectionProfile": { - "methods": [ - "discover_connection_profile" - ] - }, - "FetchStaticIps": { - "methods": [ - "fetch_static_ips" - ] - }, - "GetConnectionProfile": { - "methods": [ - "get_connection_profile" - ] - }, - "GetPrivateConnection": { - "methods": [ - "get_private_connection" - ] - }, - "GetRoute": { - "methods": [ - "get_route" - ] - }, - "GetStream": { - "methods": [ - "get_stream" - ] - }, - "GetStreamObject": { - "methods": [ - "get_stream_object" - ] - }, - "ListConnectionProfiles": { - "methods": [ - "list_connection_profiles" - ] - }, - "ListPrivateConnections": { - "methods": [ - "list_private_connections" - ] - }, - "ListRoutes": { - "methods": [ - "list_routes" - ] - }, - "ListStreamObjects": { - "methods": [ - "list_stream_objects" - ] - }, - "ListStreams": { - "methods": [ - "list_streams" - ] - }, - "LookupStreamObject": { - "methods": [ - "lookup_stream_object" - ] - }, - "StartBackfillJob": { - "methods": [ - "start_backfill_job" - ] - }, - "StopBackfillJob": { - "methods": [ - "stop_backfill_job" - ] - }, - "UpdateConnectionProfile": { - "methods": [ - "update_connection_profile" - ] - }, - "UpdateStream": { - "methods": [ - "update_stream" - ] - } - } - }, - "grpc-async": { - "libraryClient": "DatastreamAsyncClient", - "rpcs": { - "CreateConnectionProfile": { - "methods": [ - "create_connection_profile" - ] - }, - "CreatePrivateConnection": { - "methods": [ - "create_private_connection" - ] - }, - "CreateRoute": { - "methods": [ - "create_route" - ] - }, - "CreateStream": { - "methods": [ - "create_stream" - ] - }, - "DeleteConnectionProfile": { - "methods": [ - "delete_connection_profile" - ] - }, - "DeletePrivateConnection": { - "methods": [ - "delete_private_connection" - ] - }, - "DeleteRoute": { - "methods": [ - "delete_route" - ] - }, - "DeleteStream": { - "methods": [ - "delete_stream" - ] - }, - "DiscoverConnectionProfile": { - "methods": [ - "discover_connection_profile" - ] - }, - "FetchStaticIps": { - "methods": [ - "fetch_static_ips" - ] - }, - "GetConnectionProfile": { - "methods": [ - "get_connection_profile" - ] - }, - "GetPrivateConnection": { - "methods": [ - "get_private_connection" - ] - }, - "GetRoute": { - "methods": [ - "get_route" - ] - }, - "GetStream": { - "methods": [ - "get_stream" - ] - }, - "GetStreamObject": { - "methods": [ - "get_stream_object" - ] - }, - "ListConnectionProfiles": { - "methods": [ - "list_connection_profiles" - ] - }, - "ListPrivateConnections": { - "methods": [ - "list_private_connections" - ] - }, - "ListRoutes": { - "methods": [ - "list_routes" - ] - }, - "ListStreamObjects": { - "methods": [ - "list_stream_objects" - ] - }, - "ListStreams": { - "methods": [ - "list_streams" - ] - }, - "LookupStreamObject": { - "methods": [ - "lookup_stream_object" - ] - }, - "StartBackfillJob": { - "methods": [ - "start_backfill_job" - ] - }, - "StopBackfillJob": { - "methods": [ - "stop_backfill_job" - ] - }, - "UpdateConnectionProfile": { - "methods": [ - "update_connection_profile" - ] - }, - "UpdateStream": { - "methods": [ - "update_stream" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/gapic_version.py b/owl-bot-staging/v1/google/cloud/datastream_v1/gapic_version.py deleted file mode 100644 index 405b1ce..0000000 --- a/owl-bot-staging/v1/google/cloud/datastream_v1/gapic_version.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -__version__ = "0.1.0" # {x-release-please-version} diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/py.typed b/owl-bot-staging/v1/google/cloud/datastream_v1/py.typed deleted file mode 100644 index 38ae0fa..0000000 --- a/owl-bot-staging/v1/google/cloud/datastream_v1/py.typed +++ /dev/null @@ -1,2 +0,0 @@ -# Marker file for PEP 561. -# The google-cloud-datastream package uses inline types. diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/services/__init__.py b/owl-bot-staging/v1/google/cloud/datastream_v1/services/__init__.py deleted file mode 100644 index e8e1c38..0000000 --- a/owl-bot-staging/v1/google/cloud/datastream_v1/services/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/__init__.py b/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/__init__.py deleted file mode 100644 index f03a8e0..0000000 --- a/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from .client import DatastreamClient -from .async_client import DatastreamAsyncClient - -__all__ = ( - 'DatastreamClient', - 'DatastreamAsyncClient', -) diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/async_client.py b/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/async_client.py deleted file mode 100644 index 0dcfc6c..0000000 --- a/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/async_client.py +++ /dev/null @@ -1,3441 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from collections import OrderedDict -import functools -import re -from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union - -from google.cloud.datastream_v1 import gapic_version as package_version - -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.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -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.cloud.location import locations_pb2 # type: ignore -from google.iam.v1 import iam_policy_pb2 # type: ignore -from google.iam.v1 import policy_pb2 # type: ignore -from google.longrunning import operations_pb2 -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 .client import DatastreamClient - - -class DatastreamAsyncClient: - """Datastream service""" - - _client: DatastreamClient - - DEFAULT_ENDPOINT = DatastreamClient.DEFAULT_ENDPOINT - DEFAULT_MTLS_ENDPOINT = DatastreamClient.DEFAULT_MTLS_ENDPOINT - - connection_profile_path = staticmethod(DatastreamClient.connection_profile_path) - parse_connection_profile_path = staticmethod(DatastreamClient.parse_connection_profile_path) - networks_path = staticmethod(DatastreamClient.networks_path) - parse_networks_path = staticmethod(DatastreamClient.parse_networks_path) - private_connection_path = staticmethod(DatastreamClient.private_connection_path) - parse_private_connection_path = staticmethod(DatastreamClient.parse_private_connection_path) - route_path = staticmethod(DatastreamClient.route_path) - parse_route_path = staticmethod(DatastreamClient.parse_route_path) - stream_path = staticmethod(DatastreamClient.stream_path) - parse_stream_path = staticmethod(DatastreamClient.parse_stream_path) - stream_object_path = staticmethod(DatastreamClient.stream_object_path) - parse_stream_object_path = staticmethod(DatastreamClient.parse_stream_object_path) - common_billing_account_path = staticmethod(DatastreamClient.common_billing_account_path) - parse_common_billing_account_path = staticmethod(DatastreamClient.parse_common_billing_account_path) - common_folder_path = staticmethod(DatastreamClient.common_folder_path) - parse_common_folder_path = staticmethod(DatastreamClient.parse_common_folder_path) - common_organization_path = staticmethod(DatastreamClient.common_organization_path) - parse_common_organization_path = staticmethod(DatastreamClient.parse_common_organization_path) - common_project_path = staticmethod(DatastreamClient.common_project_path) - parse_common_project_path = staticmethod(DatastreamClient.parse_common_project_path) - common_location_path = staticmethod(DatastreamClient.common_location_path) - parse_common_location_path = staticmethod(DatastreamClient.parse_common_location_path) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials - info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - DatastreamAsyncClient: The constructed client. - """ - return DatastreamClient.from_service_account_info.__func__(DatastreamAsyncClient, info, *args, **kwargs) # type: ignore - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - DatastreamAsyncClient: The constructed client. - """ - return DatastreamClient.from_service_account_file.__func__(DatastreamAsyncClient, filename, *args, **kwargs) # type: ignore - - from_service_account_json = from_service_account_file - - @classmethod - def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[ClientOptions] = None): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variable is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - return DatastreamClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore - - @property - def transport(self) -> DatastreamTransport: - """Returns the transport used by the client instance. - - Returns: - DatastreamTransport: The transport used by the client instance. - """ - return self._client.transport - - get_transport_class = functools.partial(type(DatastreamClient).get_transport_class, type(DatastreamClient)) - - def __init__(self, *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, DatastreamTransport] = "grpc_asyncio", - client_options: Optional[ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the datastream client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.DatastreamTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (ClientOptions): Custom options for the client. It - won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._client = DatastreamClient( - credentials=credentials, - transport=transport, - client_options=client_options, - client_info=client_info, - - ) - - async def list_connection_profiles(self, - request: Optional[Union[datastream.ListConnectionProfilesRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListConnectionProfilesAsyncPager: - r"""Use this method to list connection profiles created - in a project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_list_connection_profiles(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.ListConnectionProfilesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_connection_profiles(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.ListConnectionProfilesRequest, dict]]): - The request object. Request message for listing - connection profiles. - parent (:class:`str`): - Required. The parent that owns the - collection of connection profiles. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.services.datastream.pagers.ListConnectionProfilesAsyncPager: - Response message for listing - connection profiles. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.ListConnectionProfilesRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_connection_profiles, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - 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, - ) - - # Done; return the response. - return response - - async def get_connection_profile(self, - request: Optional[Union[datastream.GetConnectionProfileRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream_resources.ConnectionProfile: - r"""Use this method to get details about a connection - profile. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_get_connection_profile(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.GetConnectionProfileRequest( - name="name_value", - ) - - # Make the request - response = await client.get_connection_profile(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.GetConnectionProfileRequest, dict]]): - The request object. Request message for getting a - connection profile. - name (:class:`str`): - Required. The name of the connection - profile resource to get. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.types.ConnectionProfile: - A set of reusable connection - configurations to be used as a source or - destination for a stream. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.GetConnectionProfileRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_connection_profile, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def create_connection_profile(self, - request: Optional[Union[datastream.CreateConnectionProfileRequest, dict]] = None, - *, - parent: Optional[str] = None, - connection_profile: Optional[datastream_resources.ConnectionProfile] = None, - connection_profile_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Use this method to create a connection profile in a - project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_create_connection_profile(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - connection_profile = datastream_v1.ConnectionProfile() - connection_profile.oracle_profile.hostname = "hostname_value" - connection_profile.oracle_profile.username = "username_value" - connection_profile.oracle_profile.password = "password_value" - connection_profile.oracle_profile.database_service = "database_service_value" - connection_profile.display_name = "display_name_value" - - request = datastream_v1.CreateConnectionProfileRequest( - parent="parent_value", - connection_profile_id="connection_profile_id_value", - connection_profile=connection_profile, - ) - - # Make the request - operation = client.create_connection_profile(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.CreateConnectionProfileRequest, dict]]): - The request object. Request message for creating a - connection profile. - parent (:class:`str`): - Required. The parent that owns the - collection of ConnectionProfiles. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - connection_profile (:class:`google.cloud.datastream_v1.types.ConnectionProfile`): - Required. The connection profile - resource to create. - - This corresponds to the ``connection_profile`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - connection_profile_id (:class:`str`): - Required. The connection profile - identifier. - - This corresponds to the ``connection_profile_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.datastream_v1.types.ConnectionProfile` A set of reusable connection configurations to be used as a source or - destination for a stream. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, connection_profile, connection_profile_id]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.CreateConnectionProfileRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if connection_profile is not None: - request.connection_profile = connection_profile - if connection_profile_id is not None: - request.connection_profile_id = connection_profile_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_connection_profile, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - datastream_resources.ConnectionProfile, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - async def update_connection_profile(self, - request: Optional[Union[datastream.UpdateConnectionProfileRequest, dict]] = None, - *, - connection_profile: Optional[datastream_resources.ConnectionProfile] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Use this method to update the parameters of a - connection profile. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_update_connection_profile(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - connection_profile = datastream_v1.ConnectionProfile() - connection_profile.oracle_profile.hostname = "hostname_value" - connection_profile.oracle_profile.username = "username_value" - connection_profile.oracle_profile.password = "password_value" - connection_profile.oracle_profile.database_service = "database_service_value" - connection_profile.display_name = "display_name_value" - - request = datastream_v1.UpdateConnectionProfileRequest( - connection_profile=connection_profile, - ) - - # Make the request - operation = client.update_connection_profile(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.UpdateConnectionProfileRequest, dict]]): - The request object. Connection profile update message. - connection_profile (:class:`google.cloud.datastream_v1.types.ConnectionProfile`): - Required. The connection profile to - update. - - This corresponds to the ``connection_profile`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Optional. Field mask is used to specify the fields to be - overwritten in the ConnectionProfile resource by the - update. The fields specified in the update_mask are - relative to the resource, not the full request. A field - will be overwritten if it is in the mask. If the user - does not provide a mask then all fields will be - overwritten. - - This corresponds to the ``update_mask`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.datastream_v1.types.ConnectionProfile` A set of reusable connection configurations to be used as a source or - destination for a stream. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([connection_profile, update_mask]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.UpdateConnectionProfileRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if connection_profile is not None: - request.connection_profile = connection_profile - if update_mask is not None: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_connection_profile, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("connection_profile.name", request.connection_profile.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - datastream_resources.ConnectionProfile, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - async def delete_connection_profile(self, - request: Optional[Union[datastream.DeleteConnectionProfileRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Use this method to delete a connection profile. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_delete_connection_profile(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.DeleteConnectionProfileRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_connection_profile(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.DeleteConnectionProfileRequest, dict]]): - The request object. Request message for deleting a - connection profile. - name (:class:`str`): - Required. The name of the connection - profile resource to delete. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.DeleteConnectionProfileRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_connection_profile, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - empty_pb2.Empty, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - async def discover_connection_profile(self, - request: Optional[Union[datastream.DiscoverConnectionProfileRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream.DiscoverConnectionProfileResponse: - r"""Use this method to discover a connection profile. - The discover API call exposes the data objects and - metadata belonging to the profile. Typically, a request - returns children data objects of a parent data object - that's optionally supplied in the request. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_discover_connection_profile(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - connection_profile = datastream_v1.ConnectionProfile() - connection_profile.oracle_profile.hostname = "hostname_value" - connection_profile.oracle_profile.username = "username_value" - connection_profile.oracle_profile.password = "password_value" - connection_profile.oracle_profile.database_service = "database_service_value" - connection_profile.display_name = "display_name_value" - - request = datastream_v1.DiscoverConnectionProfileRequest( - connection_profile=connection_profile, - full_hierarchy=True, - parent="parent_value", - ) - - # Make the request - response = await client.discover_connection_profile(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.DiscoverConnectionProfileRequest, dict]]): - The request object. Request message for 'discover' - ConnectionProfile request. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.types.DiscoverConnectionProfileResponse: - Response from a discover request. - """ - # Create or coerce a protobuf request object. - request = datastream.DiscoverConnectionProfileRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.discover_connection_profile, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_streams(self, - request: Optional[Union[datastream.ListStreamsRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListStreamsAsyncPager: - r"""Use this method to list streams in a project and - location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_list_streams(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.ListStreamsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_streams(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.ListStreamsRequest, dict]]): - The request object. Request message for listing streams. - parent (:class:`str`): - Required. The parent that owns the - collection of streams. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.services.datastream.pagers.ListStreamsAsyncPager: - Response message for listing streams. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.ListStreamsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_streams, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - 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, - ) - - # Done; return the response. - return response - - async def get_stream(self, - request: Optional[Union[datastream.GetStreamRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream_resources.Stream: - r"""Use this method to get details about a stream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_get_stream(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.GetStreamRequest( - name="name_value", - ) - - # Make the request - response = await client.get_stream(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.GetStreamRequest, dict]]): - The request object. Request message for getting a - stream. - name (:class:`str`): - Required. The name of the stream - resource to get. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.types.Stream: - A resource representing streaming - data from a source to a destination. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.GetStreamRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_stream, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def create_stream(self, - request: Optional[Union[datastream.CreateStreamRequest, dict]] = None, - *, - parent: Optional[str] = None, - stream: Optional[datastream_resources.Stream] = None, - stream_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Use this method to create a stream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_create_stream(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - stream = datastream_v1.Stream() - stream.display_name = "display_name_value" - stream.source_config.source_connection_profile = "source_connection_profile_value" - stream.destination_config.destination_connection_profile = "destination_connection_profile_value" - - request = datastream_v1.CreateStreamRequest( - parent="parent_value", - stream_id="stream_id_value", - stream=stream, - ) - - # Make the request - operation = client.create_stream(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.CreateStreamRequest, dict]]): - The request object. Request message for creating a - stream. - parent (:class:`str`): - Required. The parent that owns the - collection of streams. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - stream (:class:`google.cloud.datastream_v1.types.Stream`): - Required. The stream resource to - create. - - This corresponds to the ``stream`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - stream_id (:class:`str`): - Required. The stream identifier. - This corresponds to the ``stream_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.datastream_v1.types.Stream` A - resource representing streaming data from a source to a - destination. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, stream, stream_id]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.CreateStreamRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if stream is not None: - request.stream = stream - if stream_id is not None: - request.stream_id = stream_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_stream, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - datastream_resources.Stream, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - async def update_stream(self, - request: Optional[Union[datastream.UpdateStreamRequest, dict]] = None, - *, - stream: Optional[datastream_resources.Stream] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Use this method to update the configuration of a - stream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_update_stream(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - stream = datastream_v1.Stream() - stream.display_name = "display_name_value" - stream.source_config.source_connection_profile = "source_connection_profile_value" - stream.destination_config.destination_connection_profile = "destination_connection_profile_value" - - request = datastream_v1.UpdateStreamRequest( - stream=stream, - ) - - # Make the request - operation = client.update_stream(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.UpdateStreamRequest, dict]]): - The request object. Request message for updating a - stream. - stream (:class:`google.cloud.datastream_v1.types.Stream`): - Required. The stream resource to - update. - - This corresponds to the ``stream`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Optional. Field mask is used to specify the fields to be - overwritten in the stream resource by the update. The - fields specified in the update_mask are relative to the - resource, not the full request. A field will be - overwritten if it is in the mask. If the user does not - provide a mask then all fields will be overwritten. - - This corresponds to the ``update_mask`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.datastream_v1.types.Stream` A - resource representing streaming data from a source to a - destination. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([stream, update_mask]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.UpdateStreamRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if stream is not None: - request.stream = stream - if update_mask is not None: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_stream, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("stream.name", request.stream.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - datastream_resources.Stream, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - async def delete_stream(self, - request: Optional[Union[datastream.DeleteStreamRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Use this method to delete a stream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_delete_stream(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.DeleteStreamRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_stream(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.DeleteStreamRequest, dict]]): - The request object. Request message for deleting a - stream. - name (:class:`str`): - Required. The name of the stream - resource to delete. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.DeleteStreamRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_stream, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - empty_pb2.Empty, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - async def get_stream_object(self, - request: Optional[Union[datastream.GetStreamObjectRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream_resources.StreamObject: - r"""Use this method to get details about a stream object. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_get_stream_object(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.GetStreamObjectRequest( - name="name_value", - ) - - # Make the request - response = await client.get_stream_object(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.GetStreamObjectRequest, dict]]): - The request object. Request for fetching a specific - stream object. - name (:class:`str`): - Required. The name of the stream - object resource to get. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.types.StreamObject: - A specific stream object (e.g a - specific DB table). - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.GetStreamObjectRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_stream_object, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def lookup_stream_object(self, - request: Optional[Union[datastream.LookupStreamObjectRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream_resources.StreamObject: - r"""Use this method to look up a stream object by its - source object identifier. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_lookup_stream_object(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - source_object_identifier = datastream_v1.SourceObjectIdentifier() - source_object_identifier.oracle_identifier.schema = "schema_value" - source_object_identifier.oracle_identifier.table = "table_value" - - request = datastream_v1.LookupStreamObjectRequest( - parent="parent_value", - source_object_identifier=source_object_identifier, - ) - - # Make the request - response = await client.lookup_stream_object(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.LookupStreamObjectRequest, dict]]): - The request object. Request for looking up a specific - stream object by its source object identifier. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.types.StreamObject: - A specific stream object (e.g a - specific DB table). - - """ - # Create or coerce a protobuf request object. - request = datastream.LookupStreamObjectRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.lookup_stream_object, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_stream_objects(self, - request: Optional[Union[datastream.ListStreamObjectsRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListStreamObjectsAsyncPager: - r"""Use this method to list the objects of a specific - stream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_list_stream_objects(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.ListStreamObjectsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_stream_objects(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.ListStreamObjectsRequest, dict]]): - The request object. Request for listing all objects for - a specific stream. - parent (:class:`str`): - Required. The parent stream that owns - the collection of objects. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.services.datastream.pagers.ListStreamObjectsAsyncPager: - Response containing the objects for a - stream. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.ListStreamObjectsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_stream_objects, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - 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, - ) - - # Done; return the response. - return response - - async def start_backfill_job(self, - request: Optional[Union[datastream.StartBackfillJobRequest, dict]] = None, - *, - object_: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream.StartBackfillJobResponse: - r"""Use this method to start a backfill job for the - specified stream object. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_start_backfill_job(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.StartBackfillJobRequest( - object_="object__value", - ) - - # Make the request - response = await client.start_backfill_job(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.StartBackfillJobRequest, dict]]): - The request object. Request for manually initiating a - backfill job for a specific stream object. - object_ (:class:`str`): - Required. The name of the stream - object resource to start a backfill job - for. - - This corresponds to the ``object_`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.types.StartBackfillJobResponse: - Response for manually initiating a - backfill job for a specific stream - object. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([object_]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.StartBackfillJobRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if object_ is not None: - request.object_ = object_ - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.start_backfill_job, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("object", request.object_), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def stop_backfill_job(self, - request: Optional[Union[datastream.StopBackfillJobRequest, dict]] = None, - *, - object_: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream.StopBackfillJobResponse: - r"""Use this method to stop a backfill job for the - specified stream object. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_stop_backfill_job(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.StopBackfillJobRequest( - object_="object__value", - ) - - # Make the request - response = await client.stop_backfill_job(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.StopBackfillJobRequest, dict]]): - The request object. Request for manually stopping a - running backfill job for a specific stream object. - object_ (:class:`str`): - Required. The name of the stream - object resource to stop the backfill job - for. - - This corresponds to the ``object_`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.types.StopBackfillJobResponse: - Response for manually stop a backfill - job for a specific stream object. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([object_]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.StopBackfillJobRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if object_ is not None: - request.object_ = object_ - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.stop_backfill_job, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("object", request.object_), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def fetch_static_ips(self, - request: Optional[Union[datastream.FetchStaticIpsRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.FetchStaticIpsAsyncPager: - r"""The FetchStaticIps API call exposes the static IP - addresses used by Datastream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_fetch_static_ips(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.FetchStaticIpsRequest( - name="name_value", - ) - - # Make the request - page_result = client.fetch_static_ips(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.FetchStaticIpsRequest, dict]]): - The request object. Request message for 'FetchStaticIps' - request. - name (:class:`str`): - Required. The resource name for the location for which - static IPs should be returned. Must be in the format - ``projects/*/locations/*``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.services.datastream.pagers.FetchStaticIpsAsyncPager: - Response message for a - 'FetchStaticIps' response. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.FetchStaticIpsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.fetch_static_ips, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - 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, - ) - - # Done; return the response. - return response - - async def create_private_connection(self, - request: Optional[Union[datastream.CreatePrivateConnectionRequest, dict]] = None, - *, - parent: Optional[str] = None, - private_connection: Optional[datastream_resources.PrivateConnection] = None, - private_connection_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Use this method to create a private connectivity - configuration. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_create_private_connection(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - private_connection = datastream_v1.PrivateConnection() - private_connection.display_name = "display_name_value" - - request = datastream_v1.CreatePrivateConnectionRequest( - parent="parent_value", - private_connection_id="private_connection_id_value", - private_connection=private_connection, - ) - - # Make the request - operation = client.create_private_connection(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.CreatePrivateConnectionRequest, dict]]): - The request object. Request for creating a private - connection. - parent (:class:`str`): - Required. The parent that owns the - collection of PrivateConnections. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - private_connection (:class:`google.cloud.datastream_v1.types.PrivateConnection`): - Required. The Private Connectivity - resource to create. - - This corresponds to the ``private_connection`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - private_connection_id (:class:`str`): - Required. The private connectivity - identifier. - - This corresponds to the ``private_connection_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.datastream_v1.types.PrivateConnection` The PrivateConnection resource is used to establish private connectivity - between Datastream and a customer's network. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, private_connection, private_connection_id]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.CreatePrivateConnectionRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if private_connection is not None: - request.private_connection = private_connection - if private_connection_id is not None: - request.private_connection_id = private_connection_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_private_connection, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - datastream_resources.PrivateConnection, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - async def get_private_connection(self, - request: Optional[Union[datastream.GetPrivateConnectionRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream_resources.PrivateConnection: - r"""Use this method to get details about a private - connectivity configuration. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_get_private_connection(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.GetPrivateConnectionRequest( - name="name_value", - ) - - # Make the request - response = await client.get_private_connection(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.GetPrivateConnectionRequest, dict]]): - The request object. Request to get a private connection - configuration. - name (:class:`str`): - Required. The name of the private - connectivity configuration to get. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.types.PrivateConnection: - The PrivateConnection resource is - used to establish private connectivity - between Datastream and a customer's - network. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.GetPrivateConnectionRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_private_connection, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_private_connections(self, - request: Optional[Union[datastream.ListPrivateConnectionsRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListPrivateConnectionsAsyncPager: - r"""Use this method to list private connectivity - configurations in a project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_list_private_connections(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.ListPrivateConnectionsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_private_connections(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.ListPrivateConnectionsRequest, dict]]): - The request object. Request for listing private - connections. - parent (:class:`str`): - Required. The parent that owns the - collection of private connectivity - configurations. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.services.datastream.pagers.ListPrivateConnectionsAsyncPager: - Response containing a list of private - connection configurations. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.ListPrivateConnectionsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_private_connections, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - 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, - ) - - # Done; return the response. - return response - - async def delete_private_connection(self, - request: Optional[Union[datastream.DeletePrivateConnectionRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Use this method to delete a private connectivity - configuration. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_delete_private_connection(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.DeletePrivateConnectionRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_private_connection(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.DeletePrivateConnectionRequest, dict]]): - The request object. Request to delete a private - connection. - name (:class:`str`): - Required. The name of the private - connectivity configuration to delete. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.DeletePrivateConnectionRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_private_connection, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - empty_pb2.Empty, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - async def create_route(self, - request: Optional[Union[datastream.CreateRouteRequest, dict]] = None, - *, - parent: Optional[str] = None, - route: Optional[datastream_resources.Route] = None, - route_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Use this method to create a route for a private - connectivity configuration in a project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_create_route(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - route = datastream_v1.Route() - route.display_name = "display_name_value" - route.destination_address = "destination_address_value" - - request = datastream_v1.CreateRouteRequest( - parent="parent_value", - route_id="route_id_value", - route=route, - ) - - # Make the request - operation = client.create_route(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.CreateRouteRequest, dict]]): - The request object. Route creation request. - parent (:class:`str`): - Required. The parent that owns the - collection of Routes. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - route (:class:`google.cloud.datastream_v1.types.Route`): - Required. The Route resource to - create. - - This corresponds to the ``route`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - route_id (:class:`str`): - Required. The Route identifier. - This corresponds to the ``route_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.datastream_v1.types.Route` The route resource is the child of the private connection resource, - used for defining a route for a private connection. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, route, route_id]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.CreateRouteRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if route is not None: - request.route = route - if route_id is not None: - request.route_id = route_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_route, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - datastream_resources.Route, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - async def get_route(self, - request: Optional[Union[datastream.GetRouteRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream_resources.Route: - r"""Use this method to get details about a route. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_get_route(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.GetRouteRequest( - name="name_value", - ) - - # Make the request - response = await client.get_route(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.GetRouteRequest, dict]]): - The request object. Route get request. - name (:class:`str`): - Required. The name of the Route - resource to get. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.types.Route: - The route resource is the child of - the private connection resource, used - for defining a route for a private - connection. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.GetRouteRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_route, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_routes(self, - request: Optional[Union[datastream.ListRoutesRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListRoutesAsyncPager: - r"""Use this method to list routes created for a private - connectivity configuration in a project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_list_routes(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.ListRoutesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_routes(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.ListRoutesRequest, dict]]): - The request object. Route list request. - parent (:class:`str`): - Required. The parent that owns the - collection of Routess. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.services.datastream.pagers.ListRoutesAsyncPager: - Route list response. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.ListRoutesRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_routes, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - 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, - ) - - # Done; return the response. - return response - - async def delete_route(self, - request: Optional[Union[datastream.DeleteRouteRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Use this method to delete a route. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - async def sample_delete_route(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.DeleteRouteRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_route(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1.types.DeleteRouteRequest, dict]]): - The request object. Route deletion request. - name (:class:`str`): - Required. The name of the Route - resource to delete. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.DeleteRouteRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_route, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - empty_pb2.Empty, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - async def list_operations( - self, - request: Optional[operations_pb2.ListOperationsRequest] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.ListOperationsResponse: - r"""Lists operations that match the specified filter in the request. - - Args: - request (:class:`~.operations_pb2.ListOperationsRequest`): - The request object. Request message for - `ListOperations` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.operations_pb2.ListOperationsResponse: - Response message for ``ListOperations`` method. - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = operations_pb2.ListOperationsRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._client._transport.list_operations, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - async def get_operation( - self, - request: Optional[operations_pb2.GetOperationRequest] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.Operation: - r"""Gets the latest state of a long-running operation. - - Args: - request (:class:`~.operations_pb2.GetOperationRequest`): - The request object. Request message for - `GetOperation` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.operations_pb2.Operation: - An ``Operation`` object. - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = operations_pb2.GetOperationRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._client._transport.get_operation, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - async def delete_operation( - self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a long-running operation. - - This method indicates that the client is no longer interested - in the operation result. It does not cancel the operation. - If the server doesn't support this method, it returns - `google.rpc.Code.UNIMPLEMENTED`. - - Args: - request (:class:`~.operations_pb2.DeleteOperationRequest`): - The request object. Request message for - `DeleteOperation` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - None - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = operations_pb2.DeleteOperationRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._client._transport.delete_operation, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) - - async def cancel_operation( - self, - request: Optional[operations_pb2.CancelOperationRequest] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Starts asynchronous cancellation on a long-running operation. - - The server makes a best effort to cancel the operation, but success - is not guaranteed. If the server doesn't support this method, it returns - `google.rpc.Code.UNIMPLEMENTED`. - - Args: - request (:class:`~.operations_pb2.CancelOperationRequest`): - The request object. Request message for - `CancelOperation` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - None - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = operations_pb2.CancelOperationRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._client._transport.cancel_operation, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) - - async def get_location( - self, - request: Optional[locations_pb2.GetLocationRequest] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> locations_pb2.Location: - r"""Gets information about a location. - - Args: - request (:class:`~.location_pb2.GetLocationRequest`): - The request object. Request message for - `GetLocation` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.location_pb2.Location: - Location object. - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = locations_pb2.GetLocationRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._client._transport.get_location, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - async def list_locations( - self, - request: Optional[locations_pb2.ListLocationsRequest] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> locations_pb2.ListLocationsResponse: - r"""Lists information about the supported locations for this service. - - Args: - request (:class:`~.location_pb2.ListLocationsRequest`): - The request object. Request message for - `ListLocations` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.location_pb2.ListLocationsResponse: - Response message for ``ListLocations`` method. - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = locations_pb2.ListLocationsRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._client._transport.list_locations, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - async def __aenter__(self): - return self - - async def __aexit__(self, exc_type, exc, tb): - await self.transport.close() - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) - - -__all__ = ( - "DatastreamAsyncClient", -) diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/client.py b/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/client.py deleted file mode 100644 index cc2510d..0000000 --- a/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/client.py +++ /dev/null @@ -1,3685 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from collections import OrderedDict -import os -import re -from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union, cast - -from google.cloud.datastream_v1 import gapic_version as package_version - -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.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 - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -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.cloud.location import locations_pb2 # type: ignore -from google.iam.v1 import iam_policy_pb2 # type: ignore -from google.iam.v1 import policy_pb2 # type: ignore -from google.longrunning import operations_pb2 -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 import DatastreamGrpcTransport -from .transports.grpc_asyncio import DatastreamGrpcAsyncIOTransport - - -class DatastreamClientMeta(type): - """Metaclass for the Datastream client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - _transport_registry = OrderedDict() # type: Dict[str, Type[DatastreamTransport]] - _transport_registry["grpc"] = DatastreamGrpcTransport - _transport_registry["grpc_asyncio"] = DatastreamGrpcAsyncIOTransport - - def get_transport_class(cls, - label: Optional[str] = None, - ) -> Type[DatastreamTransport]: - """Returns an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class DatastreamClient(metaclass=DatastreamClientMeta): - """Datastream service""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Converts api endpoint to mTLS endpoint. - - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "datastream.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials - info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - DatastreamClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - DatastreamClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> DatastreamTransport: - """Returns the transport used by the client instance. - - Returns: - DatastreamTransport: The transport used by the client - instance. - """ - return self._transport - - @staticmethod - def connection_profile_path(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, ) - - @staticmethod - def parse_connection_profile_path(path: str) -> Dict[str,str]: - """Parses a connection_profile path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/connectionProfiles/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - 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, ) - - @staticmethod - def parse_networks_path(path: str) -> Dict[str,str]: - """Parses a networks path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/global/networks/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def private_connection_path(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, ) - - @staticmethod - def parse_private_connection_path(path: str) -> Dict[str,str]: - """Parses a private_connection path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/privateConnections/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def route_path(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(project=project, location=location, private_connection=private_connection, route=route, ) - - @staticmethod - def parse_route_path(path: str) -> Dict[str,str]: - """Parses a route path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/privateConnections/(?P.+?)/routes/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - 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, ) - - @staticmethod - def parse_stream_path(path: str) -> Dict[str,str]: - """Parses a stream path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/streams/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def stream_object_path(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, ) - - @staticmethod - def parse_stream_object_path(path: str) -> Dict[str,str]: - """Parses a stream_object path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/streams/(?P.+?)/objects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - 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, ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str,str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str, ) -> str: - """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder, ) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str,str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str, ) -> str: - """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization, ) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str,str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str, ) -> str: - """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project, ) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str,str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - 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, ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str,str]: - """Parse a location path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @classmethod - def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[client_options_lib.ClientOptions] = None): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variable is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - if client_options is None: - client_options = client_options_lib.ClientOptions() - use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_client_cert not in ("true", "false"): - raise ValueError("Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`") - if use_mtls_endpoint not in ("auto", "never", "always"): - raise MutualTLSChannelError("Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`") - - # Figure out the client cert source to use. - client_cert_source = None - if use_client_cert == "true": - if client_options.client_cert_source: - client_cert_source = client_options.client_cert_source - elif mtls.has_default_client_cert_source(): - client_cert_source = mtls.default_client_cert_source() - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - elif use_mtls_endpoint == "always" or (use_mtls_endpoint == "auto" and client_cert_source): - api_endpoint = cls.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = cls.DEFAULT_ENDPOINT - - return api_endpoint, client_cert_source - - def __init__(self, *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Optional[Union[str, DatastreamTransport]] = None, - client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the datastream client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, DatastreamTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - client_options = cast(client_options_lib.ClientOptions, client_options) - - api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source(client_options) - - api_key_value = getattr(client_options, "api_key", None) - if api_key_value and credentials: - raise ValueError("client_options.api_key and credentials are mutually exclusive") - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, DatastreamTransport): - # transport is a DatastreamTransport instance. - if credentials or client_options.credentials_file or api_key_value: - raise ValueError("When providing a transport instance, " - "provide its credentials directly.") - if client_options.scopes: - raise ValueError( - "When providing a transport instance, provide its scopes " - "directly." - ) - self._transport = transport - else: - import google.auth._default # type: ignore - - if api_key_value and hasattr(google.auth._default, "get_api_key_credentials"): - credentials = google.auth._default.get_api_key_credentials(api_key_value) - - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, - credentials_file=client_options.credentials_file, - host=api_endpoint, - scopes=client_options.scopes, - client_cert_source_for_mtls=client_cert_source_func, - quota_project_id=client_options.quota_project_id, - client_info=client_info, - always_use_jwt_access=True, - api_audience=client_options.api_audience, - ) - - def list_connection_profiles(self, - request: Optional[Union[datastream.ListConnectionProfilesRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListConnectionProfilesPager: - r"""Use this method to list connection profiles created - in a project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_list_connection_profiles(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.ListConnectionProfilesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_connection_profiles(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.ListConnectionProfilesRequest, dict]): - The request object. Request message for listing - connection profiles. - parent (str): - Required. The parent that owns the - collection of connection profiles. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.services.datastream.pagers.ListConnectionProfilesPager: - Response message for listing - connection profiles. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.ListConnectionProfilesRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.ListConnectionProfilesRequest): - request = datastream.ListConnectionProfilesRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_connection_profiles] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - 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, - ) - - # Done; return the response. - return response - - def get_connection_profile(self, - request: Optional[Union[datastream.GetConnectionProfileRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream_resources.ConnectionProfile: - r"""Use this method to get details about a connection - profile. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_get_connection_profile(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.GetConnectionProfileRequest( - name="name_value", - ) - - # Make the request - response = client.get_connection_profile(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.GetConnectionProfileRequest, dict]): - The request object. Request message for getting a - connection profile. - name (str): - Required. The name of the connection - profile resource to get. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.types.ConnectionProfile: - A set of reusable connection - configurations to be used as a source or - destination for a stream. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.GetConnectionProfileRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.GetConnectionProfileRequest): - request = datastream.GetConnectionProfileRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_connection_profile] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def create_connection_profile(self, - request: Optional[Union[datastream.CreateConnectionProfileRequest, dict]] = None, - *, - parent: Optional[str] = None, - connection_profile: Optional[datastream_resources.ConnectionProfile] = None, - connection_profile_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Use this method to create a connection profile in a - project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_create_connection_profile(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - connection_profile = datastream_v1.ConnectionProfile() - connection_profile.oracle_profile.hostname = "hostname_value" - connection_profile.oracle_profile.username = "username_value" - connection_profile.oracle_profile.password = "password_value" - connection_profile.oracle_profile.database_service = "database_service_value" - connection_profile.display_name = "display_name_value" - - request = datastream_v1.CreateConnectionProfileRequest( - parent="parent_value", - connection_profile_id="connection_profile_id_value", - connection_profile=connection_profile, - ) - - # Make the request - operation = client.create_connection_profile(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.CreateConnectionProfileRequest, dict]): - The request object. Request message for creating a - connection profile. - parent (str): - Required. The parent that owns the - collection of ConnectionProfiles. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - connection_profile (google.cloud.datastream_v1.types.ConnectionProfile): - Required. The connection profile - resource to create. - - This corresponds to the ``connection_profile`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - connection_profile_id (str): - Required. The connection profile - identifier. - - This corresponds to the ``connection_profile_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.datastream_v1.types.ConnectionProfile` A set of reusable connection configurations to be used as a source or - destination for a stream. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, connection_profile, connection_profile_id]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.CreateConnectionProfileRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.CreateConnectionProfileRequest): - request = datastream.CreateConnectionProfileRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if connection_profile is not None: - request.connection_profile = connection_profile - if connection_profile_id is not None: - request.connection_profile_id = connection_profile_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_connection_profile] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - datastream_resources.ConnectionProfile, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - def update_connection_profile(self, - request: Optional[Union[datastream.UpdateConnectionProfileRequest, dict]] = None, - *, - connection_profile: Optional[datastream_resources.ConnectionProfile] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Use this method to update the parameters of a - connection profile. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_update_connection_profile(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - connection_profile = datastream_v1.ConnectionProfile() - connection_profile.oracle_profile.hostname = "hostname_value" - connection_profile.oracle_profile.username = "username_value" - connection_profile.oracle_profile.password = "password_value" - connection_profile.oracle_profile.database_service = "database_service_value" - connection_profile.display_name = "display_name_value" - - request = datastream_v1.UpdateConnectionProfileRequest( - connection_profile=connection_profile, - ) - - # Make the request - operation = client.update_connection_profile(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.UpdateConnectionProfileRequest, dict]): - The request object. Connection profile update message. - connection_profile (google.cloud.datastream_v1.types.ConnectionProfile): - Required. The connection profile to - update. - - This corresponds to the ``connection_profile`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Optional. Field mask is used to specify the fields to be - overwritten in the ConnectionProfile resource by the - update. The fields specified in the update_mask are - relative to the resource, not the full request. A field - will be overwritten if it is in the mask. If the user - does not provide a mask then all fields will be - overwritten. - - This corresponds to the ``update_mask`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.datastream_v1.types.ConnectionProfile` A set of reusable connection configurations to be used as a source or - destination for a stream. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([connection_profile, update_mask]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.UpdateConnectionProfileRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.UpdateConnectionProfileRequest): - request = datastream.UpdateConnectionProfileRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if connection_profile is not None: - request.connection_profile = connection_profile - if update_mask is not None: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_connection_profile] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("connection_profile.name", request.connection_profile.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - datastream_resources.ConnectionProfile, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - def delete_connection_profile(self, - request: Optional[Union[datastream.DeleteConnectionProfileRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Use this method to delete a connection profile. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_delete_connection_profile(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.DeleteConnectionProfileRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_connection_profile(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.DeleteConnectionProfileRequest, dict]): - The request object. Request message for deleting a - connection profile. - name (str): - Required. The name of the connection - profile resource to delete. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.DeleteConnectionProfileRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.DeleteConnectionProfileRequest): - request = datastream.DeleteConnectionProfileRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_connection_profile] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - empty_pb2.Empty, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - def discover_connection_profile(self, - request: Optional[Union[datastream.DiscoverConnectionProfileRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream.DiscoverConnectionProfileResponse: - r"""Use this method to discover a connection profile. - The discover API call exposes the data objects and - metadata belonging to the profile. Typically, a request - returns children data objects of a parent data object - that's optionally supplied in the request. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_discover_connection_profile(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - connection_profile = datastream_v1.ConnectionProfile() - connection_profile.oracle_profile.hostname = "hostname_value" - connection_profile.oracle_profile.username = "username_value" - connection_profile.oracle_profile.password = "password_value" - connection_profile.oracle_profile.database_service = "database_service_value" - connection_profile.display_name = "display_name_value" - - request = datastream_v1.DiscoverConnectionProfileRequest( - connection_profile=connection_profile, - full_hierarchy=True, - parent="parent_value", - ) - - # Make the request - response = client.discover_connection_profile(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.DiscoverConnectionProfileRequest, dict]): - The request object. Request message for 'discover' - ConnectionProfile request. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.types.DiscoverConnectionProfileResponse: - Response from a discover request. - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a datastream.DiscoverConnectionProfileRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.DiscoverConnectionProfileRequest): - request = datastream.DiscoverConnectionProfileRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.discover_connection_profile] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_streams(self, - request: Optional[Union[datastream.ListStreamsRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListStreamsPager: - r"""Use this method to list streams in a project and - location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_list_streams(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.ListStreamsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_streams(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.ListStreamsRequest, dict]): - The request object. Request message for listing streams. - parent (str): - Required. The parent that owns the - collection of streams. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.services.datastream.pagers.ListStreamsPager: - Response message for listing streams. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.ListStreamsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.ListStreamsRequest): - request = datastream.ListStreamsRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_streams] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - 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, - ) - - # Done; return the response. - return response - - def get_stream(self, - request: Optional[Union[datastream.GetStreamRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream_resources.Stream: - r"""Use this method to get details about a stream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_get_stream(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.GetStreamRequest( - name="name_value", - ) - - # Make the request - response = client.get_stream(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.GetStreamRequest, dict]): - The request object. Request message for getting a - stream. - name (str): - Required. The name of the stream - resource to get. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.types.Stream: - A resource representing streaming - data from a source to a destination. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.GetStreamRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.GetStreamRequest): - request = datastream.GetStreamRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_stream] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def create_stream(self, - request: Optional[Union[datastream.CreateStreamRequest, dict]] = None, - *, - parent: Optional[str] = None, - stream: Optional[datastream_resources.Stream] = None, - stream_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Use this method to create a stream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_create_stream(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - stream = datastream_v1.Stream() - stream.display_name = "display_name_value" - stream.source_config.source_connection_profile = "source_connection_profile_value" - stream.destination_config.destination_connection_profile = "destination_connection_profile_value" - - request = datastream_v1.CreateStreamRequest( - parent="parent_value", - stream_id="stream_id_value", - stream=stream, - ) - - # Make the request - operation = client.create_stream(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.CreateStreamRequest, dict]): - The request object. Request message for creating a - stream. - parent (str): - Required. The parent that owns the - collection of streams. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - stream (google.cloud.datastream_v1.types.Stream): - Required. The stream resource to - create. - - This corresponds to the ``stream`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - stream_id (str): - Required. The stream identifier. - This corresponds to the ``stream_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.datastream_v1.types.Stream` A - resource representing streaming data from a source to a - destination. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, stream, stream_id]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.CreateStreamRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.CreateStreamRequest): - request = datastream.CreateStreamRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if stream is not None: - request.stream = stream - if stream_id is not None: - request.stream_id = stream_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_stream] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - datastream_resources.Stream, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - def update_stream(self, - request: Optional[Union[datastream.UpdateStreamRequest, dict]] = None, - *, - stream: Optional[datastream_resources.Stream] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Use this method to update the configuration of a - stream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_update_stream(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - stream = datastream_v1.Stream() - stream.display_name = "display_name_value" - stream.source_config.source_connection_profile = "source_connection_profile_value" - stream.destination_config.destination_connection_profile = "destination_connection_profile_value" - - request = datastream_v1.UpdateStreamRequest( - stream=stream, - ) - - # Make the request - operation = client.update_stream(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.UpdateStreamRequest, dict]): - The request object. Request message for updating a - stream. - stream (google.cloud.datastream_v1.types.Stream): - Required. The stream resource to - update. - - This corresponds to the ``stream`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Optional. Field mask is used to specify the fields to be - overwritten in the stream resource by the update. The - fields specified in the update_mask are relative to the - resource, not the full request. A field will be - overwritten if it is in the mask. If the user does not - provide a mask then all fields will be overwritten. - - This corresponds to the ``update_mask`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.datastream_v1.types.Stream` A - resource representing streaming data from a source to a - destination. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([stream, update_mask]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.UpdateStreamRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.UpdateStreamRequest): - request = datastream.UpdateStreamRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if stream is not None: - request.stream = stream - if update_mask is not None: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_stream] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("stream.name", request.stream.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - datastream_resources.Stream, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - def delete_stream(self, - request: Optional[Union[datastream.DeleteStreamRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Use this method to delete a stream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_delete_stream(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.DeleteStreamRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_stream(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.DeleteStreamRequest, dict]): - The request object. Request message for deleting a - stream. - name (str): - Required. The name of the stream - resource to delete. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.DeleteStreamRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.DeleteStreamRequest): - request = datastream.DeleteStreamRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_stream] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - empty_pb2.Empty, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - def get_stream_object(self, - request: Optional[Union[datastream.GetStreamObjectRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream_resources.StreamObject: - r"""Use this method to get details about a stream object. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_get_stream_object(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.GetStreamObjectRequest( - name="name_value", - ) - - # Make the request - response = client.get_stream_object(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.GetStreamObjectRequest, dict]): - The request object. Request for fetching a specific - stream object. - name (str): - Required. The name of the stream - object resource to get. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.types.StreamObject: - A specific stream object (e.g a - specific DB table). - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.GetStreamObjectRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.GetStreamObjectRequest): - request = datastream.GetStreamObjectRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_stream_object] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def lookup_stream_object(self, - request: Optional[Union[datastream.LookupStreamObjectRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream_resources.StreamObject: - r"""Use this method to look up a stream object by its - source object identifier. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_lookup_stream_object(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - source_object_identifier = datastream_v1.SourceObjectIdentifier() - source_object_identifier.oracle_identifier.schema = "schema_value" - source_object_identifier.oracle_identifier.table = "table_value" - - request = datastream_v1.LookupStreamObjectRequest( - parent="parent_value", - source_object_identifier=source_object_identifier, - ) - - # Make the request - response = client.lookup_stream_object(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.LookupStreamObjectRequest, dict]): - The request object. Request for looking up a specific - stream object by its source object identifier. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.types.StreamObject: - A specific stream object (e.g a - specific DB table). - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a datastream.LookupStreamObjectRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.LookupStreamObjectRequest): - request = datastream.LookupStreamObjectRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.lookup_stream_object] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_stream_objects(self, - request: Optional[Union[datastream.ListStreamObjectsRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListStreamObjectsPager: - r"""Use this method to list the objects of a specific - stream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_list_stream_objects(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.ListStreamObjectsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_stream_objects(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.ListStreamObjectsRequest, dict]): - The request object. Request for listing all objects for - a specific stream. - parent (str): - Required. The parent stream that owns - the collection of objects. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.services.datastream.pagers.ListStreamObjectsPager: - Response containing the objects for a - stream. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.ListStreamObjectsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.ListStreamObjectsRequest): - request = datastream.ListStreamObjectsRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_stream_objects] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - 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, - ) - - # Done; return the response. - return response - - def start_backfill_job(self, - request: Optional[Union[datastream.StartBackfillJobRequest, dict]] = None, - *, - object_: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream.StartBackfillJobResponse: - r"""Use this method to start a backfill job for the - specified stream object. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_start_backfill_job(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.StartBackfillJobRequest( - object_="object__value", - ) - - # Make the request - response = client.start_backfill_job(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.StartBackfillJobRequest, dict]): - The request object. Request for manually initiating a - backfill job for a specific stream object. - object_ (str): - Required. The name of the stream - object resource to start a backfill job - for. - - This corresponds to the ``object_`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.types.StartBackfillJobResponse: - Response for manually initiating a - backfill job for a specific stream - object. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([object_]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.StartBackfillJobRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.StartBackfillJobRequest): - request = datastream.StartBackfillJobRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if object_ is not None: - request.object_ = object_ - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.start_backfill_job] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("object", request.object_), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def stop_backfill_job(self, - request: Optional[Union[datastream.StopBackfillJobRequest, dict]] = None, - *, - object_: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream.StopBackfillJobResponse: - r"""Use this method to stop a backfill job for the - specified stream object. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_stop_backfill_job(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.StopBackfillJobRequest( - object_="object__value", - ) - - # Make the request - response = client.stop_backfill_job(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.StopBackfillJobRequest, dict]): - The request object. Request for manually stopping a - running backfill job for a specific stream object. - object_ (str): - Required. The name of the stream - object resource to stop the backfill job - for. - - This corresponds to the ``object_`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.types.StopBackfillJobResponse: - Response for manually stop a backfill - job for a specific stream object. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([object_]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.StopBackfillJobRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.StopBackfillJobRequest): - request = datastream.StopBackfillJobRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if object_ is not None: - request.object_ = object_ - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.stop_backfill_job] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("object", request.object_), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def fetch_static_ips(self, - request: Optional[Union[datastream.FetchStaticIpsRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.FetchStaticIpsPager: - r"""The FetchStaticIps API call exposes the static IP - addresses used by Datastream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_fetch_static_ips(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.FetchStaticIpsRequest( - name="name_value", - ) - - # Make the request - page_result = client.fetch_static_ips(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.FetchStaticIpsRequest, dict]): - The request object. Request message for 'FetchStaticIps' - request. - name (str): - Required. The resource name for the location for which - static IPs should be returned. Must be in the format - ``projects/*/locations/*``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.services.datastream.pagers.FetchStaticIpsPager: - Response message for a - 'FetchStaticIps' response. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.FetchStaticIpsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.FetchStaticIpsRequest): - request = datastream.FetchStaticIpsRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.fetch_static_ips] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - 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, - ) - - # Done; return the response. - return response - - def create_private_connection(self, - request: Optional[Union[datastream.CreatePrivateConnectionRequest, dict]] = None, - *, - parent: Optional[str] = None, - private_connection: Optional[datastream_resources.PrivateConnection] = None, - private_connection_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Use this method to create a private connectivity - configuration. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_create_private_connection(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - private_connection = datastream_v1.PrivateConnection() - private_connection.display_name = "display_name_value" - - request = datastream_v1.CreatePrivateConnectionRequest( - parent="parent_value", - private_connection_id="private_connection_id_value", - private_connection=private_connection, - ) - - # Make the request - operation = client.create_private_connection(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.CreatePrivateConnectionRequest, dict]): - The request object. Request for creating a private - connection. - parent (str): - Required. The parent that owns the - collection of PrivateConnections. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - private_connection (google.cloud.datastream_v1.types.PrivateConnection): - Required. The Private Connectivity - resource to create. - - This corresponds to the ``private_connection`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - private_connection_id (str): - Required. The private connectivity - identifier. - - This corresponds to the ``private_connection_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.datastream_v1.types.PrivateConnection` The PrivateConnection resource is used to establish private connectivity - between Datastream and a customer's network. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, private_connection, private_connection_id]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.CreatePrivateConnectionRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.CreatePrivateConnectionRequest): - request = datastream.CreatePrivateConnectionRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if private_connection is not None: - request.private_connection = private_connection - if private_connection_id is not None: - request.private_connection_id = private_connection_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_private_connection] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - datastream_resources.PrivateConnection, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - def get_private_connection(self, - request: Optional[Union[datastream.GetPrivateConnectionRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream_resources.PrivateConnection: - r"""Use this method to get details about a private - connectivity configuration. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_get_private_connection(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.GetPrivateConnectionRequest( - name="name_value", - ) - - # Make the request - response = client.get_private_connection(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.GetPrivateConnectionRequest, dict]): - The request object. Request to get a private connection - configuration. - name (str): - Required. The name of the private - connectivity configuration to get. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.types.PrivateConnection: - The PrivateConnection resource is - used to establish private connectivity - between Datastream and a customer's - network. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.GetPrivateConnectionRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.GetPrivateConnectionRequest): - request = datastream.GetPrivateConnectionRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_private_connection] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_private_connections(self, - request: Optional[Union[datastream.ListPrivateConnectionsRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListPrivateConnectionsPager: - r"""Use this method to list private connectivity - configurations in a project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_list_private_connections(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.ListPrivateConnectionsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_private_connections(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.ListPrivateConnectionsRequest, dict]): - The request object. Request for listing private - connections. - parent (str): - Required. The parent that owns the - collection of private connectivity - configurations. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.services.datastream.pagers.ListPrivateConnectionsPager: - Response containing a list of private - connection configurations. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.ListPrivateConnectionsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.ListPrivateConnectionsRequest): - request = datastream.ListPrivateConnectionsRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_private_connections] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - 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, - ) - - # Done; return the response. - return response - - def delete_private_connection(self, - request: Optional[Union[datastream.DeletePrivateConnectionRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Use this method to delete a private connectivity - configuration. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_delete_private_connection(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.DeletePrivateConnectionRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_private_connection(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.DeletePrivateConnectionRequest, dict]): - The request object. Request to delete a private - connection. - name (str): - Required. The name of the private - connectivity configuration to delete. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.DeletePrivateConnectionRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.DeletePrivateConnectionRequest): - request = datastream.DeletePrivateConnectionRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_private_connection] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - empty_pb2.Empty, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - def create_route(self, - request: Optional[Union[datastream.CreateRouteRequest, dict]] = None, - *, - parent: Optional[str] = None, - route: Optional[datastream_resources.Route] = None, - route_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Use this method to create a route for a private - connectivity configuration in a project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_create_route(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - route = datastream_v1.Route() - route.display_name = "display_name_value" - route.destination_address = "destination_address_value" - - request = datastream_v1.CreateRouteRequest( - parent="parent_value", - route_id="route_id_value", - route=route, - ) - - # Make the request - operation = client.create_route(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.CreateRouteRequest, dict]): - The request object. Route creation request. - parent (str): - Required. The parent that owns the - collection of Routes. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - route (google.cloud.datastream_v1.types.Route): - Required. The Route resource to - create. - - This corresponds to the ``route`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - route_id (str): - Required. The Route identifier. - This corresponds to the ``route_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.datastream_v1.types.Route` The route resource is the child of the private connection resource, - used for defining a route for a private connection. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, route, route_id]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.CreateRouteRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.CreateRouteRequest): - request = datastream.CreateRouteRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if route is not None: - request.route = route - if route_id is not None: - request.route_id = route_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_route] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - datastream_resources.Route, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - def get_route(self, - request: Optional[Union[datastream.GetRouteRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream_resources.Route: - r"""Use this method to get details about a route. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_get_route(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.GetRouteRequest( - name="name_value", - ) - - # Make the request - response = client.get_route(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.GetRouteRequest, dict]): - The request object. Route get request. - name (str): - Required. The name of the Route - resource to get. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.types.Route: - The route resource is the child of - the private connection resource, used - for defining a route for a private - connection. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.GetRouteRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.GetRouteRequest): - request = datastream.GetRouteRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_route] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_routes(self, - request: Optional[Union[datastream.ListRoutesRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListRoutesPager: - r"""Use this method to list routes created for a private - connectivity configuration in a project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_list_routes(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.ListRoutesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_routes(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.ListRoutesRequest, dict]): - The request object. Route list request. - parent (str): - Required. The parent that owns the - collection of Routess. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1.services.datastream.pagers.ListRoutesPager: - Route list response. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.ListRoutesRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.ListRoutesRequest): - request = datastream.ListRoutesRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_routes] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - 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, - ) - - # Done; return the response. - return response - - def delete_route(self, - request: Optional[Union[datastream.DeleteRouteRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Use this method to delete a route. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1 - - def sample_delete_route(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.DeleteRouteRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_route(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1.types.DeleteRouteRequest, dict]): - The request object. Route deletion request. - name (str): - Required. The name of the Route - resource to delete. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.DeleteRouteRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.DeleteRouteRequest): - request = datastream.DeleteRouteRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_route] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - empty_pb2.Empty, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - def __enter__(self) -> "DatastreamClient": - return self - - def __exit__(self, type, value, traceback): - """Releases underlying transport's resources. - - .. warning:: - ONLY use as a context manager if the transport is NOT shared - with other clients! Exiting the with block will CLOSE the transport - and may cause errors in other clients! - """ - self.transport.close() - - def list_operations( - self, - request: Optional[operations_pb2.ListOperationsRequest] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.ListOperationsResponse: - r"""Lists operations that match the specified filter in the request. - - Args: - request (:class:`~.operations_pb2.ListOperationsRequest`): - The request object. Request message for - `ListOperations` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.operations_pb2.ListOperationsResponse: - Response message for ``ListOperations`` method. - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = operations_pb2.ListOperationsRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._transport.list_operations, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - def get_operation( - self, - request: Optional[operations_pb2.GetOperationRequest] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.Operation: - r"""Gets the latest state of a long-running operation. - - Args: - request (:class:`~.operations_pb2.GetOperationRequest`): - The request object. Request message for - `GetOperation` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.operations_pb2.Operation: - An ``Operation`` object. - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = operations_pb2.GetOperationRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._transport.get_operation, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - def delete_operation( - self, - request: Optional[operations_pb2.DeleteOperationRequest] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a long-running operation. - - This method indicates that the client is no longer interested - in the operation result. It does not cancel the operation. - If the server doesn't support this method, it returns - `google.rpc.Code.UNIMPLEMENTED`. - - Args: - request (:class:`~.operations_pb2.DeleteOperationRequest`): - The request object. Request message for - `DeleteOperation` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - None - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = operations_pb2.DeleteOperationRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._transport.delete_operation, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - rpc(request, retry=retry, timeout=timeout, metadata=metadata,) - - def cancel_operation( - self, - request: Optional[operations_pb2.CancelOperationRequest] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Starts asynchronous cancellation on a long-running operation. - - The server makes a best effort to cancel the operation, but success - is not guaranteed. If the server doesn't support this method, it returns - `google.rpc.Code.UNIMPLEMENTED`. - - Args: - request (:class:`~.operations_pb2.CancelOperationRequest`): - The request object. Request message for - `CancelOperation` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - None - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = operations_pb2.CancelOperationRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._transport.cancel_operation, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - rpc(request, retry=retry, timeout=timeout, metadata=metadata,) - - def get_location( - self, - request: Optional[locations_pb2.GetLocationRequest] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> locations_pb2.Location: - r"""Gets information about a location. - - Args: - request (:class:`~.location_pb2.GetLocationRequest`): - The request object. Request message for - `GetLocation` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.location_pb2.Location: - Location object. - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = locations_pb2.GetLocationRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._transport.get_location, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - def list_locations( - self, - request: Optional[locations_pb2.ListLocationsRequest] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> locations_pb2.ListLocationsResponse: - r"""Lists information about the supported locations for this service. - - Args: - request (:class:`~.location_pb2.ListLocationsRequest`): - The request object. Request message for - `ListLocations` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.location_pb2.ListLocationsResponse: - Response message for ``ListLocations`` method. - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = locations_pb2.ListLocationsRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._transport.list_locations, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) - - -__all__ = ( - "DatastreamClient", -) diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/pagers.py b/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/pagers.py deleted file mode 100644 index 87bf95d..0000000 --- a/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/pagers.py +++ /dev/null @@ -1,745 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from typing import Any, AsyncIterator, Awaitable, Callable, Sequence, Tuple, Optional, Iterator - -from google.cloud.datastream_v1.types import datastream -from google.cloud.datastream_v1.types import datastream_resources - - -class ListConnectionProfilesPager: - """A pager for iterating through ``list_connection_profiles`` requests. - - This class thinly wraps an initial - :class:`google.cloud.datastream_v1.types.ListConnectionProfilesResponse` object, and - provides an ``__iter__`` method to iterate through its - ``connection_profiles`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListConnectionProfiles`` requests and continue to iterate - through the ``connection_profiles`` field on the - corresponding responses. - - All the usual :class:`google.cloud.datastream_v1.types.ListConnectionProfilesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., datastream.ListConnectionProfilesResponse], - request: datastream.ListConnectionProfilesRequest, - response: datastream.ListConnectionProfilesResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.datastream_v1.types.ListConnectionProfilesRequest): - The initial request object. - response (google.cloud.datastream_v1.types.ListConnectionProfilesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = datastream.ListConnectionProfilesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[datastream.ListConnectionProfilesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[datastream_resources.ConnectionProfile]: - for page in self.pages: - yield from page.connection_profiles - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListConnectionProfilesAsyncPager: - """A pager for iterating through ``list_connection_profiles`` requests. - - This class thinly wraps an initial - :class:`google.cloud.datastream_v1.types.ListConnectionProfilesResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``connection_profiles`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListConnectionProfiles`` requests and continue to iterate - through the ``connection_profiles`` field on the - corresponding responses. - - All the usual :class:`google.cloud.datastream_v1.types.ListConnectionProfilesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[datastream.ListConnectionProfilesResponse]], - request: datastream.ListConnectionProfilesRequest, - response: datastream.ListConnectionProfilesResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.datastream_v1.types.ListConnectionProfilesRequest): - The initial request object. - response (google.cloud.datastream_v1.types.ListConnectionProfilesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = datastream.ListConnectionProfilesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[datastream.ListConnectionProfilesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[datastream_resources.ConnectionProfile]: - async def async_generator(): - async for page in self.pages: - for response in page.connection_profiles: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListStreamsPager: - """A pager for iterating through ``list_streams`` requests. - - This class thinly wraps an initial - :class:`google.cloud.datastream_v1.types.ListStreamsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``streams`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListStreams`` requests and continue to iterate - through the ``streams`` field on the - corresponding responses. - - All the usual :class:`google.cloud.datastream_v1.types.ListStreamsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., datastream.ListStreamsResponse], - request: datastream.ListStreamsRequest, - response: datastream.ListStreamsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.datastream_v1.types.ListStreamsRequest): - The initial request object. - response (google.cloud.datastream_v1.types.ListStreamsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = datastream.ListStreamsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[datastream.ListStreamsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[datastream_resources.Stream]: - for page in self.pages: - yield from page.streams - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListStreamsAsyncPager: - """A pager for iterating through ``list_streams`` requests. - - This class thinly wraps an initial - :class:`google.cloud.datastream_v1.types.ListStreamsResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``streams`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListStreams`` requests and continue to iterate - through the ``streams`` field on the - corresponding responses. - - All the usual :class:`google.cloud.datastream_v1.types.ListStreamsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[datastream.ListStreamsResponse]], - request: datastream.ListStreamsRequest, - response: datastream.ListStreamsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.datastream_v1.types.ListStreamsRequest): - The initial request object. - response (google.cloud.datastream_v1.types.ListStreamsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = datastream.ListStreamsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[datastream.ListStreamsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[datastream_resources.Stream]: - async def async_generator(): - async for page in self.pages: - for response in page.streams: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListStreamObjectsPager: - """A pager for iterating through ``list_stream_objects`` requests. - - This class thinly wraps an initial - :class:`google.cloud.datastream_v1.types.ListStreamObjectsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``stream_objects`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListStreamObjects`` requests and continue to iterate - through the ``stream_objects`` field on the - corresponding responses. - - All the usual :class:`google.cloud.datastream_v1.types.ListStreamObjectsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., datastream.ListStreamObjectsResponse], - request: datastream.ListStreamObjectsRequest, - response: datastream.ListStreamObjectsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.datastream_v1.types.ListStreamObjectsRequest): - The initial request object. - response (google.cloud.datastream_v1.types.ListStreamObjectsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = datastream.ListStreamObjectsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[datastream.ListStreamObjectsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[datastream_resources.StreamObject]: - for page in self.pages: - yield from page.stream_objects - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListStreamObjectsAsyncPager: - """A pager for iterating through ``list_stream_objects`` requests. - - This class thinly wraps an initial - :class:`google.cloud.datastream_v1.types.ListStreamObjectsResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``stream_objects`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListStreamObjects`` requests and continue to iterate - through the ``stream_objects`` field on the - corresponding responses. - - All the usual :class:`google.cloud.datastream_v1.types.ListStreamObjectsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[datastream.ListStreamObjectsResponse]], - request: datastream.ListStreamObjectsRequest, - response: datastream.ListStreamObjectsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.datastream_v1.types.ListStreamObjectsRequest): - The initial request object. - response (google.cloud.datastream_v1.types.ListStreamObjectsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = datastream.ListStreamObjectsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[datastream.ListStreamObjectsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[datastream_resources.StreamObject]: - async def async_generator(): - async for page in self.pages: - for response in page.stream_objects: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class FetchStaticIpsPager: - """A pager for iterating through ``fetch_static_ips`` requests. - - This class thinly wraps an initial - :class:`google.cloud.datastream_v1.types.FetchStaticIpsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``static_ips`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``FetchStaticIps`` requests and continue to iterate - through the ``static_ips`` field on the - corresponding responses. - - All the usual :class:`google.cloud.datastream_v1.types.FetchStaticIpsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., datastream.FetchStaticIpsResponse], - request: datastream.FetchStaticIpsRequest, - response: datastream.FetchStaticIpsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.datastream_v1.types.FetchStaticIpsRequest): - The initial request object. - response (google.cloud.datastream_v1.types.FetchStaticIpsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = datastream.FetchStaticIpsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[datastream.FetchStaticIpsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[str]: - for page in self.pages: - yield from page.static_ips - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class FetchStaticIpsAsyncPager: - """A pager for iterating through ``fetch_static_ips`` requests. - - This class thinly wraps an initial - :class:`google.cloud.datastream_v1.types.FetchStaticIpsResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``static_ips`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``FetchStaticIps`` requests and continue to iterate - through the ``static_ips`` field on the - corresponding responses. - - All the usual :class:`google.cloud.datastream_v1.types.FetchStaticIpsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[datastream.FetchStaticIpsResponse]], - request: datastream.FetchStaticIpsRequest, - response: datastream.FetchStaticIpsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.datastream_v1.types.FetchStaticIpsRequest): - The initial request object. - response (google.cloud.datastream_v1.types.FetchStaticIpsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = datastream.FetchStaticIpsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[datastream.FetchStaticIpsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[str]: - async def async_generator(): - async for page in self.pages: - for response in page.static_ips: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListPrivateConnectionsPager: - """A pager for iterating through ``list_private_connections`` requests. - - This class thinly wraps an initial - :class:`google.cloud.datastream_v1.types.ListPrivateConnectionsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``private_connections`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListPrivateConnections`` requests and continue to iterate - through the ``private_connections`` field on the - corresponding responses. - - All the usual :class:`google.cloud.datastream_v1.types.ListPrivateConnectionsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., datastream.ListPrivateConnectionsResponse], - request: datastream.ListPrivateConnectionsRequest, - response: datastream.ListPrivateConnectionsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.datastream_v1.types.ListPrivateConnectionsRequest): - The initial request object. - response (google.cloud.datastream_v1.types.ListPrivateConnectionsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = datastream.ListPrivateConnectionsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[datastream.ListPrivateConnectionsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[datastream_resources.PrivateConnection]: - for page in self.pages: - yield from page.private_connections - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListPrivateConnectionsAsyncPager: - """A pager for iterating through ``list_private_connections`` requests. - - This class thinly wraps an initial - :class:`google.cloud.datastream_v1.types.ListPrivateConnectionsResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``private_connections`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListPrivateConnections`` requests and continue to iterate - through the ``private_connections`` field on the - corresponding responses. - - All the usual :class:`google.cloud.datastream_v1.types.ListPrivateConnectionsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[datastream.ListPrivateConnectionsResponse]], - request: datastream.ListPrivateConnectionsRequest, - response: datastream.ListPrivateConnectionsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.datastream_v1.types.ListPrivateConnectionsRequest): - The initial request object. - response (google.cloud.datastream_v1.types.ListPrivateConnectionsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = datastream.ListPrivateConnectionsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[datastream.ListPrivateConnectionsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[datastream_resources.PrivateConnection]: - async def async_generator(): - async for page in self.pages: - for response in page.private_connections: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListRoutesPager: - """A pager for iterating through ``list_routes`` requests. - - This class thinly wraps an initial - :class:`google.cloud.datastream_v1.types.ListRoutesResponse` object, and - provides an ``__iter__`` method to iterate through its - ``routes`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListRoutes`` requests and continue to iterate - through the ``routes`` field on the - corresponding responses. - - All the usual :class:`google.cloud.datastream_v1.types.ListRoutesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., datastream.ListRoutesResponse], - request: datastream.ListRoutesRequest, - response: datastream.ListRoutesResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.datastream_v1.types.ListRoutesRequest): - The initial request object. - response (google.cloud.datastream_v1.types.ListRoutesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = datastream.ListRoutesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[datastream.ListRoutesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[datastream_resources.Route]: - for page in self.pages: - yield from page.routes - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListRoutesAsyncPager: - """A pager for iterating through ``list_routes`` requests. - - This class thinly wraps an initial - :class:`google.cloud.datastream_v1.types.ListRoutesResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``routes`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListRoutes`` requests and continue to iterate - through the ``routes`` field on the - corresponding responses. - - All the usual :class:`google.cloud.datastream_v1.types.ListRoutesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[datastream.ListRoutesResponse]], - request: datastream.ListRoutesRequest, - response: datastream.ListRoutesResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.datastream_v1.types.ListRoutesRequest): - The initial request object. - response (google.cloud.datastream_v1.types.ListRoutesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = datastream.ListRoutesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[datastream.ListRoutesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[datastream_resources.Route]: - async def async_generator(): - async for page in self.pages: - for response in page.routes: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/__init__.py b/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/__init__.py deleted file mode 100644 index 02599a2..0000000 --- a/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from collections import OrderedDict -from typing import Dict, Type - -from .base import DatastreamTransport -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 -_transport_registry['grpc_asyncio'] = DatastreamGrpcAsyncIOTransport - -__all__ = ( - 'DatastreamTransport', - 'DatastreamGrpcTransport', - 'DatastreamGrpcAsyncIOTransport', -) diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/base.py b/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/base.py deleted file mode 100644 index dea0e3b..0000000 --- a/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/base.py +++ /dev/null @@ -1,548 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import abc -from typing import Awaitable, Callable, Dict, Optional, Sequence, Union - -from google.cloud.datastream_v1 import gapic_version as package_version - -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 retry as retries -from google.api_core import operations_v1 -from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.datastream_v1.types import datastream -from google.cloud.datastream_v1.types import datastream_resources -from google.cloud.location import locations_pb2 # type: ignore -from google.iam.v1 import iam_policy_pb2 # type: ignore -from google.iam.v1 import policy_pb2 # type: ignore -from google.longrunning import operations_pb2 -from google.longrunning import operations_pb2 # type: ignore - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) - - -class DatastreamTransport(abc.ABC): - """Abstract transport class for Datastream.""" - - AUTH_SCOPES = ( - 'https://www.googleapis.com/auth/cloud-platform', - ) - - DEFAULT_HOST: str = 'datastream.googleapis.com' - def __init__( - self, *, - host: str = DEFAULT_HOST, - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - **kwargs, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is mutually exclusive with credentials. - scopes (Optional[Sequence[str]]): A list of scopes. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - """ - - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} - - # Save the scopes. - self._scopes = scopes - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials and credentials_file: - raise core_exceptions.DuplicateCredentialArgs("'credentials_file' and 'credentials' are mutually exclusive") - - if credentials_file is not None: - credentials, _ = google.auth.load_credentials_from_file( - credentials_file, - **scopes_kwargs, - quota_project_id=quota_project_id - ) - elif credentials is None: - credentials, _ = google.auth.default(**scopes_kwargs, quota_project_id=quota_project_id) - # Don't apply audience if the credentials file passed from user. - if hasattr(credentials, "with_gdch_audience"): - credentials = credentials.with_gdch_audience(api_audience if api_audience else host) - - # If the credentials are service account credentials, then always try to use self signed JWT. - if always_use_jwt_access and isinstance(credentials, service_account.Credentials) and hasattr(service_account.Credentials, "with_always_use_jwt_access"): - credentials = credentials.with_always_use_jwt_access(True) - - # Save the credentials. - self._credentials = credentials - - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ':' not in host: - host += ':443' - self._host = host - - def _prep_wrapped_messages(self, client_info): - # Precompute the wrapped methods. - self._wrapped_methods = { - self.list_connection_profiles: gapic_v1.method.wrap_method( - self.list_connection_profiles, - default_timeout=None, - client_info=client_info, - ), - self.get_connection_profile: gapic_v1.method.wrap_method( - self.get_connection_profile, - default_timeout=None, - client_info=client_info, - ), - self.create_connection_profile: gapic_v1.method.wrap_method( - self.create_connection_profile, - default_timeout=60.0, - client_info=client_info, - ), - self.update_connection_profile: gapic_v1.method.wrap_method( - self.update_connection_profile, - default_timeout=60.0, - client_info=client_info, - ), - self.delete_connection_profile: gapic_v1.method.wrap_method( - self.delete_connection_profile, - default_timeout=60.0, - client_info=client_info, - ), - self.discover_connection_profile: gapic_v1.method.wrap_method( - self.discover_connection_profile, - default_timeout=None, - client_info=client_info, - ), - self.list_streams: gapic_v1.method.wrap_method( - 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.create_stream: gapic_v1.method.wrap_method( - 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.delete_stream: gapic_v1.method.wrap_method( - 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.lookup_stream_object: gapic_v1.method.wrap_method( - self.lookup_stream_object, - default_timeout=None, - 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.start_backfill_job: gapic_v1.method.wrap_method( - 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.fetch_static_ips: gapic_v1.method.wrap_method( - self.fetch_static_ips, - default_timeout=None, - client_info=client_info, - ), - self.create_private_connection: gapic_v1.method.wrap_method( - self.create_private_connection, - default_timeout=60.0, - client_info=client_info, - ), - self.get_private_connection: gapic_v1.method.wrap_method( - self.get_private_connection, - default_timeout=None, - client_info=client_info, - ), - self.list_private_connections: gapic_v1.method.wrap_method( - self.list_private_connections, - default_timeout=None, - client_info=client_info, - ), - self.delete_private_connection: gapic_v1.method.wrap_method( - self.delete_private_connection, - default_timeout=60.0, - client_info=client_info, - ), - self.create_route: gapic_v1.method.wrap_method( - 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.list_routes: gapic_v1.method.wrap_method( - 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, - ), - } - - 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! - """ - raise NotImplementedError() - - @property - def operations_client(self): - """Return the client designed to process long-running operations.""" - raise NotImplementedError() - - @property - def list_connection_profiles(self) -> Callable[ - [datastream.ListConnectionProfilesRequest], - Union[ - datastream.ListConnectionProfilesResponse, - Awaitable[datastream.ListConnectionProfilesResponse] - ]]: - raise NotImplementedError() - - @property - def get_connection_profile(self) -> Callable[ - [datastream.GetConnectionProfileRequest], - Union[ - datastream_resources.ConnectionProfile, - Awaitable[datastream_resources.ConnectionProfile] - ]]: - raise NotImplementedError() - - @property - def create_connection_profile(self) -> Callable[ - [datastream.CreateConnectionProfileRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def update_connection_profile(self) -> Callable[ - [datastream.UpdateConnectionProfileRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def delete_connection_profile(self) -> Callable[ - [datastream.DeleteConnectionProfileRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def discover_connection_profile(self) -> Callable[ - [datastream.DiscoverConnectionProfileRequest], - Union[ - datastream.DiscoverConnectionProfileResponse, - Awaitable[datastream.DiscoverConnectionProfileResponse] - ]]: - raise NotImplementedError() - - @property - def list_streams(self) -> Callable[ - [datastream.ListStreamsRequest], - Union[ - datastream.ListStreamsResponse, - Awaitable[datastream.ListStreamsResponse] - ]]: - raise NotImplementedError() - - @property - def get_stream(self) -> Callable[ - [datastream.GetStreamRequest], - Union[ - datastream_resources.Stream, - Awaitable[datastream_resources.Stream] - ]]: - raise NotImplementedError() - - @property - def create_stream(self) -> Callable[ - [datastream.CreateStreamRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def update_stream(self) -> Callable[ - [datastream.UpdateStreamRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def delete_stream(self) -> Callable[ - [datastream.DeleteStreamRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def get_stream_object(self) -> Callable[ - [datastream.GetStreamObjectRequest], - Union[ - datastream_resources.StreamObject, - Awaitable[datastream_resources.StreamObject] - ]]: - raise NotImplementedError() - - @property - def lookup_stream_object(self) -> Callable[ - [datastream.LookupStreamObjectRequest], - Union[ - datastream_resources.StreamObject, - Awaitable[datastream_resources.StreamObject] - ]]: - raise NotImplementedError() - - @property - def list_stream_objects(self) -> Callable[ - [datastream.ListStreamObjectsRequest], - Union[ - datastream.ListStreamObjectsResponse, - Awaitable[datastream.ListStreamObjectsResponse] - ]]: - raise NotImplementedError() - - @property - def start_backfill_job(self) -> Callable[ - [datastream.StartBackfillJobRequest], - Union[ - datastream.StartBackfillJobResponse, - Awaitable[datastream.StartBackfillJobResponse] - ]]: - raise NotImplementedError() - - @property - def stop_backfill_job(self) -> Callable[ - [datastream.StopBackfillJobRequest], - Union[ - datastream.StopBackfillJobResponse, - Awaitable[datastream.StopBackfillJobResponse] - ]]: - raise NotImplementedError() - - @property - def fetch_static_ips(self) -> Callable[ - [datastream.FetchStaticIpsRequest], - Union[ - datastream.FetchStaticIpsResponse, - Awaitable[datastream.FetchStaticIpsResponse] - ]]: - raise NotImplementedError() - - @property - def create_private_connection(self) -> Callable[ - [datastream.CreatePrivateConnectionRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def get_private_connection(self) -> Callable[ - [datastream.GetPrivateConnectionRequest], - Union[ - datastream_resources.PrivateConnection, - Awaitable[datastream_resources.PrivateConnection] - ]]: - raise NotImplementedError() - - @property - def list_private_connections(self) -> Callable[ - [datastream.ListPrivateConnectionsRequest], - Union[ - datastream.ListPrivateConnectionsResponse, - Awaitable[datastream.ListPrivateConnectionsResponse] - ]]: - raise NotImplementedError() - - @property - def delete_private_connection(self) -> Callable[ - [datastream.DeletePrivateConnectionRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def create_route(self) -> Callable[ - [datastream.CreateRouteRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def get_route(self) -> Callable[ - [datastream.GetRouteRequest], - Union[ - datastream_resources.Route, - Awaitable[datastream_resources.Route] - ]]: - raise NotImplementedError() - - @property - def list_routes(self) -> Callable[ - [datastream.ListRoutesRequest], - Union[ - datastream.ListRoutesResponse, - Awaitable[datastream.ListRoutesResponse] - ]]: - raise NotImplementedError() - - @property - def delete_route(self) -> Callable[ - [datastream.DeleteRouteRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def list_operations( - self, - ) -> Callable[ - [operations_pb2.ListOperationsRequest], - Union[operations_pb2.ListOperationsResponse, Awaitable[operations_pb2.ListOperationsResponse]], - ]: - raise NotImplementedError() - - @property - def get_operation( - self, - ) -> Callable[ - [operations_pb2.GetOperationRequest], - Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], - ]: - raise NotImplementedError() - - @property - def cancel_operation( - self, - ) -> Callable[ - [operations_pb2.CancelOperationRequest], - None, - ]: - raise NotImplementedError() - - @property - def delete_operation( - self, - ) -> Callable[ - [operations_pb2.DeleteOperationRequest], - None, - ]: - raise NotImplementedError() - - @property - def get_location(self, - ) -> Callable[ - [locations_pb2.GetLocationRequest], - Union[locations_pb2.Location, Awaitable[locations_pb2.Location]], - ]: - raise NotImplementedError() - - @property - def list_locations(self, - ) -> Callable[ - [locations_pb2.ListLocationsRequest], - Union[locations_pb2.ListLocationsResponse, Awaitable[locations_pb2.ListLocationsResponse]], - ]: - raise NotImplementedError() - - @property - def kind(self) -> str: - raise NotImplementedError() - - -__all__ = ( - 'DatastreamTransport', -) diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/grpc.py b/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/grpc.py deleted file mode 100644 index f9799be..0000000 --- a/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/grpc.py +++ /dev/null @@ -1,1041 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple, Union - -from google.api_core import grpc_helpers -from google.api_core import operations_v1 -from google.api_core import gapic_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 - -import grpc # type: ignore - -from google.cloud.datastream_v1.types import datastream -from google.cloud.datastream_v1.types import datastream_resources -from google.cloud.location import locations_pb2 # type: ignore -from google.iam.v1 import iam_policy_pb2 # type: ignore -from google.iam.v1 import policy_pb2 # type: ignore -from google.longrunning import operations_pb2 -from google.longrunning import operations_pb2 # type: ignore -from .base import DatastreamTransport, DEFAULT_CLIENT_INFO - - -class DatastreamGrpcTransport(DatastreamTransport): - """gRPC backend transport for Datastream. - - Datastream service - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - _stubs: Dict[str, Callable] - - def __init__(self, *, - host: str = 'datastream.googleapis.com', - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[grpc.Channel] = None, - api_mtls_endpoint: Optional[str] = None, - client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the grpc channel. It is ignored if ``channel`` is provided. - client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): - A callback to provide client certificate bytes and private key bytes, - both in PEM format. It is used to configure a mutual TLS channel. It is - ignored if ``channel`` or ``ssl_channel_credentials`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - self._grpc_channel = None - self._ssl_channel_credentials = ssl_channel_credentials - self._stubs: Dict[str, Callable] = {} - self._operations_client: Optional[operations_v1.OperationsClient] = None - - if api_mtls_endpoint: - warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) - if client_cert_source: - warnings.warn("client_cert_source is deprecated", DeprecationWarning) - - if channel: - # Ignore credentials if a channel was passed. - credentials = False - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - - else: - if api_mtls_endpoint: - host = api_mtls_endpoint - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - self._ssl_channel_credentials = SslCredentials().ssl_credentials - - else: - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - - # The base transport sets the host, credentials and scopes - super().__init__( - host=host, - credentials=credentials, - credentials_file=credentials_file, - scopes=scopes, - quota_project_id=quota_project_id, - client_info=client_info, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @classmethod - def create_channel(cls, - host: str = 'datastream.googleapis.com', - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - host (Optional[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is mutually exclusive with credentials. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - - Raises: - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - - return grpc_helpers.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Quick check: Only create a new client if we do not already have one. - if self._operations_client is None: - self._operations_client = operations_v1.OperationsClient( - self.grpc_channel - ) - - # Return the client from cache. - return self._operations_client - - @property - def list_connection_profiles(self) -> Callable[ - [datastream.ListConnectionProfilesRequest], - datastream.ListConnectionProfilesResponse]: - r"""Return a callable for the list connection profiles method over gRPC. - - Use this method to list connection profiles created - in a project and location. - - Returns: - Callable[[~.ListConnectionProfilesRequest], - ~.ListConnectionProfilesResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_connection_profiles' not in self._stubs: - self._stubs['list_connection_profiles'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/ListConnectionProfiles', - request_serializer=datastream.ListConnectionProfilesRequest.serialize, - response_deserializer=datastream.ListConnectionProfilesResponse.deserialize, - ) - return self._stubs['list_connection_profiles'] - - @property - def get_connection_profile(self) -> Callable[ - [datastream.GetConnectionProfileRequest], - datastream_resources.ConnectionProfile]: - r"""Return a callable for the get connection profile method over gRPC. - - Use this method to get details about a connection - profile. - - Returns: - Callable[[~.GetConnectionProfileRequest], - ~.ConnectionProfile]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_connection_profile' not in self._stubs: - self._stubs['get_connection_profile'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/GetConnectionProfile', - request_serializer=datastream.GetConnectionProfileRequest.serialize, - response_deserializer=datastream_resources.ConnectionProfile.deserialize, - ) - return self._stubs['get_connection_profile'] - - @property - def create_connection_profile(self) -> Callable[ - [datastream.CreateConnectionProfileRequest], - operations_pb2.Operation]: - r"""Return a callable for the create connection profile method over gRPC. - - Use this method to create a connection profile in a - project and location. - - Returns: - Callable[[~.CreateConnectionProfileRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_connection_profile' not in self._stubs: - self._stubs['create_connection_profile'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/CreateConnectionProfile', - request_serializer=datastream.CreateConnectionProfileRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_connection_profile'] - - @property - def update_connection_profile(self) -> Callable[ - [datastream.UpdateConnectionProfileRequest], - operations_pb2.Operation]: - r"""Return a callable for the update connection profile method over gRPC. - - Use this method to update the parameters of a - connection profile. - - Returns: - Callable[[~.UpdateConnectionProfileRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_connection_profile' not in self._stubs: - self._stubs['update_connection_profile'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/UpdateConnectionProfile', - request_serializer=datastream.UpdateConnectionProfileRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['update_connection_profile'] - - @property - def delete_connection_profile(self) -> Callable[ - [datastream.DeleteConnectionProfileRequest], - operations_pb2.Operation]: - r"""Return a callable for the delete connection profile method over gRPC. - - Use this method to delete a connection profile. - - Returns: - Callable[[~.DeleteConnectionProfileRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_connection_profile' not in self._stubs: - self._stubs['delete_connection_profile'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/DeleteConnectionProfile', - request_serializer=datastream.DeleteConnectionProfileRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['delete_connection_profile'] - - @property - def discover_connection_profile(self) -> Callable[ - [datastream.DiscoverConnectionProfileRequest], - datastream.DiscoverConnectionProfileResponse]: - r"""Return a callable for the discover connection profile method over gRPC. - - Use this method to discover a connection profile. - The discover API call exposes the data objects and - metadata belonging to the profile. Typically, a request - returns children data objects of a parent data object - that's optionally supplied in the request. - - Returns: - Callable[[~.DiscoverConnectionProfileRequest], - ~.DiscoverConnectionProfileResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'discover_connection_profile' not in self._stubs: - self._stubs['discover_connection_profile'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/DiscoverConnectionProfile', - request_serializer=datastream.DiscoverConnectionProfileRequest.serialize, - response_deserializer=datastream.DiscoverConnectionProfileResponse.deserialize, - ) - return self._stubs['discover_connection_profile'] - - @property - def list_streams(self) -> Callable[ - [datastream.ListStreamsRequest], - datastream.ListStreamsResponse]: - r"""Return a callable for the list streams method over gRPC. - - Use this method to list streams in a project and - location. - - Returns: - Callable[[~.ListStreamsRequest], - ~.ListStreamsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_streams' not in self._stubs: - self._stubs['list_streams'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/ListStreams', - request_serializer=datastream.ListStreamsRequest.serialize, - response_deserializer=datastream.ListStreamsResponse.deserialize, - ) - return self._stubs['list_streams'] - - @property - def get_stream(self) -> Callable[ - [datastream.GetStreamRequest], - datastream_resources.Stream]: - r"""Return a callable for the get stream method over gRPC. - - Use this method to get details about a stream. - - Returns: - Callable[[~.GetStreamRequest], - ~.Stream]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_stream' not in self._stubs: - self._stubs['get_stream'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/GetStream', - request_serializer=datastream.GetStreamRequest.serialize, - response_deserializer=datastream_resources.Stream.deserialize, - ) - return self._stubs['get_stream'] - - @property - def create_stream(self) -> Callable[ - [datastream.CreateStreamRequest], - operations_pb2.Operation]: - r"""Return a callable for the create stream method over gRPC. - - Use this method to create a stream. - - Returns: - Callable[[~.CreateStreamRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_stream' not in self._stubs: - self._stubs['create_stream'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/CreateStream', - request_serializer=datastream.CreateStreamRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_stream'] - - @property - def update_stream(self) -> Callable[ - [datastream.UpdateStreamRequest], - operations_pb2.Operation]: - r"""Return a callable for the update stream method over gRPC. - - Use this method to update the configuration of a - stream. - - Returns: - Callable[[~.UpdateStreamRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_stream' not in self._stubs: - self._stubs['update_stream'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/UpdateStream', - request_serializer=datastream.UpdateStreamRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['update_stream'] - - @property - def delete_stream(self) -> Callable[ - [datastream.DeleteStreamRequest], - operations_pb2.Operation]: - r"""Return a callable for the delete stream method over gRPC. - - Use this method to delete a stream. - - Returns: - Callable[[~.DeleteStreamRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_stream' not in self._stubs: - self._stubs['delete_stream'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/DeleteStream', - request_serializer=datastream.DeleteStreamRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['delete_stream'] - - @property - def get_stream_object(self) -> Callable[ - [datastream.GetStreamObjectRequest], - datastream_resources.StreamObject]: - r"""Return a callable for the get stream object method over gRPC. - - Use this method to get details about a stream object. - - Returns: - Callable[[~.GetStreamObjectRequest], - ~.StreamObject]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_stream_object' not in self._stubs: - self._stubs['get_stream_object'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/GetStreamObject', - request_serializer=datastream.GetStreamObjectRequest.serialize, - response_deserializer=datastream_resources.StreamObject.deserialize, - ) - return self._stubs['get_stream_object'] - - @property - def lookup_stream_object(self) -> Callable[ - [datastream.LookupStreamObjectRequest], - datastream_resources.StreamObject]: - r"""Return a callable for the lookup stream object method over gRPC. - - Use this method to look up a stream object by its - source object identifier. - - Returns: - Callable[[~.LookupStreamObjectRequest], - ~.StreamObject]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'lookup_stream_object' not in self._stubs: - self._stubs['lookup_stream_object'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/LookupStreamObject', - request_serializer=datastream.LookupStreamObjectRequest.serialize, - response_deserializer=datastream_resources.StreamObject.deserialize, - ) - return self._stubs['lookup_stream_object'] - - @property - def list_stream_objects(self) -> Callable[ - [datastream.ListStreamObjectsRequest], - datastream.ListStreamObjectsResponse]: - r"""Return a callable for the list stream objects method over gRPC. - - Use this method to list the objects of a specific - stream. - - Returns: - Callable[[~.ListStreamObjectsRequest], - ~.ListStreamObjectsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_stream_objects' not in self._stubs: - self._stubs['list_stream_objects'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/ListStreamObjects', - request_serializer=datastream.ListStreamObjectsRequest.serialize, - response_deserializer=datastream.ListStreamObjectsResponse.deserialize, - ) - return self._stubs['list_stream_objects'] - - @property - def start_backfill_job(self) -> Callable[ - [datastream.StartBackfillJobRequest], - datastream.StartBackfillJobResponse]: - r"""Return a callable for the start backfill job method over gRPC. - - Use this method to start a backfill job for the - specified stream object. - - Returns: - Callable[[~.StartBackfillJobRequest], - ~.StartBackfillJobResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'start_backfill_job' not in self._stubs: - self._stubs['start_backfill_job'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/StartBackfillJob', - request_serializer=datastream.StartBackfillJobRequest.serialize, - response_deserializer=datastream.StartBackfillJobResponse.deserialize, - ) - return self._stubs['start_backfill_job'] - - @property - def stop_backfill_job(self) -> Callable[ - [datastream.StopBackfillJobRequest], - datastream.StopBackfillJobResponse]: - r"""Return a callable for the stop backfill job method over gRPC. - - Use this method to stop a backfill job for the - specified stream object. - - Returns: - Callable[[~.StopBackfillJobRequest], - ~.StopBackfillJobResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'stop_backfill_job' not in self._stubs: - self._stubs['stop_backfill_job'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/StopBackfillJob', - request_serializer=datastream.StopBackfillJobRequest.serialize, - response_deserializer=datastream.StopBackfillJobResponse.deserialize, - ) - return self._stubs['stop_backfill_job'] - - @property - def fetch_static_ips(self) -> Callable[ - [datastream.FetchStaticIpsRequest], - datastream.FetchStaticIpsResponse]: - r"""Return a callable for the fetch static ips method over gRPC. - - The FetchStaticIps API call exposes the static IP - addresses used by Datastream. - - Returns: - Callable[[~.FetchStaticIpsRequest], - ~.FetchStaticIpsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'fetch_static_ips' not in self._stubs: - self._stubs['fetch_static_ips'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/FetchStaticIps', - request_serializer=datastream.FetchStaticIpsRequest.serialize, - response_deserializer=datastream.FetchStaticIpsResponse.deserialize, - ) - return self._stubs['fetch_static_ips'] - - @property - def create_private_connection(self) -> Callable[ - [datastream.CreatePrivateConnectionRequest], - operations_pb2.Operation]: - r"""Return a callable for the create private connection method over gRPC. - - Use this method to create a private connectivity - configuration. - - Returns: - Callable[[~.CreatePrivateConnectionRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_private_connection' not in self._stubs: - self._stubs['create_private_connection'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/CreatePrivateConnection', - request_serializer=datastream.CreatePrivateConnectionRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_private_connection'] - - @property - def get_private_connection(self) -> Callable[ - [datastream.GetPrivateConnectionRequest], - datastream_resources.PrivateConnection]: - r"""Return a callable for the get private connection method over gRPC. - - Use this method to get details about a private - connectivity configuration. - - Returns: - Callable[[~.GetPrivateConnectionRequest], - ~.PrivateConnection]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_private_connection' not in self._stubs: - self._stubs['get_private_connection'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/GetPrivateConnection', - request_serializer=datastream.GetPrivateConnectionRequest.serialize, - response_deserializer=datastream_resources.PrivateConnection.deserialize, - ) - return self._stubs['get_private_connection'] - - @property - def list_private_connections(self) -> Callable[ - [datastream.ListPrivateConnectionsRequest], - datastream.ListPrivateConnectionsResponse]: - r"""Return a callable for the list private connections method over gRPC. - - Use this method to list private connectivity - configurations in a project and location. - - Returns: - Callable[[~.ListPrivateConnectionsRequest], - ~.ListPrivateConnectionsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_private_connections' not in self._stubs: - self._stubs['list_private_connections'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/ListPrivateConnections', - request_serializer=datastream.ListPrivateConnectionsRequest.serialize, - response_deserializer=datastream.ListPrivateConnectionsResponse.deserialize, - ) - return self._stubs['list_private_connections'] - - @property - def delete_private_connection(self) -> Callable[ - [datastream.DeletePrivateConnectionRequest], - operations_pb2.Operation]: - r"""Return a callable for the delete private connection method over gRPC. - - Use this method to delete a private connectivity - configuration. - - Returns: - Callable[[~.DeletePrivateConnectionRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_private_connection' not in self._stubs: - self._stubs['delete_private_connection'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/DeletePrivateConnection', - request_serializer=datastream.DeletePrivateConnectionRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['delete_private_connection'] - - @property - def create_route(self) -> Callable[ - [datastream.CreateRouteRequest], - operations_pb2.Operation]: - r"""Return a callable for the create route method over gRPC. - - Use this method to create a route for a private - connectivity configuration in a project and location. - - Returns: - Callable[[~.CreateRouteRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_route' not in self._stubs: - self._stubs['create_route'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/CreateRoute', - request_serializer=datastream.CreateRouteRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_route'] - - @property - def get_route(self) -> Callable[ - [datastream.GetRouteRequest], - datastream_resources.Route]: - r"""Return a callable for the get route method over gRPC. - - Use this method to get details about a route. - - Returns: - Callable[[~.GetRouteRequest], - ~.Route]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_route' not in self._stubs: - self._stubs['get_route'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/GetRoute', - request_serializer=datastream.GetRouteRequest.serialize, - response_deserializer=datastream_resources.Route.deserialize, - ) - return self._stubs['get_route'] - - @property - def list_routes(self) -> Callable[ - [datastream.ListRoutesRequest], - datastream.ListRoutesResponse]: - r"""Return a callable for the list routes method over gRPC. - - Use this method to list routes created for a private - connectivity configuration in a project and location. - - Returns: - Callable[[~.ListRoutesRequest], - ~.ListRoutesResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_routes' not in self._stubs: - self._stubs['list_routes'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/ListRoutes', - request_serializer=datastream.ListRoutesRequest.serialize, - response_deserializer=datastream.ListRoutesResponse.deserialize, - ) - return self._stubs['list_routes'] - - @property - def delete_route(self) -> Callable[ - [datastream.DeleteRouteRequest], - operations_pb2.Operation]: - r"""Return a callable for the delete route method over gRPC. - - Use this method to delete a route. - - Returns: - Callable[[~.DeleteRouteRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_route' not in self._stubs: - self._stubs['delete_route'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/DeleteRoute', - request_serializer=datastream.DeleteRouteRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['delete_route'] - - def close(self): - self.grpc_channel.close() - - @property - def delete_operation( - self, - ) -> Callable[[operations_pb2.DeleteOperationRequest], None]: - r"""Return a callable for the delete_operation method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "delete_operation" not in self._stubs: - self._stubs["delete_operation"] = self.grpc_channel.unary_unary( - "/google.longrunning.Operations/DeleteOperation", - request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString, - response_deserializer=None, - ) - return self._stubs["delete_operation"] - - @property - def cancel_operation( - self, - ) -> Callable[[operations_pb2.CancelOperationRequest], None]: - r"""Return a callable for the cancel_operation method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( - "/google.longrunning.Operations/CancelOperation", - request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, - response_deserializer=None, - ) - return self._stubs["cancel_operation"] - - @property - def get_operation( - self, - ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]: - r"""Return a callable for the get_operation method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_operation" not in self._stubs: - self._stubs["get_operation"] = self.grpc_channel.unary_unary( - "/google.longrunning.Operations/GetOperation", - request_serializer=operations_pb2.GetOperationRequest.SerializeToString, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["get_operation"] - - @property - def list_operations( - self, - ) -> Callable[[operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse]: - r"""Return a callable for the list_operations method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_operations" not in self._stubs: - self._stubs["list_operations"] = self.grpc_channel.unary_unary( - "/google.longrunning.Operations/ListOperations", - request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, - response_deserializer=operations_pb2.ListOperationsResponse.FromString, - ) - return self._stubs["list_operations"] - - @property - def list_locations( - self, - ) -> Callable[[locations_pb2.ListLocationsRequest], locations_pb2.ListLocationsResponse]: - r"""Return a callable for the list locations method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( - "/google.cloud.location.Locations/ListLocations", - request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, - response_deserializer=locations_pb2.ListLocationsResponse.FromString, - ) - return self._stubs["list_locations"] - - @property - def get_location( - self, - ) -> Callable[[locations_pb2.GetLocationRequest], locations_pb2.Location]: - r"""Return a callable for the list locations method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( - "/google.cloud.location.Locations/GetLocation", - request_serializer=locations_pb2.GetLocationRequest.SerializeToString, - response_deserializer=locations_pb2.Location.FromString, - ) - return self._stubs["get_location"] - - @property - def kind(self) -> str: - return "grpc" - - -__all__ = ( - 'DatastreamGrpcTransport', -) diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/grpc_asyncio.py b/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/grpc_asyncio.py deleted file mode 100644 index e61c3a2..0000000 --- a/owl-bot-staging/v1/google/cloud/datastream_v1/services/datastream/transports/grpc_asyncio.py +++ /dev/null @@ -1,1040 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import warnings -from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union - -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async -from google.api_core import operations_v1 -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # 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.cloud.location import locations_pb2 # type: ignore -from google.iam.v1 import iam_policy_pb2 # type: ignore -from google.iam.v1 import policy_pb2 # type: ignore -from google.longrunning import operations_pb2 -from google.longrunning import operations_pb2 # type: ignore -from .base import DatastreamTransport, DEFAULT_CLIENT_INFO -from .grpc import DatastreamGrpcTransport - - -class DatastreamGrpcAsyncIOTransport(DatastreamTransport): - """gRPC AsyncIO backend transport for Datastream. - - Datastream service - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - _grpc_channel: aio.Channel - _stubs: Dict[str, Callable] = {} - - @classmethod - def create_channel(cls, - host: str = 'datastream.googleapis.com', - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs) -> aio.Channel: - """Create and return a gRPC AsyncIO channel object. - Args: - host (Optional[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - aio.Channel: A gRPC AsyncIO channel object. - """ - - return grpc_helpers_async.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs - ) - - def __init__(self, *, - host: str = 'datastream.googleapis.com', - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[aio.Channel] = None, - api_mtls_endpoint: Optional[str] = None, - client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - channel (Optional[aio.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the grpc channel. It is ignored if ``channel`` is provided. - client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): - A callback to provide client certificate bytes and private key bytes, - both in PEM format. It is used to configure a mutual TLS channel. It is - ignored if ``channel`` or ``ssl_channel_credentials`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - self._grpc_channel = None - self._ssl_channel_credentials = ssl_channel_credentials - self._stubs: Dict[str, Callable] = {} - self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None - - if api_mtls_endpoint: - warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) - if client_cert_source: - warnings.warn("client_cert_source is deprecated", DeprecationWarning) - - if channel: - # Ignore credentials if a channel was passed. - credentials = False - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - else: - if api_mtls_endpoint: - host = api_mtls_endpoint - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - self._ssl_channel_credentials = SslCredentials().ssl_credentials - - else: - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - - # The base transport sets the host, credentials and scopes - super().__init__( - host=host, - credentials=credentials, - credentials_file=credentials_file, - scopes=scopes, - quota_project_id=quota_project_id, - client_info=client_info, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @property - def grpc_channel(self) -> aio.Channel: - """Create the channel designed to connect to this service. - - This property caches on the instance; repeated calls return - the same channel. - """ - # Return the channel from cache. - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsAsyncClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Quick check: Only create a new client if we do not already have one. - if self._operations_client is None: - self._operations_client = operations_v1.OperationsAsyncClient( - self.grpc_channel - ) - - # Return the client from cache. - return self._operations_client - - @property - def list_connection_profiles(self) -> Callable[ - [datastream.ListConnectionProfilesRequest], - Awaitable[datastream.ListConnectionProfilesResponse]]: - r"""Return a callable for the list connection profiles method over gRPC. - - Use this method to list connection profiles created - in a project and location. - - Returns: - Callable[[~.ListConnectionProfilesRequest], - Awaitable[~.ListConnectionProfilesResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_connection_profiles' not in self._stubs: - self._stubs['list_connection_profiles'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/ListConnectionProfiles', - request_serializer=datastream.ListConnectionProfilesRequest.serialize, - response_deserializer=datastream.ListConnectionProfilesResponse.deserialize, - ) - return self._stubs['list_connection_profiles'] - - @property - def get_connection_profile(self) -> Callable[ - [datastream.GetConnectionProfileRequest], - Awaitable[datastream_resources.ConnectionProfile]]: - r"""Return a callable for the get connection profile method over gRPC. - - Use this method to get details about a connection - profile. - - Returns: - Callable[[~.GetConnectionProfileRequest], - Awaitable[~.ConnectionProfile]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_connection_profile' not in self._stubs: - self._stubs['get_connection_profile'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/GetConnectionProfile', - request_serializer=datastream.GetConnectionProfileRequest.serialize, - response_deserializer=datastream_resources.ConnectionProfile.deserialize, - ) - return self._stubs['get_connection_profile'] - - @property - def create_connection_profile(self) -> Callable[ - [datastream.CreateConnectionProfileRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the create connection profile method over gRPC. - - Use this method to create a connection profile in a - project and location. - - Returns: - Callable[[~.CreateConnectionProfileRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_connection_profile' not in self._stubs: - self._stubs['create_connection_profile'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/CreateConnectionProfile', - request_serializer=datastream.CreateConnectionProfileRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_connection_profile'] - - @property - def update_connection_profile(self) -> Callable[ - [datastream.UpdateConnectionProfileRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the update connection profile method over gRPC. - - Use this method to update the parameters of a - connection profile. - - Returns: - Callable[[~.UpdateConnectionProfileRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_connection_profile' not in self._stubs: - self._stubs['update_connection_profile'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/UpdateConnectionProfile', - request_serializer=datastream.UpdateConnectionProfileRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['update_connection_profile'] - - @property - def delete_connection_profile(self) -> Callable[ - [datastream.DeleteConnectionProfileRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the delete connection profile method over gRPC. - - Use this method to delete a connection profile. - - Returns: - Callable[[~.DeleteConnectionProfileRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_connection_profile' not in self._stubs: - self._stubs['delete_connection_profile'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/DeleteConnectionProfile', - request_serializer=datastream.DeleteConnectionProfileRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['delete_connection_profile'] - - @property - def discover_connection_profile(self) -> Callable[ - [datastream.DiscoverConnectionProfileRequest], - Awaitable[datastream.DiscoverConnectionProfileResponse]]: - r"""Return a callable for the discover connection profile method over gRPC. - - Use this method to discover a connection profile. - The discover API call exposes the data objects and - metadata belonging to the profile. Typically, a request - returns children data objects of a parent data object - that's optionally supplied in the request. - - Returns: - Callable[[~.DiscoverConnectionProfileRequest], - Awaitable[~.DiscoverConnectionProfileResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'discover_connection_profile' not in self._stubs: - self._stubs['discover_connection_profile'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/DiscoverConnectionProfile', - request_serializer=datastream.DiscoverConnectionProfileRequest.serialize, - response_deserializer=datastream.DiscoverConnectionProfileResponse.deserialize, - ) - return self._stubs['discover_connection_profile'] - - @property - def list_streams(self) -> Callable[ - [datastream.ListStreamsRequest], - Awaitable[datastream.ListStreamsResponse]]: - r"""Return a callable for the list streams method over gRPC. - - Use this method to list streams in a project and - location. - - Returns: - Callable[[~.ListStreamsRequest], - Awaitable[~.ListStreamsResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_streams' not in self._stubs: - self._stubs['list_streams'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/ListStreams', - request_serializer=datastream.ListStreamsRequest.serialize, - response_deserializer=datastream.ListStreamsResponse.deserialize, - ) - return self._stubs['list_streams'] - - @property - def get_stream(self) -> Callable[ - [datastream.GetStreamRequest], - Awaitable[datastream_resources.Stream]]: - r"""Return a callable for the get stream method over gRPC. - - Use this method to get details about a stream. - - Returns: - Callable[[~.GetStreamRequest], - Awaitable[~.Stream]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_stream' not in self._stubs: - self._stubs['get_stream'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/GetStream', - request_serializer=datastream.GetStreamRequest.serialize, - response_deserializer=datastream_resources.Stream.deserialize, - ) - return self._stubs['get_stream'] - - @property - def create_stream(self) -> Callable[ - [datastream.CreateStreamRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the create stream method over gRPC. - - Use this method to create a stream. - - Returns: - Callable[[~.CreateStreamRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_stream' not in self._stubs: - self._stubs['create_stream'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/CreateStream', - request_serializer=datastream.CreateStreamRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_stream'] - - @property - def update_stream(self) -> Callable[ - [datastream.UpdateStreamRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the update stream method over gRPC. - - Use this method to update the configuration of a - stream. - - Returns: - Callable[[~.UpdateStreamRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_stream' not in self._stubs: - self._stubs['update_stream'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/UpdateStream', - request_serializer=datastream.UpdateStreamRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['update_stream'] - - @property - def delete_stream(self) -> Callable[ - [datastream.DeleteStreamRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the delete stream method over gRPC. - - Use this method to delete a stream. - - Returns: - Callable[[~.DeleteStreamRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_stream' not in self._stubs: - self._stubs['delete_stream'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/DeleteStream', - request_serializer=datastream.DeleteStreamRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['delete_stream'] - - @property - def get_stream_object(self) -> Callable[ - [datastream.GetStreamObjectRequest], - Awaitable[datastream_resources.StreamObject]]: - r"""Return a callable for the get stream object method over gRPC. - - Use this method to get details about a stream object. - - Returns: - Callable[[~.GetStreamObjectRequest], - Awaitable[~.StreamObject]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_stream_object' not in self._stubs: - self._stubs['get_stream_object'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/GetStreamObject', - request_serializer=datastream.GetStreamObjectRequest.serialize, - response_deserializer=datastream_resources.StreamObject.deserialize, - ) - return self._stubs['get_stream_object'] - - @property - def lookup_stream_object(self) -> Callable[ - [datastream.LookupStreamObjectRequest], - Awaitable[datastream_resources.StreamObject]]: - r"""Return a callable for the lookup stream object method over gRPC. - - Use this method to look up a stream object by its - source object identifier. - - Returns: - Callable[[~.LookupStreamObjectRequest], - Awaitable[~.StreamObject]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'lookup_stream_object' not in self._stubs: - self._stubs['lookup_stream_object'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/LookupStreamObject', - request_serializer=datastream.LookupStreamObjectRequest.serialize, - response_deserializer=datastream_resources.StreamObject.deserialize, - ) - return self._stubs['lookup_stream_object'] - - @property - def list_stream_objects(self) -> Callable[ - [datastream.ListStreamObjectsRequest], - Awaitable[datastream.ListStreamObjectsResponse]]: - r"""Return a callable for the list stream objects method over gRPC. - - Use this method to list the objects of a specific - stream. - - Returns: - Callable[[~.ListStreamObjectsRequest], - Awaitable[~.ListStreamObjectsResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_stream_objects' not in self._stubs: - self._stubs['list_stream_objects'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/ListStreamObjects', - request_serializer=datastream.ListStreamObjectsRequest.serialize, - response_deserializer=datastream.ListStreamObjectsResponse.deserialize, - ) - return self._stubs['list_stream_objects'] - - @property - def start_backfill_job(self) -> Callable[ - [datastream.StartBackfillJobRequest], - Awaitable[datastream.StartBackfillJobResponse]]: - r"""Return a callable for the start backfill job method over gRPC. - - Use this method to start a backfill job for the - specified stream object. - - Returns: - Callable[[~.StartBackfillJobRequest], - Awaitable[~.StartBackfillJobResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'start_backfill_job' not in self._stubs: - self._stubs['start_backfill_job'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/StartBackfillJob', - request_serializer=datastream.StartBackfillJobRequest.serialize, - response_deserializer=datastream.StartBackfillJobResponse.deserialize, - ) - return self._stubs['start_backfill_job'] - - @property - def stop_backfill_job(self) -> Callable[ - [datastream.StopBackfillJobRequest], - Awaitable[datastream.StopBackfillJobResponse]]: - r"""Return a callable for the stop backfill job method over gRPC. - - Use this method to stop a backfill job for the - specified stream object. - - Returns: - Callable[[~.StopBackfillJobRequest], - Awaitable[~.StopBackfillJobResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'stop_backfill_job' not in self._stubs: - self._stubs['stop_backfill_job'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/StopBackfillJob', - request_serializer=datastream.StopBackfillJobRequest.serialize, - response_deserializer=datastream.StopBackfillJobResponse.deserialize, - ) - return self._stubs['stop_backfill_job'] - - @property - def fetch_static_ips(self) -> Callable[ - [datastream.FetchStaticIpsRequest], - Awaitable[datastream.FetchStaticIpsResponse]]: - r"""Return a callable for the fetch static ips method over gRPC. - - The FetchStaticIps API call exposes the static IP - addresses used by Datastream. - - Returns: - Callable[[~.FetchStaticIpsRequest], - Awaitable[~.FetchStaticIpsResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'fetch_static_ips' not in self._stubs: - self._stubs['fetch_static_ips'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/FetchStaticIps', - request_serializer=datastream.FetchStaticIpsRequest.serialize, - response_deserializer=datastream.FetchStaticIpsResponse.deserialize, - ) - return self._stubs['fetch_static_ips'] - - @property - def create_private_connection(self) -> Callable[ - [datastream.CreatePrivateConnectionRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the create private connection method over gRPC. - - Use this method to create a private connectivity - configuration. - - Returns: - Callable[[~.CreatePrivateConnectionRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_private_connection' not in self._stubs: - self._stubs['create_private_connection'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/CreatePrivateConnection', - request_serializer=datastream.CreatePrivateConnectionRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_private_connection'] - - @property - def get_private_connection(self) -> Callable[ - [datastream.GetPrivateConnectionRequest], - Awaitable[datastream_resources.PrivateConnection]]: - r"""Return a callable for the get private connection method over gRPC. - - Use this method to get details about a private - connectivity configuration. - - Returns: - Callable[[~.GetPrivateConnectionRequest], - Awaitable[~.PrivateConnection]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_private_connection' not in self._stubs: - self._stubs['get_private_connection'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/GetPrivateConnection', - request_serializer=datastream.GetPrivateConnectionRequest.serialize, - response_deserializer=datastream_resources.PrivateConnection.deserialize, - ) - return self._stubs['get_private_connection'] - - @property - def list_private_connections(self) -> Callable[ - [datastream.ListPrivateConnectionsRequest], - Awaitable[datastream.ListPrivateConnectionsResponse]]: - r"""Return a callable for the list private connections method over gRPC. - - Use this method to list private connectivity - configurations in a project and location. - - Returns: - Callable[[~.ListPrivateConnectionsRequest], - Awaitable[~.ListPrivateConnectionsResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_private_connections' not in self._stubs: - self._stubs['list_private_connections'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/ListPrivateConnections', - request_serializer=datastream.ListPrivateConnectionsRequest.serialize, - response_deserializer=datastream.ListPrivateConnectionsResponse.deserialize, - ) - return self._stubs['list_private_connections'] - - @property - def delete_private_connection(self) -> Callable[ - [datastream.DeletePrivateConnectionRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the delete private connection method over gRPC. - - Use this method to delete a private connectivity - configuration. - - Returns: - Callable[[~.DeletePrivateConnectionRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_private_connection' not in self._stubs: - self._stubs['delete_private_connection'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/DeletePrivateConnection', - request_serializer=datastream.DeletePrivateConnectionRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['delete_private_connection'] - - @property - def create_route(self) -> Callable[ - [datastream.CreateRouteRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the create route method over gRPC. - - Use this method to create a route for a private - connectivity configuration in a project and location. - - Returns: - Callable[[~.CreateRouteRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_route' not in self._stubs: - self._stubs['create_route'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/CreateRoute', - request_serializer=datastream.CreateRouteRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_route'] - - @property - def get_route(self) -> Callable[ - [datastream.GetRouteRequest], - Awaitable[datastream_resources.Route]]: - r"""Return a callable for the get route method over gRPC. - - Use this method to get details about a route. - - Returns: - Callable[[~.GetRouteRequest], - Awaitable[~.Route]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_route' not in self._stubs: - self._stubs['get_route'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/GetRoute', - request_serializer=datastream.GetRouteRequest.serialize, - response_deserializer=datastream_resources.Route.deserialize, - ) - return self._stubs['get_route'] - - @property - def list_routes(self) -> Callable[ - [datastream.ListRoutesRequest], - Awaitable[datastream.ListRoutesResponse]]: - r"""Return a callable for the list routes method over gRPC. - - Use this method to list routes created for a private - connectivity configuration in a project and location. - - Returns: - Callable[[~.ListRoutesRequest], - Awaitable[~.ListRoutesResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_routes' not in self._stubs: - self._stubs['list_routes'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/ListRoutes', - request_serializer=datastream.ListRoutesRequest.serialize, - response_deserializer=datastream.ListRoutesResponse.deserialize, - ) - return self._stubs['list_routes'] - - @property - def delete_route(self) -> Callable[ - [datastream.DeleteRouteRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the delete route method over gRPC. - - Use this method to delete a route. - - Returns: - Callable[[~.DeleteRouteRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_route' not in self._stubs: - self._stubs['delete_route'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1.Datastream/DeleteRoute', - request_serializer=datastream.DeleteRouteRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['delete_route'] - - def close(self): - return self.grpc_channel.close() - - @property - def delete_operation( - self, - ) -> Callable[[operations_pb2.DeleteOperationRequest], None]: - r"""Return a callable for the delete_operation method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "delete_operation" not in self._stubs: - self._stubs["delete_operation"] = self.grpc_channel.unary_unary( - "/google.longrunning.Operations/DeleteOperation", - request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString, - response_deserializer=None, - ) - return self._stubs["delete_operation"] - - @property - def cancel_operation( - self, - ) -> Callable[[operations_pb2.CancelOperationRequest], None]: - r"""Return a callable for the cancel_operation method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( - "/google.longrunning.Operations/CancelOperation", - request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, - response_deserializer=None, - ) - return self._stubs["cancel_operation"] - - @property - def get_operation( - self, - ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]: - r"""Return a callable for the get_operation method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_operation" not in self._stubs: - self._stubs["get_operation"] = self.grpc_channel.unary_unary( - "/google.longrunning.Operations/GetOperation", - request_serializer=operations_pb2.GetOperationRequest.SerializeToString, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["get_operation"] - - @property - def list_operations( - self, - ) -> Callable[[operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse]: - r"""Return a callable for the list_operations method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_operations" not in self._stubs: - self._stubs["list_operations"] = self.grpc_channel.unary_unary( - "/google.longrunning.Operations/ListOperations", - request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, - response_deserializer=operations_pb2.ListOperationsResponse.FromString, - ) - return self._stubs["list_operations"] - - @property - def list_locations( - self, - ) -> Callable[[locations_pb2.ListLocationsRequest], locations_pb2.ListLocationsResponse]: - r"""Return a callable for the list locations method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( - "/google.cloud.location.Locations/ListLocations", - request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, - response_deserializer=locations_pb2.ListLocationsResponse.FromString, - ) - return self._stubs["list_locations"] - - @property - def get_location( - self, - ) -> Callable[[locations_pb2.GetLocationRequest], locations_pb2.Location]: - r"""Return a callable for the list locations method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( - "/google.cloud.location.Locations/GetLocation", - request_serializer=locations_pb2.GetLocationRequest.SerializeToString, - response_deserializer=locations_pb2.Location.FromString, - ) - return self._stubs["get_location"] - - -__all__ = ( - 'DatastreamGrpcAsyncIOTransport', -) diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/types/__init__.py b/owl-bot-staging/v1/google/cloud/datastream_v1/types/__init__.py deleted file mode 100644 index 54abed0..0000000 --- a/owl-bot-staging/v1/google/cloud/datastream_v1/types/__init__.py +++ /dev/null @@ -1,176 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from .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 .datastream_resources import ( - AvroFileFormat, - BackfillJob, - BigQueryDestinationConfig, - BigQueryProfile, - ConnectionProfile, - DestinationConfig, - Error, - ForwardSshTunnelConnectivity, - GcsDestinationConfig, - GcsProfile, - JsonFileFormat, - MysqlColumn, - MysqlDatabase, - MysqlProfile, - MysqlRdbms, - MysqlSourceConfig, - MysqlSslConfig, - MysqlTable, - OracleColumn, - OracleProfile, - OracleRdbms, - OracleSchema, - OracleSourceConfig, - OracleTable, - PostgresqlColumn, - PostgresqlProfile, - PostgresqlRdbms, - PostgresqlSchema, - PostgresqlSourceConfig, - PostgresqlTable, - PrivateConnection, - PrivateConnectivity, - Route, - SourceConfig, - SourceObjectIdentifier, - StaticServiceIpConnectivity, - Stream, - StreamObject, - Validation, - ValidationMessage, - ValidationResult, - VpcPeeringConfig, -) - -__all__ = ( - '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', - 'AvroFileFormat', - 'BackfillJob', - 'BigQueryDestinationConfig', - 'BigQueryProfile', - 'ConnectionProfile', - 'DestinationConfig', - 'Error', - 'ForwardSshTunnelConnectivity', - 'GcsDestinationConfig', - 'GcsProfile', - 'JsonFileFormat', - 'MysqlColumn', - 'MysqlDatabase', - 'MysqlProfile', - 'MysqlRdbms', - 'MysqlSourceConfig', - 'MysqlSslConfig', - 'MysqlTable', - 'OracleColumn', - 'OracleProfile', - 'OracleRdbms', - 'OracleSchema', - 'OracleSourceConfig', - 'OracleTable', - 'PostgresqlColumn', - 'PostgresqlProfile', - 'PostgresqlRdbms', - 'PostgresqlSchema', - 'PostgresqlSourceConfig', - 'PostgresqlTable', - 'PrivateConnection', - 'PrivateConnectivity', - 'Route', - 'SourceConfig', - 'SourceObjectIdentifier', - 'StaticServiceIpConnectivity', - 'Stream', - 'StreamObject', - 'Validation', - 'ValidationMessage', - 'ValidationResult', - 'VpcPeeringConfig', -) diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/types/datastream.py b/owl-bot-staging/v1/google/cloud/datastream_v1/types/datastream.py deleted file mode 100644 index d4214ab..0000000 --- a/owl-bot-staging/v1/google/cloud/datastream_v1/types/datastream.py +++ /dev/null @@ -1,1401 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from typing import MutableMapping, MutableSequence - -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 - - -__protobuf__ = proto.module( - package='google.cloud.datastream.v1', - manifest={ - 'DiscoverConnectionProfileRequest', - 'DiscoverConnectionProfileResponse', - 'FetchStaticIpsRequest', - 'FetchStaticIpsResponse', - 'ListConnectionProfilesRequest', - 'ListConnectionProfilesResponse', - 'GetConnectionProfileRequest', - 'CreateConnectionProfileRequest', - 'UpdateConnectionProfileRequest', - 'DeleteConnectionProfileRequest', - 'ListStreamsRequest', - 'ListStreamsResponse', - 'GetStreamRequest', - 'CreateStreamRequest', - 'UpdateStreamRequest', - 'DeleteStreamRequest', - 'GetStreamObjectRequest', - 'LookupStreamObjectRequest', - 'StartBackfillJobRequest', - 'StartBackfillJobResponse', - 'StopBackfillJobRequest', - 'StopBackfillJobResponse', - 'ListStreamObjectsRequest', - 'ListStreamObjectsResponse', - 'OperationMetadata', - 'CreatePrivateConnectionRequest', - 'ListPrivateConnectionsRequest', - 'ListPrivateConnectionsResponse', - 'DeletePrivateConnectionRequest', - 'GetPrivateConnectionRequest', - 'CreateRouteRequest', - 'ListRoutesRequest', - 'ListRoutesResponse', - 'DeleteRouteRequest', - 'GetRouteRequest', - }, -) - - -class DiscoverConnectionProfileRequest(proto.Message): - r"""Request message for 'discover' ConnectionProfile request. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - parent (str): - Required. The parent resource of the connection profile - type. Must be in the format ``projects/*/locations/*``. - connection_profile (google.cloud.datastream_v1.types.ConnectionProfile): - An ad-hoc connection profile configuration. - - This field is a member of `oneof`_ ``target``. - connection_profile_name (str): - A reference to an existing connection - profile. - - This field is a member of `oneof`_ ``target``. - full_hierarchy (bool): - Whether to retrieve the full hierarchy of - data objects (TRUE) or only the current level - (FALSE). - - This field is a member of `oneof`_ ``hierarchy``. - hierarchy_depth (int): - The number of hierarchy levels below the - current level to be retrieved. - - This field is a member of `oneof`_ ``hierarchy``. - oracle_rdbms (google.cloud.datastream_v1.types.OracleRdbms): - Oracle RDBMS to enrich with child data - objects and metadata. - - This field is a member of `oneof`_ ``data_object``. - mysql_rdbms (google.cloud.datastream_v1.types.MysqlRdbms): - MySQL RDBMS to enrich with child data objects - and metadata. - - This field is a member of `oneof`_ ``data_object``. - postgresql_rdbms (google.cloud.datastream_v1.types.PostgresqlRdbms): - PostgreSQL RDBMS to enrich with child data - objects and metadata. - - This field is a member of `oneof`_ ``data_object``. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - connection_profile: datastream_resources.ConnectionProfile = proto.Field( - proto.MESSAGE, - number=200, - oneof='target', - message=datastream_resources.ConnectionProfile, - ) - connection_profile_name: str = proto.Field( - proto.STRING, - number=201, - oneof='target', - ) - full_hierarchy: bool = proto.Field( - proto.BOOL, - number=3, - oneof='hierarchy', - ) - hierarchy_depth: int = proto.Field( - proto.INT32, - number=4, - oneof='hierarchy', - ) - oracle_rdbms: datastream_resources.OracleRdbms = proto.Field( - proto.MESSAGE, - number=100, - oneof='data_object', - message=datastream_resources.OracleRdbms, - ) - mysql_rdbms: datastream_resources.MysqlRdbms = proto.Field( - proto.MESSAGE, - number=101, - oneof='data_object', - message=datastream_resources.MysqlRdbms, - ) - postgresql_rdbms: datastream_resources.PostgresqlRdbms = proto.Field( - proto.MESSAGE, - number=102, - oneof='data_object', - message=datastream_resources.PostgresqlRdbms, - ) - - -class DiscoverConnectionProfileResponse(proto.Message): - r"""Response from a discover request. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - oracle_rdbms (google.cloud.datastream_v1.types.OracleRdbms): - Enriched Oracle RDBMS object. - - This field is a member of `oneof`_ ``data_object``. - mysql_rdbms (google.cloud.datastream_v1.types.MysqlRdbms): - Enriched MySQL RDBMS object. - - This field is a member of `oneof`_ ``data_object``. - postgresql_rdbms (google.cloud.datastream_v1.types.PostgresqlRdbms): - Enriched PostgreSQL RDBMS object. - - This field is a member of `oneof`_ ``data_object``. - """ - - oracle_rdbms: datastream_resources.OracleRdbms = proto.Field( - proto.MESSAGE, - number=100, - oneof='data_object', - message=datastream_resources.OracleRdbms, - ) - mysql_rdbms: datastream_resources.MysqlRdbms = proto.Field( - proto.MESSAGE, - number=101, - oneof='data_object', - message=datastream_resources.MysqlRdbms, - ) - postgresql_rdbms: datastream_resources.PostgresqlRdbms = proto.Field( - proto.MESSAGE, - number=102, - oneof='data_object', - message=datastream_resources.PostgresqlRdbms, - ) - - -class FetchStaticIpsRequest(proto.Message): - r"""Request message for 'FetchStaticIps' request. - - Attributes: - name (str): - Required. The resource name for the location for which - static IPs should be returned. Must be in the format - ``projects/*/locations/*``. - page_size (int): - Maximum number of Ips to return, will likely - not be specified. - page_token (str): - A page token, received from a previous ``ListStaticIps`` - call. will likely not be specified. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - - -class FetchStaticIpsResponse(proto.Message): - r"""Response message for a 'FetchStaticIps' response. - - Attributes: - static_ips (MutableSequence[str]): - list of static ips by account - next_page_token (str): - A token that can be sent as ``page_token`` to retrieve the - next page. If this field is omitted, there are no subsequent - pages. - """ - - @property - def raw_page(self): - return self - - static_ips: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=1, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - - -class ListConnectionProfilesRequest(proto.Message): - r"""Request message for listing connection profiles. - - Attributes: - parent (str): - Required. The parent that owns the collection - of connection profiles. - page_size (int): - Maximum number of connection profiles to - return. If unspecified, at most 50 connection - profiles will be returned. The maximum value is - 1000; values above 1000 will be coerced to 1000. - page_token (str): - Page token received from a previous - ``ListConnectionProfiles`` call. Provide this to retrieve - the subsequent page. - - When paginating, all other parameters provided to - ``ListConnectionProfiles`` must match the call that provided - the page token. - filter (str): - Filter request. - order_by (str): - Order by fields for the result. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - filter: str = proto.Field( - proto.STRING, - number=4, - ) - order_by: str = proto.Field( - proto.STRING, - number=5, - ) - - -class ListConnectionProfilesResponse(proto.Message): - r"""Response message for listing connection profiles. - - Attributes: - connection_profiles (MutableSequence[google.cloud.datastream_v1.types.ConnectionProfile]): - List of connection profiles. - next_page_token (str): - A token, which can be sent as ``page_token`` to retrieve the - next page. If this field is omitted, there are no subsequent - pages. - unreachable (MutableSequence[str]): - Locations that could not be reached. - """ - - @property - def raw_page(self): - return self - - connection_profiles: MutableSequence[datastream_resources.ConnectionProfile] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=datastream_resources.ConnectionProfile, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - unreachable: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - - -class GetConnectionProfileRequest(proto.Message): - r"""Request message for getting a connection profile. - - Attributes: - name (str): - Required. The name of the connection profile - resource to get. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class CreateConnectionProfileRequest(proto.Message): - r"""Request message for creating a connection profile. - - Attributes: - parent (str): - Required. The parent that owns the collection - of ConnectionProfiles. - connection_profile_id (str): - Required. The connection profile identifier. - connection_profile (google.cloud.datastream_v1.types.ConnectionProfile): - Required. The connection profile resource to - create. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes since the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - validate_only (bool): - Optional. Only validate the connection - profile, but don't create any resources. The - default is false. - force (bool): - Optional. Create the connection profile - without validating it. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - connection_profile_id: str = proto.Field( - proto.STRING, - number=2, - ) - connection_profile: datastream_resources.ConnectionProfile = proto.Field( - proto.MESSAGE, - number=3, - message=datastream_resources.ConnectionProfile, - ) - request_id: str = proto.Field( - proto.STRING, - number=4, - ) - validate_only: bool = proto.Field( - proto.BOOL, - number=5, - ) - force: bool = proto.Field( - proto.BOOL, - number=6, - ) - - -class UpdateConnectionProfileRequest(proto.Message): - r"""Connection profile update message. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Optional. Field mask is used to specify the fields to be - overwritten in the ConnectionProfile resource by the update. - The fields specified in the update_mask are relative to the - resource, not the full request. A field will be overwritten - if it is in the mask. If the user does not provide a mask - then all fields will be overwritten. - connection_profile (google.cloud.datastream_v1.types.ConnectionProfile): - Required. The connection profile to update. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes since the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - validate_only (bool): - Optional. Only validate the connection - profile, but don't update any resources. The - default is false. - force (bool): - Optional. Update the connection profile - without validating it. - """ - - update_mask: field_mask_pb2.FieldMask = proto.Field( - proto.MESSAGE, - number=1, - message=field_mask_pb2.FieldMask, - ) - connection_profile: datastream_resources.ConnectionProfile = proto.Field( - proto.MESSAGE, - number=2, - message=datastream_resources.ConnectionProfile, - ) - request_id: str = proto.Field( - proto.STRING, - number=3, - ) - validate_only: bool = proto.Field( - proto.BOOL, - number=4, - ) - force: bool = proto.Field( - proto.BOOL, - number=5, - ) - - -class DeleteConnectionProfileRequest(proto.Message): - r"""Request message for deleting a connection profile. - - Attributes: - name (str): - Required. The name of the connection profile - resource to delete. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes after the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - request_id: str = proto.Field( - proto.STRING, - number=2, - ) - - -class ListStreamsRequest(proto.Message): - r"""Request message for listing streams. - - Attributes: - parent (str): - Required. The parent that owns the collection - of streams. - page_size (int): - Maximum number of streams to return. - If unspecified, at most 50 streams will be - returned. The maximum value is 1000; values - above 1000 will be coerced to 1000. - page_token (str): - Page token received from a previous ``ListStreams`` call. - Provide this to retrieve the subsequent page. - - When paginating, all other parameters provided to - ``ListStreams`` must match the call that provided the page - token. - filter (str): - Filter request. - order_by (str): - Order by fields for the result. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - filter: str = proto.Field( - proto.STRING, - number=4, - ) - order_by: str = proto.Field( - proto.STRING, - number=5, - ) - - -class ListStreamsResponse(proto.Message): - r"""Response message for listing streams. - - Attributes: - streams (MutableSequence[google.cloud.datastream_v1.types.Stream]): - List of streams - next_page_token (str): - A token, which can be sent as ``page_token`` to retrieve the - next page. If this field is omitted, there are no subsequent - pages. - unreachable (MutableSequence[str]): - Locations that could not be reached. - """ - - @property - def raw_page(self): - return self - - streams: MutableSequence[datastream_resources.Stream] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=datastream_resources.Stream, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - unreachable: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - - -class GetStreamRequest(proto.Message): - r"""Request message for getting a stream. - - Attributes: - name (str): - Required. The name of the stream resource to - get. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class CreateStreamRequest(proto.Message): - r"""Request message for creating a stream. - - Attributes: - parent (str): - Required. The parent that owns the collection - of streams. - stream_id (str): - Required. The stream identifier. - stream (google.cloud.datastream_v1.types.Stream): - Required. The stream resource to create. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes since the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - validate_only (bool): - Optional. Only validate the stream, but don't - create any resources. The default is false. - force (bool): - Optional. Create the stream without - validating it. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - stream_id: str = proto.Field( - proto.STRING, - number=2, - ) - stream: datastream_resources.Stream = proto.Field( - proto.MESSAGE, - number=3, - message=datastream_resources.Stream, - ) - request_id: str = proto.Field( - proto.STRING, - number=4, - ) - validate_only: bool = proto.Field( - proto.BOOL, - number=5, - ) - force: bool = proto.Field( - proto.BOOL, - number=6, - ) - - -class UpdateStreamRequest(proto.Message): - r"""Request message for updating a stream. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Optional. Field mask is used to specify the fields to be - overwritten in the stream resource by the update. The fields - specified in the update_mask are relative to the resource, - not the full request. A field will be overwritten if it is - in the mask. If the user does not provide a mask then all - fields will be overwritten. - stream (google.cloud.datastream_v1.types.Stream): - Required. The stream resource to update. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes since the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - validate_only (bool): - Optional. Only validate the stream with the - changes, without actually updating it. The - default is false. - force (bool): - Optional. Update the stream without - validating it. - """ - - update_mask: field_mask_pb2.FieldMask = proto.Field( - proto.MESSAGE, - number=1, - message=field_mask_pb2.FieldMask, - ) - stream: datastream_resources.Stream = proto.Field( - proto.MESSAGE, - number=2, - message=datastream_resources.Stream, - ) - request_id: str = proto.Field( - proto.STRING, - number=3, - ) - validate_only: bool = proto.Field( - proto.BOOL, - number=4, - ) - force: bool = proto.Field( - proto.BOOL, - number=5, - ) - - -class DeleteStreamRequest(proto.Message): - r"""Request message for deleting a stream. - - Attributes: - name (str): - Required. The name of the stream resource to - delete. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes after the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - request_id: str = proto.Field( - proto.STRING, - number=2, - ) - - -class GetStreamObjectRequest(proto.Message): - r"""Request for fetching a specific stream object. - - Attributes: - name (str): - Required. The name of the stream object - resource to get. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class LookupStreamObjectRequest(proto.Message): - r"""Request for looking up a specific stream object by its source - object identifier. - - Attributes: - parent (str): - Required. The parent stream that owns the - collection of objects. - source_object_identifier (google.cloud.datastream_v1.types.SourceObjectIdentifier): - Required. The source object identifier which - maps to the stream object. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - source_object_identifier: datastream_resources.SourceObjectIdentifier = proto.Field( - proto.MESSAGE, - number=2, - message=datastream_resources.SourceObjectIdentifier, - ) - - -class StartBackfillJobRequest(proto.Message): - r"""Request for manually initiating a backfill job for a specific - stream object. - - Attributes: - object_ (str): - Required. The name of the stream object - resource to start a backfill job for. - """ - - object_: str = proto.Field( - proto.STRING, - number=1, - ) - - -class StartBackfillJobResponse(proto.Message): - r"""Response for manually initiating a backfill job for a - specific stream object. - - Attributes: - object_ (google.cloud.datastream_v1.types.StreamObject): - The stream object resource a backfill job was - started for. - """ - - object_: datastream_resources.StreamObject = proto.Field( - proto.MESSAGE, - number=1, - message=datastream_resources.StreamObject, - ) - - -class StopBackfillJobRequest(proto.Message): - r"""Request for manually stopping a running backfill job for a - specific stream object. - - Attributes: - object_ (str): - Required. The name of the stream object - resource to stop the backfill job for. - """ - - object_: str = proto.Field( - proto.STRING, - number=1, - ) - - -class StopBackfillJobResponse(proto.Message): - r"""Response for manually stop a backfill job for a specific - stream object. - - Attributes: - object_ (google.cloud.datastream_v1.types.StreamObject): - The stream object resource the backfill job - was stopped for. - """ - - object_: datastream_resources.StreamObject = proto.Field( - proto.MESSAGE, - number=1, - message=datastream_resources.StreamObject, - ) - - -class ListStreamObjectsRequest(proto.Message): - r"""Request for listing all objects for a specific stream. - - Attributes: - parent (str): - Required. The parent stream that owns the - collection of objects. - page_size (int): - Maximum number of objects to return. Default - is 50. The maximum value is 1000; values above - 1000 will be coerced to 1000. - page_token (str): - Page token received from a previous - ``ListStreamObjectsRequest`` call. Provide this to retrieve - the subsequent page. - - When paginating, all other parameters provided to - ``ListStreamObjectsRequest`` must match the call that - provided the page token. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - - -class ListStreamObjectsResponse(proto.Message): - r"""Response containing the objects for a stream. - - Attributes: - stream_objects (MutableSequence[google.cloud.datastream_v1.types.StreamObject]): - List of stream objects. - next_page_token (str): - A token, which can be sent as ``page_token`` to retrieve the - next page. - """ - - @property - def raw_page(self): - return self - - stream_objects: MutableSequence[datastream_resources.StreamObject] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=datastream_resources.StreamObject, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - - -class OperationMetadata(proto.Message): - r"""Represents the metadata of the long-running operation. - - Attributes: - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time the operation was - created. - end_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time the operation finished - running. - target (str): - Output only. Server-defined resource path for - the target of the operation. - verb (str): - Output only. Name of the verb executed by the - operation. - status_message (str): - Output only. Human-readable status of the - operation, if any. - requested_cancellation (bool): - Output only. Identifies whether the user has requested - cancellation of the operation. Operations that have - successfully been cancelled have [Operation.error][] value - with a [google.rpc.Status.code][google.rpc.Status.code] of - 1, corresponding to ``Code.CANCELLED``. - api_version (str): - Output only. API version used to start the - operation. - validation_result (google.cloud.datastream_v1.types.ValidationResult): - Output only. Results of executed validations - if there are any. - """ - - create_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=1, - message=timestamp_pb2.Timestamp, - ) - end_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=2, - message=timestamp_pb2.Timestamp, - ) - target: str = proto.Field( - proto.STRING, - number=3, - ) - verb: str = proto.Field( - proto.STRING, - number=4, - ) - status_message: str = proto.Field( - proto.STRING, - number=5, - ) - requested_cancellation: bool = proto.Field( - proto.BOOL, - number=6, - ) - api_version: str = proto.Field( - proto.STRING, - number=7, - ) - validation_result: datastream_resources.ValidationResult = proto.Field( - proto.MESSAGE, - number=8, - message=datastream_resources.ValidationResult, - ) - - -class CreatePrivateConnectionRequest(proto.Message): - r"""Request for creating a private connection. - - Attributes: - parent (str): - Required. The parent that owns the collection - of PrivateConnections. - private_connection_id (str): - Required. The private connectivity - identifier. - private_connection (google.cloud.datastream_v1.types.PrivateConnection): - Required. The Private Connectivity resource - to create. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes since the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - private_connection_id: str = proto.Field( - proto.STRING, - number=2, - ) - private_connection: datastream_resources.PrivateConnection = proto.Field( - proto.MESSAGE, - number=3, - message=datastream_resources.PrivateConnection, - ) - request_id: str = proto.Field( - proto.STRING, - number=4, - ) - - -class ListPrivateConnectionsRequest(proto.Message): - r"""Request for listing private connections. - - Attributes: - parent (str): - Required. The parent that owns the collection - of private connectivity configurations. - page_size (int): - Maximum number of private connectivity - configurations to return. If unspecified, at - most 50 private connectivity configurations that - will be returned. The maximum value is 1000; - values above 1000 will be coerced to 1000. - page_token (str): - Page token received from a previous - ``ListPrivateConnections`` call. Provide this to retrieve - the subsequent page. - - When paginating, all other parameters provided to - ``ListPrivateConnections`` must match the call that provided - the page token. - filter (str): - Filter request. - order_by (str): - Order by fields for the result. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - filter: str = proto.Field( - proto.STRING, - number=4, - ) - order_by: str = proto.Field( - proto.STRING, - number=5, - ) - - -class ListPrivateConnectionsResponse(proto.Message): - r"""Response containing a list of private connection - configurations. - - Attributes: - private_connections (MutableSequence[google.cloud.datastream_v1.types.PrivateConnection]): - List of private connectivity configurations. - next_page_token (str): - A token, which can be sent as ``page_token`` to retrieve the - next page. If this field is omitted, there are no subsequent - pages. - unreachable (MutableSequence[str]): - Locations that could not be reached. - """ - - @property - def raw_page(self): - return self - - private_connections: MutableSequence[datastream_resources.PrivateConnection] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=datastream_resources.PrivateConnection, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - unreachable: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - - -class DeletePrivateConnectionRequest(proto.Message): - r"""Request to delete a private connection. - - Attributes: - name (str): - Required. The name of the private - connectivity configuration to delete. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes after the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - force (bool): - Optional. If set to true, any child routes - that belong to this PrivateConnection will also - be deleted. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - request_id: str = proto.Field( - proto.STRING, - number=2, - ) - force: bool = proto.Field( - proto.BOOL, - number=3, - ) - - -class GetPrivateConnectionRequest(proto.Message): - r"""Request to get a private connection configuration. - - Attributes: - name (str): - Required. The name of the private - connectivity configuration to get. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class CreateRouteRequest(proto.Message): - r"""Route creation request. - - Attributes: - parent (str): - Required. The parent that owns the collection - of Routes. - route_id (str): - Required. The Route identifier. - route (google.cloud.datastream_v1.types.Route): - Required. The Route resource to create. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes since the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - route_id: str = proto.Field( - proto.STRING, - number=2, - ) - route: datastream_resources.Route = proto.Field( - proto.MESSAGE, - number=3, - message=datastream_resources.Route, - ) - request_id: str = proto.Field( - proto.STRING, - number=4, - ) - - -class ListRoutesRequest(proto.Message): - r"""Route list request. - - Attributes: - parent (str): - Required. The parent that owns the collection - of Routess. - page_size (int): - Maximum number of Routes to return. The - service may return fewer than this value. If - unspecified, at most 50 Routes will be returned. - The maximum value is 1000; values above 1000 - will be coerced to 1000. - page_token (str): - Page token received from a previous ``ListRoutes`` call. - Provide this to retrieve the subsequent page. - - When paginating, all other parameters provided to - ``ListRoutes`` must match the call that provided the page - token. - filter (str): - Filter request. - order_by (str): - Order by fields for the result. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - filter: str = proto.Field( - proto.STRING, - number=4, - ) - order_by: str = proto.Field( - proto.STRING, - number=5, - ) - - -class ListRoutesResponse(proto.Message): - r"""Route list response. - - Attributes: - routes (MutableSequence[google.cloud.datastream_v1.types.Route]): - List of Routes. - next_page_token (str): - A token, which can be sent as ``page_token`` to retrieve the - next page. If this field is omitted, there are no subsequent - pages. - unreachable (MutableSequence[str]): - Locations that could not be reached. - """ - - @property - def raw_page(self): - return self - - routes: MutableSequence[datastream_resources.Route] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=datastream_resources.Route, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - unreachable: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - - -class DeleteRouteRequest(proto.Message): - r"""Route deletion request. - - Attributes: - name (str): - Required. The name of the Route resource to - delete. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes after the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - request_id: str = proto.Field( - proto.STRING, - number=2, - ) - - -class GetRouteRequest(proto.Message): - r"""Route get request. - - Attributes: - name (str): - Required. The name of the Route resource to - get. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/datastream_v1/types/datastream_resources.py b/owl-bot-staging/v1/google/cloud/datastream_v1/types/datastream_resources.py deleted file mode 100644 index 23530ba..0000000 --- a/owl-bot-staging/v1/google/cloud/datastream_v1/types/datastream_resources.py +++ /dev/null @@ -1,2091 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from typing import MutableMapping, MutableSequence - -import proto # type: ignore - -from google.protobuf import duration_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore - - -__protobuf__ = proto.module( - package='google.cloud.datastream.v1', - manifest={ - 'OracleProfile', - 'MysqlProfile', - 'PostgresqlProfile', - 'GcsProfile', - 'BigQueryProfile', - 'StaticServiceIpConnectivity', - 'ForwardSshTunnelConnectivity', - 'VpcPeeringConfig', - 'PrivateConnection', - 'PrivateConnectivity', - 'Route', - 'MysqlSslConfig', - 'ConnectionProfile', - 'OracleColumn', - 'OracleTable', - 'OracleSchema', - 'OracleRdbms', - 'OracleSourceConfig', - 'PostgresqlColumn', - 'PostgresqlTable', - 'PostgresqlSchema', - 'PostgresqlRdbms', - 'PostgresqlSourceConfig', - 'MysqlColumn', - 'MysqlTable', - 'MysqlDatabase', - 'MysqlRdbms', - 'MysqlSourceConfig', - 'SourceConfig', - 'AvroFileFormat', - 'JsonFileFormat', - 'GcsDestinationConfig', - 'BigQueryDestinationConfig', - 'DestinationConfig', - 'Stream', - 'StreamObject', - 'SourceObjectIdentifier', - 'BackfillJob', - 'Error', - 'ValidationResult', - 'Validation', - 'ValidationMessage', - }, -) - - -class OracleProfile(proto.Message): - r"""Oracle database profile. - - Attributes: - hostname (str): - Required. Hostname for the Oracle connection. - port (int): - Port for the Oracle connection, default value - is 1521. - username (str): - Required. Username for the Oracle connection. - password (str): - Required. Password for the Oracle connection. - database_service (str): - Required. Database for the Oracle connection. - connection_attributes (MutableMapping[str, str]): - Connection string attributes - """ - - hostname: str = proto.Field( - proto.STRING, - number=1, - ) - port: int = proto.Field( - proto.INT32, - number=2, - ) - username: str = proto.Field( - proto.STRING, - number=3, - ) - password: str = proto.Field( - proto.STRING, - number=4, - ) - database_service: str = proto.Field( - proto.STRING, - number=5, - ) - connection_attributes: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=6, - ) - - -class MysqlProfile(proto.Message): - r"""MySQL database profile. - - Attributes: - hostname (str): - Required. Hostname for the MySQL connection. - port (int): - Port for the MySQL connection, default value - is 3306. - username (str): - Required. Username for the MySQL connection. - password (str): - Required. Input only. Password for the MySQL - connection. - ssl_config (google.cloud.datastream_v1.types.MysqlSslConfig): - SSL configuration for the MySQL connection. - """ - - hostname: str = proto.Field( - proto.STRING, - number=1, - ) - port: int = proto.Field( - proto.INT32, - number=2, - ) - username: str = proto.Field( - proto.STRING, - number=3, - ) - password: str = proto.Field( - proto.STRING, - number=4, - ) - ssl_config: 'MysqlSslConfig' = proto.Field( - proto.MESSAGE, - number=5, - message='MysqlSslConfig', - ) - - -class PostgresqlProfile(proto.Message): - r"""PostgreSQL database profile. - - Attributes: - hostname (str): - Required. Hostname for the PostgreSQL - connection. - port (int): - Port for the PostgreSQL connection, default - value is 5432. - username (str): - Required. Username for the PostgreSQL - connection. - password (str): - Required. Password for the PostgreSQL - connection. - database (str): - Required. Database for the PostgreSQL - connection. - """ - - hostname: str = proto.Field( - proto.STRING, - number=1, - ) - port: int = proto.Field( - proto.INT32, - number=2, - ) - username: str = proto.Field( - proto.STRING, - number=3, - ) - password: str = proto.Field( - proto.STRING, - number=4, - ) - database: str = proto.Field( - proto.STRING, - number=5, - ) - - -class GcsProfile(proto.Message): - r"""Cloud Storage bucket profile. - - Attributes: - bucket (str): - Required. The Cloud Storage bucket name. - root_path (str): - The root path inside the Cloud Storage - bucket. - """ - - bucket: str = proto.Field( - proto.STRING, - number=1, - ) - root_path: str = proto.Field( - proto.STRING, - number=2, - ) - - -class BigQueryProfile(proto.Message): - r"""BigQuery warehouse profile. - """ - - -class StaticServiceIpConnectivity(proto.Message): - r"""Static IP address connectivity. - """ - - -class ForwardSshTunnelConnectivity(proto.Message): - r"""Forward SSH Tunnel connectivity. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - hostname (str): - Required. Hostname for the SSH tunnel. - username (str): - Required. Username for the SSH tunnel. - port (int): - Port for the SSH tunnel, default value is 22. - password (str): - Input only. SSH password. - - This field is a member of `oneof`_ ``authentication_method``. - private_key (str): - Input only. SSH private key. - - This field is a member of `oneof`_ ``authentication_method``. - """ - - hostname: str = proto.Field( - proto.STRING, - number=1, - ) - username: str = proto.Field( - proto.STRING, - number=2, - ) - port: int = proto.Field( - proto.INT32, - number=3, - ) - password: str = proto.Field( - proto.STRING, - number=100, - oneof='authentication_method', - ) - private_key: str = proto.Field( - proto.STRING, - number=101, - oneof='authentication_method', - ) - - -class VpcPeeringConfig(proto.Message): - r"""The VPC Peering configuration is used to create VPC peering - between Datastream and the consumer's VPC. - - Attributes: - vpc (str): - Required. Fully qualified name of the VPC that Datastream - will peer to. Format: - ``projects/{project}/global/{networks}/{name}`` - subnet (str): - Required. A free subnet for peering. (CIDR of - /29) - """ - - vpc: str = proto.Field( - proto.STRING, - number=1, - ) - subnet: str = proto.Field( - proto.STRING, - number=2, - ) - - -class PrivateConnection(proto.Message): - r"""The PrivateConnection resource is used to establish private - connectivity between Datastream and a customer's network. - - Attributes: - name (str): - Output only. The resource's name. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The create time of the resource. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The update time of the resource. - labels (MutableMapping[str, str]): - Labels. - display_name (str): - Required. Display name. - state (google.cloud.datastream_v1.types.PrivateConnection.State): - Output only. The state of the Private - Connection. - error (google.cloud.datastream_v1.types.Error): - Output only. In case of error, the details of - the error in a user-friendly format. - vpc_peering_config (google.cloud.datastream_v1.types.VpcPeeringConfig): - VPC Peering Config. - """ - class State(proto.Enum): - r"""Private Connection state. - - Values: - STATE_UNSPECIFIED (0): - Unspecified state. - CREATING (1): - The private connection is in creation state - - creating resources. - CREATED (2): - The private connection has been created with - all of its resources. - FAILED (3): - The private connection creation has failed. - DELETING (4): - The private connection is being deleted. - FAILED_TO_DELETE (5): - Delete request has failed, resource is in - invalid state. - """ - STATE_UNSPECIFIED = 0 - CREATING = 1 - CREATED = 2 - FAILED = 3 - DELETING = 4 - FAILED_TO_DELETE = 5 - - name: str = proto.Field( - proto.STRING, - number=1, - ) - create_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=2, - message=timestamp_pb2.Timestamp, - ) - update_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=3, - message=timestamp_pb2.Timestamp, - ) - labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=4, - ) - display_name: str = proto.Field( - proto.STRING, - number=5, - ) - state: State = proto.Field( - proto.ENUM, - number=6, - enum=State, - ) - error: 'Error' = proto.Field( - proto.MESSAGE, - number=7, - message='Error', - ) - vpc_peering_config: 'VpcPeeringConfig' = proto.Field( - proto.MESSAGE, - number=100, - message='VpcPeeringConfig', - ) - - -class PrivateConnectivity(proto.Message): - r"""Private Connectivity - - Attributes: - private_connection (str): - Required. A reference to a private connection resource. - Format: - ``projects/{project}/locations/{location}/privateConnections/{name}`` - """ - - private_connection: str = proto.Field( - proto.STRING, - number=1, - ) - - -class Route(proto.Message): - r"""The route resource is the child of the private connection - resource, used for defining a route for a private connection. - - Attributes: - name (str): - Output only. The resource's name. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The create time of the resource. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The update time of the resource. - labels (MutableMapping[str, str]): - Labels. - display_name (str): - Required. Display name. - destination_address (str): - Required. Destination address for connection - destination_port (int): - Destination port for connection - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - create_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=2, - message=timestamp_pb2.Timestamp, - ) - update_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=3, - message=timestamp_pb2.Timestamp, - ) - labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=4, - ) - display_name: str = proto.Field( - proto.STRING, - number=5, - ) - destination_address: str = proto.Field( - proto.STRING, - number=6, - ) - destination_port: int = proto.Field( - proto.INT32, - number=7, - ) - - -class MysqlSslConfig(proto.Message): - r"""MySQL SSL configuration information. - - Attributes: - client_key (str): - Input only. PEM-encoded private key associated with the - Client Certificate. If this field is used then the - 'client_certificate' and the 'ca_certificate' fields are - mandatory. - client_key_set (bool): - Output only. Indicates whether the client_key field is set. - client_certificate (str): - Input only. PEM-encoded certificate that will be used by the - replica to authenticate against the source database server. - If this field is used then the 'client_key' and the - 'ca_certificate' fields are mandatory. - client_certificate_set (bool): - Output only. Indicates whether the client_certificate field - is set. - ca_certificate (str): - Input only. PEM-encoded certificate of the CA - that signed the source database server's - certificate. - ca_certificate_set (bool): - Output only. Indicates whether the ca_certificate field is - set. - """ - - client_key: str = proto.Field( - proto.STRING, - number=1, - ) - client_key_set: bool = proto.Field( - proto.BOOL, - number=2, - ) - client_certificate: str = proto.Field( - proto.STRING, - number=3, - ) - client_certificate_set: bool = proto.Field( - proto.BOOL, - number=4, - ) - ca_certificate: str = proto.Field( - proto.STRING, - number=5, - ) - ca_certificate_set: bool = proto.Field( - proto.BOOL, - number=6, - ) - - -class ConnectionProfile(proto.Message): - r"""A set of reusable connection configurations to be used as a - source or destination for a stream. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - name (str): - Output only. The resource's name. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The create time of the resource. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The update time of the resource. - labels (MutableMapping[str, str]): - Labels. - display_name (str): - Required. Display name. - oracle_profile (google.cloud.datastream_v1.types.OracleProfile): - Oracle ConnectionProfile configuration. - - This field is a member of `oneof`_ ``profile``. - gcs_profile (google.cloud.datastream_v1.types.GcsProfile): - Cloud Storage ConnectionProfile - configuration. - - This field is a member of `oneof`_ ``profile``. - mysql_profile (google.cloud.datastream_v1.types.MysqlProfile): - MySQL ConnectionProfile configuration. - - This field is a member of `oneof`_ ``profile``. - bigquery_profile (google.cloud.datastream_v1.types.BigQueryProfile): - BigQuery Connection Profile configuration. - - This field is a member of `oneof`_ ``profile``. - postgresql_profile (google.cloud.datastream_v1.types.PostgresqlProfile): - PostgreSQL Connection Profile configuration. - - This field is a member of `oneof`_ ``profile``. - static_service_ip_connectivity (google.cloud.datastream_v1.types.StaticServiceIpConnectivity): - Static Service IP connectivity. - - This field is a member of `oneof`_ ``connectivity``. - forward_ssh_connectivity (google.cloud.datastream_v1.types.ForwardSshTunnelConnectivity): - Forward SSH tunnel connectivity. - - This field is a member of `oneof`_ ``connectivity``. - private_connectivity (google.cloud.datastream_v1.types.PrivateConnectivity): - Private connectivity. - - This field is a member of `oneof`_ ``connectivity``. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - create_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=2, - message=timestamp_pb2.Timestamp, - ) - update_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=3, - message=timestamp_pb2.Timestamp, - ) - labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=4, - ) - display_name: str = proto.Field( - proto.STRING, - number=5, - ) - oracle_profile: 'OracleProfile' = proto.Field( - proto.MESSAGE, - number=100, - oneof='profile', - message='OracleProfile', - ) - gcs_profile: 'GcsProfile' = proto.Field( - proto.MESSAGE, - number=101, - oneof='profile', - message='GcsProfile', - ) - mysql_profile: 'MysqlProfile' = proto.Field( - proto.MESSAGE, - number=102, - oneof='profile', - message='MysqlProfile', - ) - bigquery_profile: 'BigQueryProfile' = proto.Field( - proto.MESSAGE, - number=103, - oneof='profile', - message='BigQueryProfile', - ) - postgresql_profile: 'PostgresqlProfile' = proto.Field( - proto.MESSAGE, - number=104, - oneof='profile', - message='PostgresqlProfile', - ) - static_service_ip_connectivity: 'StaticServiceIpConnectivity' = proto.Field( - proto.MESSAGE, - number=200, - oneof='connectivity', - message='StaticServiceIpConnectivity', - ) - forward_ssh_connectivity: 'ForwardSshTunnelConnectivity' = proto.Field( - proto.MESSAGE, - number=201, - oneof='connectivity', - message='ForwardSshTunnelConnectivity', - ) - private_connectivity: 'PrivateConnectivity' = proto.Field( - proto.MESSAGE, - number=202, - oneof='connectivity', - message='PrivateConnectivity', - ) - - -class OracleColumn(proto.Message): - r"""Oracle Column. - - Attributes: - column (str): - Column name. - data_type (str): - The Oracle data type. - length (int): - Column length. - precision (int): - Column precision. - scale (int): - Column scale. - encoding (str): - Column encoding. - primary_key (bool): - Whether or not the column represents a - primary key. - nullable (bool): - Whether or not the column can accept a null - value. - ordinal_position (int): - The ordinal position of the column in the - table. - """ - - column: str = proto.Field( - proto.STRING, - number=1, - ) - data_type: str = proto.Field( - proto.STRING, - number=2, - ) - length: int = proto.Field( - proto.INT32, - number=3, - ) - precision: int = proto.Field( - proto.INT32, - number=4, - ) - scale: int = proto.Field( - proto.INT32, - number=5, - ) - encoding: str = proto.Field( - proto.STRING, - number=6, - ) - primary_key: bool = proto.Field( - proto.BOOL, - number=7, - ) - nullable: bool = proto.Field( - proto.BOOL, - number=8, - ) - ordinal_position: int = proto.Field( - proto.INT32, - number=9, - ) - - -class OracleTable(proto.Message): - r"""Oracle table. - - Attributes: - table (str): - Table name. - oracle_columns (MutableSequence[google.cloud.datastream_v1.types.OracleColumn]): - Oracle columns in the schema. - When unspecified as part of include/exclude - objects, includes/excludes everything. - """ - - table: str = proto.Field( - proto.STRING, - number=1, - ) - oracle_columns: MutableSequence['OracleColumn'] = proto.RepeatedField( - proto.MESSAGE, - number=2, - message='OracleColumn', - ) - - -class OracleSchema(proto.Message): - r"""Oracle schema. - - Attributes: - schema (str): - Schema name. - oracle_tables (MutableSequence[google.cloud.datastream_v1.types.OracleTable]): - Tables in the schema. - """ - - schema: str = proto.Field( - proto.STRING, - number=1, - ) - oracle_tables: MutableSequence['OracleTable'] = proto.RepeatedField( - proto.MESSAGE, - number=2, - message='OracleTable', - ) - - -class OracleRdbms(proto.Message): - r"""Oracle database structure. - - Attributes: - oracle_schemas (MutableSequence[google.cloud.datastream_v1.types.OracleSchema]): - Oracle schemas/databases in the database - server. - """ - - oracle_schemas: MutableSequence['OracleSchema'] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='OracleSchema', - ) - - -class OracleSourceConfig(proto.Message): - r"""Oracle data source configuration - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - include_objects (google.cloud.datastream_v1.types.OracleRdbms): - Oracle objects to include in the stream. - exclude_objects (google.cloud.datastream_v1.types.OracleRdbms): - Oracle objects to exclude from the stream. - max_concurrent_cdc_tasks (int): - Maximum number of concurrent CDC tasks. The - number should be non negative. If not set (or - set to 0), the system's default value will be - used. - drop_large_objects (google.cloud.datastream_v1.types.OracleSourceConfig.DropLargeObjects): - Drop large object values. - - This field is a member of `oneof`_ ``large_objects_handling``. - stream_large_objects (google.cloud.datastream_v1.types.OracleSourceConfig.StreamLargeObjects): - Stream large object values. - - This field is a member of `oneof`_ ``large_objects_handling``. - """ - - class DropLargeObjects(proto.Message): - r"""Configuration to drop large object values. - """ - - class StreamLargeObjects(proto.Message): - r"""Configuration to stream large object values. - """ - - include_objects: 'OracleRdbms' = proto.Field( - proto.MESSAGE, - number=1, - message='OracleRdbms', - ) - exclude_objects: 'OracleRdbms' = proto.Field( - proto.MESSAGE, - number=2, - message='OracleRdbms', - ) - max_concurrent_cdc_tasks: int = proto.Field( - proto.INT32, - number=3, - ) - drop_large_objects: DropLargeObjects = proto.Field( - proto.MESSAGE, - number=100, - oneof='large_objects_handling', - message=DropLargeObjects, - ) - stream_large_objects: StreamLargeObjects = proto.Field( - proto.MESSAGE, - number=102, - oneof='large_objects_handling', - message=StreamLargeObjects, - ) - - -class PostgresqlColumn(proto.Message): - r"""PostgreSQL Column. - - Attributes: - column (str): - Column name. - data_type (str): - The PostgreSQL data type. - length (int): - Column length. - precision (int): - Column precision. - scale (int): - Column scale. - primary_key (bool): - Whether or not the column represents a - primary key. - nullable (bool): - Whether or not the column can accept a null - value. - ordinal_position (int): - The ordinal position of the column in the - table. - """ - - column: str = proto.Field( - proto.STRING, - number=1, - ) - data_type: str = proto.Field( - proto.STRING, - number=2, - ) - length: int = proto.Field( - proto.INT32, - number=3, - ) - precision: int = proto.Field( - proto.INT32, - number=4, - ) - scale: int = proto.Field( - proto.INT32, - number=5, - ) - primary_key: bool = proto.Field( - proto.BOOL, - number=7, - ) - nullable: bool = proto.Field( - proto.BOOL, - number=8, - ) - ordinal_position: int = proto.Field( - proto.INT32, - number=9, - ) - - -class PostgresqlTable(proto.Message): - r"""PostgreSQL table. - - Attributes: - table (str): - Table name. - postgresql_columns (MutableSequence[google.cloud.datastream_v1.types.PostgresqlColumn]): - PostgreSQL columns in the schema. - When unspecified as part of include/exclude - objects, includes/excludes everything. - """ - - table: str = proto.Field( - proto.STRING, - number=1, - ) - postgresql_columns: MutableSequence['PostgresqlColumn'] = proto.RepeatedField( - proto.MESSAGE, - number=2, - message='PostgresqlColumn', - ) - - -class PostgresqlSchema(proto.Message): - r"""PostgreSQL schema. - - Attributes: - schema (str): - Schema name. - postgresql_tables (MutableSequence[google.cloud.datastream_v1.types.PostgresqlTable]): - Tables in the schema. - """ - - schema: str = proto.Field( - proto.STRING, - number=1, - ) - postgresql_tables: MutableSequence['PostgresqlTable'] = proto.RepeatedField( - proto.MESSAGE, - number=2, - message='PostgresqlTable', - ) - - -class PostgresqlRdbms(proto.Message): - r"""PostgreSQL database structure. - - Attributes: - postgresql_schemas (MutableSequence[google.cloud.datastream_v1.types.PostgresqlSchema]): - PostgreSQL schemas in the database server. - """ - - postgresql_schemas: MutableSequence['PostgresqlSchema'] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='PostgresqlSchema', - ) - - -class PostgresqlSourceConfig(proto.Message): - r"""PostgreSQL data source configuration - - Attributes: - include_objects (google.cloud.datastream_v1.types.PostgresqlRdbms): - PostgreSQL objects to include in the stream. - exclude_objects (google.cloud.datastream_v1.types.PostgresqlRdbms): - PostgreSQL objects to exclude from the - stream. - replication_slot (str): - Required. The name of the logical replication - slot that's configured with the pgoutput plugin. - publication (str): - Required. The name of the publication that includes the set - of all tables that are defined in the stream's - include_objects. - """ - - include_objects: 'PostgresqlRdbms' = proto.Field( - proto.MESSAGE, - number=1, - message='PostgresqlRdbms', - ) - exclude_objects: 'PostgresqlRdbms' = proto.Field( - proto.MESSAGE, - number=2, - message='PostgresqlRdbms', - ) - replication_slot: str = proto.Field( - proto.STRING, - number=3, - ) - publication: str = proto.Field( - proto.STRING, - number=4, - ) - - -class MysqlColumn(proto.Message): - r"""MySQL Column. - - Attributes: - column (str): - Column name. - data_type (str): - The MySQL data type. Full data types list can - be found here: - https://dev.mysql.com/doc/refman/8.0/en/data-types.html - length (int): - Column length. - collation (str): - Column collation. - primary_key (bool): - Whether or not the column represents a - primary key. - nullable (bool): - Whether or not the column can accept a null - value. - ordinal_position (int): - The ordinal position of the column in the - table. - """ - - column: str = proto.Field( - proto.STRING, - number=1, - ) - data_type: str = proto.Field( - proto.STRING, - number=2, - ) - length: int = proto.Field( - proto.INT32, - number=3, - ) - collation: str = proto.Field( - proto.STRING, - number=4, - ) - primary_key: bool = proto.Field( - proto.BOOL, - number=5, - ) - nullable: bool = proto.Field( - proto.BOOL, - number=6, - ) - ordinal_position: int = proto.Field( - proto.INT32, - number=7, - ) - - -class MysqlTable(proto.Message): - r"""MySQL table. - - Attributes: - table (str): - Table name. - mysql_columns (MutableSequence[google.cloud.datastream_v1.types.MysqlColumn]): - MySQL columns in the database. - When unspecified as part of include/exclude - objects, includes/excludes everything. - """ - - table: str = proto.Field( - proto.STRING, - number=1, - ) - mysql_columns: MutableSequence['MysqlColumn'] = proto.RepeatedField( - proto.MESSAGE, - number=2, - message='MysqlColumn', - ) - - -class MysqlDatabase(proto.Message): - r"""MySQL database. - - Attributes: - database (str): - Database name. - mysql_tables (MutableSequence[google.cloud.datastream_v1.types.MysqlTable]): - Tables in the database. - """ - - database: str = proto.Field( - proto.STRING, - number=1, - ) - mysql_tables: MutableSequence['MysqlTable'] = proto.RepeatedField( - proto.MESSAGE, - number=2, - message='MysqlTable', - ) - - -class MysqlRdbms(proto.Message): - r"""MySQL database structure - - Attributes: - mysql_databases (MutableSequence[google.cloud.datastream_v1.types.MysqlDatabase]): - Mysql databases on the server - """ - - mysql_databases: MutableSequence['MysqlDatabase'] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='MysqlDatabase', - ) - - -class MysqlSourceConfig(proto.Message): - r"""MySQL source configuration - - Attributes: - include_objects (google.cloud.datastream_v1.types.MysqlRdbms): - MySQL objects to retrieve from the source. - exclude_objects (google.cloud.datastream_v1.types.MysqlRdbms): - MySQL objects to exclude from the stream. - max_concurrent_cdc_tasks (int): - Maximum number of concurrent CDC tasks. The - number should be non negative. If not set (or - set to 0), the system's default value will be - used. - """ - - include_objects: 'MysqlRdbms' = proto.Field( - proto.MESSAGE, - number=1, - message='MysqlRdbms', - ) - exclude_objects: 'MysqlRdbms' = proto.Field( - proto.MESSAGE, - number=2, - message='MysqlRdbms', - ) - max_concurrent_cdc_tasks: int = proto.Field( - proto.INT32, - number=3, - ) - - -class SourceConfig(proto.Message): - r"""The configuration of the stream source. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - source_connection_profile (str): - Required. Source connection profile resoource. Format: - ``projects/{project}/locations/{location}/connectionProfiles/{name}`` - oracle_source_config (google.cloud.datastream_v1.types.OracleSourceConfig): - Oracle data source configuration. - - This field is a member of `oneof`_ ``source_stream_config``. - mysql_source_config (google.cloud.datastream_v1.types.MysqlSourceConfig): - MySQL data source configuration. - - This field is a member of `oneof`_ ``source_stream_config``. - postgresql_source_config (google.cloud.datastream_v1.types.PostgresqlSourceConfig): - PostgreSQL data source configuration. - - This field is a member of `oneof`_ ``source_stream_config``. - """ - - source_connection_profile: str = proto.Field( - proto.STRING, - number=1, - ) - oracle_source_config: 'OracleSourceConfig' = proto.Field( - proto.MESSAGE, - number=100, - oneof='source_stream_config', - message='OracleSourceConfig', - ) - mysql_source_config: 'MysqlSourceConfig' = proto.Field( - proto.MESSAGE, - number=101, - oneof='source_stream_config', - message='MysqlSourceConfig', - ) - postgresql_source_config: 'PostgresqlSourceConfig' = proto.Field( - proto.MESSAGE, - number=102, - oneof='source_stream_config', - message='PostgresqlSourceConfig', - ) - - -class AvroFileFormat(proto.Message): - r"""AVRO file format configuration. - """ - - -class JsonFileFormat(proto.Message): - r"""JSON file format configuration. - - Attributes: - schema_file_format (google.cloud.datastream_v1.types.JsonFileFormat.SchemaFileFormat): - The schema file format along JSON data files. - compression (google.cloud.datastream_v1.types.JsonFileFormat.JsonCompression): - Compression of the loaded JSON file. - """ - class SchemaFileFormat(proto.Enum): - r"""Schema file format. - - Values: - SCHEMA_FILE_FORMAT_UNSPECIFIED (0): - Unspecified schema file format. - NO_SCHEMA_FILE (1): - Do not attach schema file. - AVRO_SCHEMA_FILE (2): - Avro schema format. - """ - SCHEMA_FILE_FORMAT_UNSPECIFIED = 0 - NO_SCHEMA_FILE = 1 - AVRO_SCHEMA_FILE = 2 - - class JsonCompression(proto.Enum): - r"""Json file compression. - - Values: - JSON_COMPRESSION_UNSPECIFIED (0): - Unspecified json file compression. - NO_COMPRESSION (1): - Do not compress JSON file. - GZIP (2): - Gzip compression. - """ - JSON_COMPRESSION_UNSPECIFIED = 0 - NO_COMPRESSION = 1 - GZIP = 2 - - schema_file_format: SchemaFileFormat = proto.Field( - proto.ENUM, - number=1, - enum=SchemaFileFormat, - ) - compression: JsonCompression = proto.Field( - proto.ENUM, - number=2, - enum=JsonCompression, - ) - - -class GcsDestinationConfig(proto.Message): - r"""Google Cloud Storage destination configuration - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - path (str): - Path inside the Cloud Storage bucket to write - data to. - file_rotation_mb (int): - The maximum file size to be saved in the - bucket. - file_rotation_interval (google.protobuf.duration_pb2.Duration): - The maximum duration for which new events are - added before a file is closed and a new file is - created. - avro_file_format (google.cloud.datastream_v1.types.AvroFileFormat): - AVRO file format configuration. - - This field is a member of `oneof`_ ``file_format``. - json_file_format (google.cloud.datastream_v1.types.JsonFileFormat): - JSON file format configuration. - - This field is a member of `oneof`_ ``file_format``. - """ - - path: str = proto.Field( - proto.STRING, - number=1, - ) - file_rotation_mb: int = proto.Field( - proto.INT32, - number=2, - ) - file_rotation_interval: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=3, - message=duration_pb2.Duration, - ) - avro_file_format: 'AvroFileFormat' = proto.Field( - proto.MESSAGE, - number=100, - oneof='file_format', - message='AvroFileFormat', - ) - json_file_format: 'JsonFileFormat' = proto.Field( - proto.MESSAGE, - number=101, - oneof='file_format', - message='JsonFileFormat', - ) - - -class BigQueryDestinationConfig(proto.Message): - r""" - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - single_target_dataset (google.cloud.datastream_v1.types.BigQueryDestinationConfig.SingleTargetDataset): - Single destination dataset. - - This field is a member of `oneof`_ ``dataset_config``. - source_hierarchy_datasets (google.cloud.datastream_v1.types.BigQueryDestinationConfig.SourceHierarchyDatasets): - Source hierarchy datasets. - - This field is a member of `oneof`_ ``dataset_config``. - data_freshness (google.protobuf.duration_pb2.Duration): - The guaranteed data freshness (in seconds) - when querying tables created by the stream. - Editing this field will only affect new tables - created in the future, but existing tables will - not be impacted. Lower values mean that queries - will return fresher data, but may result in - higher cost. - """ - - class SingleTargetDataset(proto.Message): - r"""A single target dataset to which all data will be streamed. - - Attributes: - dataset_id (str): - - """ - - dataset_id: str = proto.Field( - proto.STRING, - number=1, - ) - - class SourceHierarchyDatasets(proto.Message): - r"""Destination datasets are created so that hierarchy of the - destination data objects matches the source hierarchy. - - Attributes: - dataset_template (google.cloud.datastream_v1.types.BigQueryDestinationConfig.SourceHierarchyDatasets.DatasetTemplate): - - """ - - class DatasetTemplate(proto.Message): - r"""Dataset template used for dynamic dataset creation. - - Attributes: - location (str): - Required. The geographic location where the - dataset should reside. See - https://cloud.google.com/bigquery/docs/locations - for supported locations. - dataset_id_prefix (str): - If supplied, every created dataset will have its name - prefixed by the provided value. The prefix and name will be - separated by an underscore. i.e. \_. - kms_key_name (str): - Describes the Cloud KMS encryption key that will be used to - protect destination BigQuery table. The BigQuery Service - Account associated with your project requires access to this - encryption key. i.e. - projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{cryptoKey}. - See - https://cloud.google.com/bigquery/docs/customer-managed-encryption - for more information. - """ - - location: str = proto.Field( - proto.STRING, - number=1, - ) - dataset_id_prefix: str = proto.Field( - proto.STRING, - number=2, - ) - kms_key_name: str = proto.Field( - proto.STRING, - number=3, - ) - - dataset_template: 'BigQueryDestinationConfig.SourceHierarchyDatasets.DatasetTemplate' = proto.Field( - proto.MESSAGE, - number=2, - message='BigQueryDestinationConfig.SourceHierarchyDatasets.DatasetTemplate', - ) - - single_target_dataset: SingleTargetDataset = proto.Field( - proto.MESSAGE, - number=201, - oneof='dataset_config', - message=SingleTargetDataset, - ) - source_hierarchy_datasets: SourceHierarchyDatasets = proto.Field( - proto.MESSAGE, - number=202, - oneof='dataset_config', - message=SourceHierarchyDatasets, - ) - data_freshness: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=300, - message=duration_pb2.Duration, - ) - - -class DestinationConfig(proto.Message): - r"""The configuration of the stream destination. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - destination_connection_profile (str): - Required. Destination connection profile resource. Format: - ``projects/{project}/locations/{location}/connectionProfiles/{name}`` - gcs_destination_config (google.cloud.datastream_v1.types.GcsDestinationConfig): - A configuration for how data should be loaded - to Cloud Storage. - - This field is a member of `oneof`_ ``destination_stream_config``. - bigquery_destination_config (google.cloud.datastream_v1.types.BigQueryDestinationConfig): - BigQuery destination configuration. - - This field is a member of `oneof`_ ``destination_stream_config``. - """ - - destination_connection_profile: str = proto.Field( - proto.STRING, - number=1, - ) - gcs_destination_config: 'GcsDestinationConfig' = proto.Field( - proto.MESSAGE, - number=100, - oneof='destination_stream_config', - message='GcsDestinationConfig', - ) - bigquery_destination_config: 'BigQueryDestinationConfig' = proto.Field( - proto.MESSAGE, - number=101, - oneof='destination_stream_config', - message='BigQueryDestinationConfig', - ) - - -class Stream(proto.Message): - r"""A resource representing streaming data from a source to a - destination. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - name (str): - Output only. The stream's name. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The creation time of the stream. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The last update time of the - stream. - labels (MutableMapping[str, str]): - Labels. - display_name (str): - Required. Display name. - source_config (google.cloud.datastream_v1.types.SourceConfig): - Required. Source connection profile - configuration. - destination_config (google.cloud.datastream_v1.types.DestinationConfig): - Required. Destination connection profile - configuration. - state (google.cloud.datastream_v1.types.Stream.State): - The state of the stream. - backfill_all (google.cloud.datastream_v1.types.Stream.BackfillAllStrategy): - Automatically backfill objects included in - the stream source configuration. Specific - objects can be excluded. - - This field is a member of `oneof`_ ``backfill_strategy``. - backfill_none (google.cloud.datastream_v1.types.Stream.BackfillNoneStrategy): - Do not automatically backfill any objects. - - This field is a member of `oneof`_ ``backfill_strategy``. - errors (MutableSequence[google.cloud.datastream_v1.types.Error]): - Output only. Errors on the Stream. - customer_managed_encryption_key (str): - Immutable. A reference to a KMS encryption - key. If provided, it will be used to encrypt the - data. If left blank, data will be encrypted - using an internal Stream-specific encryption key - provisioned through KMS. - - This field is a member of `oneof`_ ``_customer_managed_encryption_key``. - """ - class State(proto.Enum): - r"""Stream state. - - Values: - STATE_UNSPECIFIED (0): - Unspecified stream state. - NOT_STARTED (1): - The stream has been created but has not yet - started streaming data. - RUNNING (2): - The stream is running. - PAUSED (3): - The stream is paused. - MAINTENANCE (4): - The stream is in maintenance mode. - Updates are rejected on the resource in this - state. - FAILED (5): - The stream is experiencing an error that is - preventing data from being streamed. - FAILED_PERMANENTLY (6): - The stream has experienced a terminal - failure. - STARTING (7): - The stream is starting, but not yet running. - DRAINING (8): - The Stream is no longer reading new events, - but still writing events in the buffer. - """ - STATE_UNSPECIFIED = 0 - NOT_STARTED = 1 - RUNNING = 2 - PAUSED = 3 - MAINTENANCE = 4 - FAILED = 5 - FAILED_PERMANENTLY = 6 - STARTING = 7 - DRAINING = 8 - - class BackfillAllStrategy(proto.Message): - r"""Backfill strategy to automatically backfill the Stream's - objects. Specific objects can be excluded. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - oracle_excluded_objects (google.cloud.datastream_v1.types.OracleRdbms): - Oracle data source objects to avoid - backfilling. - - This field is a member of `oneof`_ ``excluded_objects``. - mysql_excluded_objects (google.cloud.datastream_v1.types.MysqlRdbms): - MySQL data source objects to avoid - backfilling. - - This field is a member of `oneof`_ ``excluded_objects``. - postgresql_excluded_objects (google.cloud.datastream_v1.types.PostgresqlRdbms): - PostgreSQL data source objects to avoid - backfilling. - - This field is a member of `oneof`_ ``excluded_objects``. - """ - - oracle_excluded_objects: 'OracleRdbms' = proto.Field( - proto.MESSAGE, - number=1, - oneof='excluded_objects', - message='OracleRdbms', - ) - mysql_excluded_objects: 'MysqlRdbms' = proto.Field( - proto.MESSAGE, - number=2, - oneof='excluded_objects', - message='MysqlRdbms', - ) - postgresql_excluded_objects: 'PostgresqlRdbms' = proto.Field( - proto.MESSAGE, - number=3, - oneof='excluded_objects', - message='PostgresqlRdbms', - ) - - class BackfillNoneStrategy(proto.Message): - r"""Backfill strategy to disable automatic backfill for the - Stream's objects. - - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - create_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=2, - message=timestamp_pb2.Timestamp, - ) - update_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=3, - message=timestamp_pb2.Timestamp, - ) - labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=4, - ) - display_name: str = proto.Field( - proto.STRING, - number=5, - ) - source_config: 'SourceConfig' = proto.Field( - proto.MESSAGE, - number=6, - message='SourceConfig', - ) - destination_config: 'DestinationConfig' = proto.Field( - proto.MESSAGE, - number=7, - message='DestinationConfig', - ) - state: State = proto.Field( - proto.ENUM, - number=8, - enum=State, - ) - backfill_all: BackfillAllStrategy = proto.Field( - proto.MESSAGE, - number=101, - oneof='backfill_strategy', - message=BackfillAllStrategy, - ) - backfill_none: BackfillNoneStrategy = proto.Field( - proto.MESSAGE, - number=102, - oneof='backfill_strategy', - message=BackfillNoneStrategy, - ) - errors: MutableSequence['Error'] = proto.RepeatedField( - proto.MESSAGE, - number=9, - message='Error', - ) - customer_managed_encryption_key: str = proto.Field( - proto.STRING, - number=10, - optional=True, - ) - - -class StreamObject(proto.Message): - r"""A specific stream object (e.g a specific DB table). - - Attributes: - name (str): - Output only. The object resource's name. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The creation time of the object. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The last update time of the - object. - display_name (str): - Required. Display name. - errors (MutableSequence[google.cloud.datastream_v1.types.Error]): - Output only. Active errors on the object. - backfill_job (google.cloud.datastream_v1.types.BackfillJob): - The latest backfill job that was initiated - for the stream object. - source_object (google.cloud.datastream_v1.types.SourceObjectIdentifier): - The object identifier in the data source. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - create_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=2, - message=timestamp_pb2.Timestamp, - ) - update_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=3, - message=timestamp_pb2.Timestamp, - ) - display_name: str = proto.Field( - proto.STRING, - number=5, - ) - errors: MutableSequence['Error'] = proto.RepeatedField( - proto.MESSAGE, - number=6, - message='Error', - ) - backfill_job: 'BackfillJob' = proto.Field( - proto.MESSAGE, - number=7, - message='BackfillJob', - ) - source_object: 'SourceObjectIdentifier' = proto.Field( - proto.MESSAGE, - number=8, - message='SourceObjectIdentifier', - ) - - -class SourceObjectIdentifier(proto.Message): - r"""Represents an identifier of an object in the data source. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - oracle_identifier (google.cloud.datastream_v1.types.SourceObjectIdentifier.OracleObjectIdentifier): - Oracle data source object identifier. - - This field is a member of `oneof`_ ``source_identifier``. - mysql_identifier (google.cloud.datastream_v1.types.SourceObjectIdentifier.MysqlObjectIdentifier): - Mysql data source object identifier. - - This field is a member of `oneof`_ ``source_identifier``. - postgresql_identifier (google.cloud.datastream_v1.types.SourceObjectIdentifier.PostgresqlObjectIdentifier): - PostgreSQL data source object identifier. - - This field is a member of `oneof`_ ``source_identifier``. - """ - - class OracleObjectIdentifier(proto.Message): - r"""Oracle data source object identifier. - - Attributes: - schema (str): - Required. The schema name. - table (str): - Required. The table name. - """ - - schema: str = proto.Field( - proto.STRING, - number=1, - ) - table: str = proto.Field( - proto.STRING, - number=2, - ) - - class PostgresqlObjectIdentifier(proto.Message): - r"""PostgreSQL data source object identifier. - - Attributes: - schema (str): - Required. The schema name. - table (str): - Required. The table name. - """ - - schema: str = proto.Field( - proto.STRING, - number=1, - ) - table: str = proto.Field( - proto.STRING, - number=2, - ) - - class MysqlObjectIdentifier(proto.Message): - r"""Mysql data source object identifier. - - Attributes: - database (str): - Required. The database name. - table (str): - Required. The table name. - """ - - database: str = proto.Field( - proto.STRING, - number=1, - ) - table: str = proto.Field( - proto.STRING, - number=2, - ) - - oracle_identifier: OracleObjectIdentifier = proto.Field( - proto.MESSAGE, - number=1, - oneof='source_identifier', - message=OracleObjectIdentifier, - ) - mysql_identifier: MysqlObjectIdentifier = proto.Field( - proto.MESSAGE, - number=2, - oneof='source_identifier', - message=MysqlObjectIdentifier, - ) - postgresql_identifier: PostgresqlObjectIdentifier = proto.Field( - proto.MESSAGE, - number=3, - oneof='source_identifier', - message=PostgresqlObjectIdentifier, - ) - - -class BackfillJob(proto.Message): - r"""Represents a backfill job on a specific stream object. - - Attributes: - state (google.cloud.datastream_v1.types.BackfillJob.State): - Backfill job state. - trigger (google.cloud.datastream_v1.types.BackfillJob.Trigger): - Backfill job's triggering reason. - last_start_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Backfill job's start time. - last_end_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Backfill job's end time. - errors (MutableSequence[google.cloud.datastream_v1.types.Error]): - Output only. Errors which caused the backfill - job to fail. - """ - class State(proto.Enum): - r"""State of the stream object's backfill job. - - Values: - STATE_UNSPECIFIED (0): - Default value. - NOT_STARTED (1): - Backfill job was never started for the stream - object (stream has backfill strategy defined as - manual or object was explicitly excluded from - automatic backfill). - PENDING (2): - Backfill job will start pending available - resources. - ACTIVE (3): - Backfill job is running. - STOPPED (4): - Backfill job stopped (next job run will start - from beginning). - FAILED (5): - Backfill job failed (due to an error). - COMPLETED (6): - Backfill completed successfully. - UNSUPPORTED (7): - Backfill job failed since the table structure - is currently unsupported for backfill. - """ - STATE_UNSPECIFIED = 0 - NOT_STARTED = 1 - PENDING = 2 - ACTIVE = 3 - STOPPED = 4 - FAILED = 5 - COMPLETED = 6 - UNSUPPORTED = 7 - - class Trigger(proto.Enum): - r"""Triggering reason for a backfill job. - - Values: - TRIGGER_UNSPECIFIED (0): - Default value. - AUTOMATIC (1): - Object backfill job was triggered - automatically according to the stream's backfill - strategy. - MANUAL (2): - Object backfill job was triggered manually - using the dedicated API. - """ - TRIGGER_UNSPECIFIED = 0 - AUTOMATIC = 1 - MANUAL = 2 - - state: State = proto.Field( - proto.ENUM, - number=1, - enum=State, - ) - trigger: Trigger = proto.Field( - proto.ENUM, - number=2, - enum=Trigger, - ) - last_start_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=3, - message=timestamp_pb2.Timestamp, - ) - last_end_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=4, - message=timestamp_pb2.Timestamp, - ) - errors: MutableSequence['Error'] = proto.RepeatedField( - proto.MESSAGE, - number=5, - message='Error', - ) - - -class Error(proto.Message): - r"""Represent a user-facing Error. - - Attributes: - reason (str): - A title that explains the reason for the - error. - error_uuid (str): - A unique identifier for this specific error, - allowing it to be traced throughout the system - in logs and API responses. - message (str): - A message containing more information about - the error that occurred. - error_time (google.protobuf.timestamp_pb2.Timestamp): - The time when the error occurred. - details (MutableMapping[str, str]): - Additional information about the error. - """ - - reason: str = proto.Field( - proto.STRING, - number=1, - ) - error_uuid: str = proto.Field( - proto.STRING, - number=2, - ) - message: str = proto.Field( - proto.STRING, - number=3, - ) - error_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=4, - message=timestamp_pb2.Timestamp, - ) - details: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=5, - ) - - -class ValidationResult(proto.Message): - r"""Contains the current validation results. - - Attributes: - validations (MutableSequence[google.cloud.datastream_v1.types.Validation]): - A list of validations (includes both executed - as well as not executed validations). - """ - - validations: MutableSequence['Validation'] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='Validation', - ) - - -class Validation(proto.Message): - r"""A validation to perform on a stream. - - Attributes: - description (str): - A short description of the validation. - state (google.cloud.datastream_v1.types.Validation.State): - Validation execution status. - message (MutableSequence[google.cloud.datastream_v1.types.ValidationMessage]): - Messages reflecting the validation results. - code (str): - A custom code identifying this validation. - """ - class State(proto.Enum): - r"""Validation execution state. - - Values: - STATE_UNSPECIFIED (0): - Unspecified state. - NOT_EXECUTED (1): - Validation did not execute. - FAILED (2): - Validation failed. - PASSED (3): - Validation passed. - """ - STATE_UNSPECIFIED = 0 - NOT_EXECUTED = 1 - FAILED = 2 - PASSED = 3 - - description: str = proto.Field( - proto.STRING, - number=1, - ) - state: State = proto.Field( - proto.ENUM, - number=2, - enum=State, - ) - message: MutableSequence['ValidationMessage'] = proto.RepeatedField( - proto.MESSAGE, - number=3, - message='ValidationMessage', - ) - code: str = proto.Field( - proto.STRING, - number=4, - ) - - -class ValidationMessage(proto.Message): - r"""Represent user-facing validation result message. - - Attributes: - message (str): - The result of the validation. - level (google.cloud.datastream_v1.types.ValidationMessage.Level): - Message severity level (warning or error). - metadata (MutableMapping[str, str]): - Additional metadata related to the result. - code (str): - A custom code identifying this specific - message. - """ - class Level(proto.Enum): - r"""Validation message level. - - Values: - LEVEL_UNSPECIFIED (0): - Unspecified level. - WARNING (1): - Potentially cause issues with the Stream. - ERROR (2): - Definitely cause issues with the Stream. - """ - LEVEL_UNSPECIFIED = 0 - WARNING = 1 - ERROR = 2 - - message: str = proto.Field( - proto.STRING, - number=1, - ) - level: Level = proto.Field( - proto.ENUM, - number=2, - enum=Level, - ) - metadata: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=3, - ) - code: str = proto.Field( - proto.STRING, - number=4, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/mypy.ini b/owl-bot-staging/v1/mypy.ini deleted file mode 100644 index 574c5ae..0000000 --- a/owl-bot-staging/v1/mypy.ini +++ /dev/null @@ -1,3 +0,0 @@ -[mypy] -python_version = 3.7 -namespace_packages = True diff --git a/owl-bot-staging/v1/noxfile.py b/owl-bot-staging/v1/noxfile.py deleted file mode 100644 index aa2ee41..0000000 --- a/owl-bot-staging/v1/noxfile.py +++ /dev/null @@ -1,184 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os -import pathlib -import shutil -import subprocess -import sys - - -import nox # type: ignore - -ALL_PYTHON = [ - "3.7", - "3.8", - "3.9", - "3.10", - "3.11", -] - -CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() - -LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" -PACKAGE_NAME = subprocess.check_output([sys.executable, "setup.py", "--name"], encoding="utf-8") - -BLACK_VERSION = "black==22.3.0" -BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"] -DEFAULT_PYTHON_VERSION = "3.11" - -nox.sessions = [ - "unit", - "cover", - "mypy", - "check_lower_bounds" - # exclude update_lower_bounds from default - "docs", - "blacken", - "lint", - "lint_setup_py", -] - -@nox.session(python=ALL_PYTHON) -def unit(session): - """Run the unit test suite.""" - - session.install('coverage', 'pytest', 'pytest-cov', 'pytest-asyncio', 'asyncmock; python_version < "3.8"') - session.install('-e', '.') - - session.run( - 'py.test', - '--quiet', - '--cov=google/cloud/datastream_v1/', - '--cov=tests/', - '--cov-config=.coveragerc', - '--cov-report=term', - '--cov-report=html', - os.path.join('tests', 'unit', ''.join(session.posargs)) - ) - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def cover(session): - """Run the final coverage report. - This outputs the coverage report aggregating coverage from the unit - test runs (not system test runs), and then erases coverage data. - """ - session.install("coverage", "pytest-cov") - session.run("coverage", "report", "--show-missing", "--fail-under=100") - - session.run("coverage", "erase") - - -@nox.session(python=ALL_PYTHON) -def mypy(session): - """Run the type checker.""" - session.install( - 'mypy', - 'types-requests', - 'types-protobuf' - ) - session.install('.') - session.run( - 'mypy', - '--explicit-package-bases', - 'google', - ) - - -@nox.session -def update_lower_bounds(session): - """Update lower bounds in constraints.txt to match setup.py""" - session.install('google-cloud-testutils') - session.install('.') - - session.run( - 'lower-bound-checker', - 'update', - '--package-name', - PACKAGE_NAME, - '--constraints-file', - str(LOWER_BOUND_CONSTRAINTS_FILE), - ) - - -@nox.session -def check_lower_bounds(session): - """Check lower bounds in setup.py are reflected in constraints file""" - session.install('google-cloud-testutils') - session.install('.') - - session.run( - 'lower-bound-checker', - 'check', - '--package-name', - PACKAGE_NAME, - '--constraints-file', - str(LOWER_BOUND_CONSTRAINTS_FILE), - ) - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def docs(session): - """Build the docs for this library.""" - - session.install("-e", ".") - session.install("sphinx==4.0.1", "alabaster", "recommonmark") - - shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) - session.run( - "sphinx-build", - "-W", # warnings as errors - "-T", # show full traceback on exception - "-N", # no colors - "-b", - "html", - "-d", - os.path.join("docs", "_build", "doctrees", ""), - os.path.join("docs", ""), - os.path.join("docs", "_build", "html", ""), - ) - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def lint(session): - """Run linters. - - Returns a failure if the linters find linting errors or sufficiently - serious code quality issues. - """ - session.install("flake8", BLACK_VERSION) - session.run( - "black", - "--check", - *BLACK_PATHS, - ) - session.run("flake8", "google", "tests", "samples") - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def blacken(session): - """Run black. Format code to uniform standard.""" - session.install(BLACK_VERSION) - session.run( - "black", - *BLACK_PATHS, - ) - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def lint_setup_py(session): - """Verify that setup.py is valid (including RST check).""" - session.install("docutils", "pygments") - session.run("python", "setup.py", "check", "--restructuredtext", "--strict") diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_connection_profile_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_connection_profile_async.py deleted file mode 100644 index 4b29f91..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_connection_profile_async.py +++ /dev/null @@ -1,65 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateConnectionProfile -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_CreateConnectionProfile_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_create_connection_profile(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - connection_profile = datastream_v1.ConnectionProfile() - connection_profile.oracle_profile.hostname = "hostname_value" - connection_profile.oracle_profile.username = "username_value" - connection_profile.oracle_profile.password = "password_value" - connection_profile.oracle_profile.database_service = "database_service_value" - connection_profile.display_name = "display_name_value" - - request = datastream_v1.CreateConnectionProfileRequest( - parent="parent_value", - connection_profile_id="connection_profile_id_value", - connection_profile=connection_profile, - ) - - # Make the request - operation = client.create_connection_profile(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_CreateConnectionProfile_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_connection_profile_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_connection_profile_sync.py deleted file mode 100644 index a2e67c1..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_connection_profile_sync.py +++ /dev/null @@ -1,65 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateConnectionProfile -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_CreateConnectionProfile_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_create_connection_profile(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - connection_profile = datastream_v1.ConnectionProfile() - connection_profile.oracle_profile.hostname = "hostname_value" - connection_profile.oracle_profile.username = "username_value" - connection_profile.oracle_profile.password = "password_value" - connection_profile.oracle_profile.database_service = "database_service_value" - connection_profile.display_name = "display_name_value" - - request = datastream_v1.CreateConnectionProfileRequest( - parent="parent_value", - connection_profile_id="connection_profile_id_value", - connection_profile=connection_profile, - ) - - # Make the request - operation = client.create_connection_profile(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_CreateConnectionProfile_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_private_connection_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_private_connection_async.py deleted file mode 100644 index c47b666..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_private_connection_async.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreatePrivateConnection -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_CreatePrivateConnection_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_create_private_connection(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - private_connection = datastream_v1.PrivateConnection() - private_connection.display_name = "display_name_value" - - request = datastream_v1.CreatePrivateConnectionRequest( - parent="parent_value", - private_connection_id="private_connection_id_value", - private_connection=private_connection, - ) - - # Make the request - operation = client.create_private_connection(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_CreatePrivateConnection_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_private_connection_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_private_connection_sync.py deleted file mode 100644 index d0430be..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_private_connection_sync.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreatePrivateConnection -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_CreatePrivateConnection_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_create_private_connection(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - private_connection = datastream_v1.PrivateConnection() - private_connection.display_name = "display_name_value" - - request = datastream_v1.CreatePrivateConnectionRequest( - parent="parent_value", - private_connection_id="private_connection_id_value", - private_connection=private_connection, - ) - - # Make the request - operation = client.create_private_connection(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_CreatePrivateConnection_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_route_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_route_async.py deleted file mode 100644 index d22e7bc..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_route_async.py +++ /dev/null @@ -1,62 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateRoute -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_CreateRoute_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_create_route(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - route = datastream_v1.Route() - route.display_name = "display_name_value" - route.destination_address = "destination_address_value" - - request = datastream_v1.CreateRouteRequest( - parent="parent_value", - route_id="route_id_value", - route=route, - ) - - # Make the request - operation = client.create_route(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_CreateRoute_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_route_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_route_sync.py deleted file mode 100644 index b9c7fb0..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_route_sync.py +++ /dev/null @@ -1,62 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateRoute -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_CreateRoute_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_create_route(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - route = datastream_v1.Route() - route.display_name = "display_name_value" - route.destination_address = "destination_address_value" - - request = datastream_v1.CreateRouteRequest( - parent="parent_value", - route_id="route_id_value", - route=route, - ) - - # Make the request - operation = client.create_route(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_CreateRoute_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_stream_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_stream_async.py deleted file mode 100644 index c2ed711..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_stream_async.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateStream -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_CreateStream_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_create_stream(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - stream = datastream_v1.Stream() - stream.display_name = "display_name_value" - stream.source_config.source_connection_profile = "source_connection_profile_value" - stream.destination_config.destination_connection_profile = "destination_connection_profile_value" - - request = datastream_v1.CreateStreamRequest( - parent="parent_value", - stream_id="stream_id_value", - stream=stream, - ) - - # Make the request - operation = client.create_stream(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_CreateStream_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_stream_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_stream_sync.py deleted file mode 100644 index 164fc95..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_create_stream_sync.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateStream -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_CreateStream_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_create_stream(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - stream = datastream_v1.Stream() - stream.display_name = "display_name_value" - stream.source_config.source_connection_profile = "source_connection_profile_value" - stream.destination_config.destination_connection_profile = "destination_connection_profile_value" - - request = datastream_v1.CreateStreamRequest( - parent="parent_value", - stream_id="stream_id_value", - stream=stream, - ) - - # Make the request - operation = client.create_stream(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_CreateStream_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_connection_profile_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_connection_profile_async.py deleted file mode 100644 index 992b716..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_connection_profile_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteConnectionProfile -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_DeleteConnectionProfile_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_delete_connection_profile(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.DeleteConnectionProfileRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_connection_profile(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_DeleteConnectionProfile_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_connection_profile_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_connection_profile_sync.py deleted file mode 100644 index 3d21a9d..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_connection_profile_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteConnectionProfile -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_DeleteConnectionProfile_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_delete_connection_profile(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.DeleteConnectionProfileRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_connection_profile(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_DeleteConnectionProfile_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_private_connection_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_private_connection_async.py deleted file mode 100644 index 6554e34..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_private_connection_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeletePrivateConnection -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_DeletePrivateConnection_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_delete_private_connection(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.DeletePrivateConnectionRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_private_connection(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_DeletePrivateConnection_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_private_connection_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_private_connection_sync.py deleted file mode 100644 index 07d642e..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_private_connection_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeletePrivateConnection -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_DeletePrivateConnection_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_delete_private_connection(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.DeletePrivateConnectionRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_private_connection(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_DeletePrivateConnection_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_route_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_route_async.py deleted file mode 100644 index 89d56f5..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_route_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteRoute -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_DeleteRoute_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_delete_route(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.DeleteRouteRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_route(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_DeleteRoute_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_route_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_route_sync.py deleted file mode 100644 index 2dbf0c0..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_route_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteRoute -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_DeleteRoute_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_delete_route(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.DeleteRouteRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_route(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_DeleteRoute_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_stream_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_stream_async.py deleted file mode 100644 index 64963af..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_stream_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteStream -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_DeleteStream_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_delete_stream(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.DeleteStreamRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_stream(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_DeleteStream_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_stream_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_stream_sync.py deleted file mode 100644 index a3eff1a..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_delete_stream_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteStream -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_DeleteStream_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_delete_stream(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.DeleteStreamRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_stream(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_DeleteStream_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_discover_connection_profile_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_discover_connection_profile_async.py deleted file mode 100644 index 728488e..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_discover_connection_profile_async.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DiscoverConnectionProfile -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_DiscoverConnectionProfile_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_discover_connection_profile(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - connection_profile = datastream_v1.ConnectionProfile() - connection_profile.oracle_profile.hostname = "hostname_value" - connection_profile.oracle_profile.username = "username_value" - connection_profile.oracle_profile.password = "password_value" - connection_profile.oracle_profile.database_service = "database_service_value" - connection_profile.display_name = "display_name_value" - - request = datastream_v1.DiscoverConnectionProfileRequest( - connection_profile=connection_profile, - full_hierarchy=True, - parent="parent_value", - ) - - # Make the request - response = await client.discover_connection_profile(request=request) - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_DiscoverConnectionProfile_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_discover_connection_profile_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_discover_connection_profile_sync.py deleted file mode 100644 index b400c0d..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_discover_connection_profile_sync.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DiscoverConnectionProfile -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_DiscoverConnectionProfile_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_discover_connection_profile(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - connection_profile = datastream_v1.ConnectionProfile() - connection_profile.oracle_profile.hostname = "hostname_value" - connection_profile.oracle_profile.username = "username_value" - connection_profile.oracle_profile.password = "password_value" - connection_profile.oracle_profile.database_service = "database_service_value" - connection_profile.display_name = "display_name_value" - - request = datastream_v1.DiscoverConnectionProfileRequest( - connection_profile=connection_profile, - full_hierarchy=True, - parent="parent_value", - ) - - # Make the request - response = client.discover_connection_profile(request=request) - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_DiscoverConnectionProfile_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_fetch_static_ips_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_fetch_static_ips_async.py deleted file mode 100644 index 04dc712..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_fetch_static_ips_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for FetchStaticIps -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_FetchStaticIps_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_fetch_static_ips(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.FetchStaticIpsRequest( - name="name_value", - ) - - # Make the request - page_result = client.fetch_static_ips(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END datastream_v1_generated_Datastream_FetchStaticIps_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_fetch_static_ips_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_fetch_static_ips_sync.py deleted file mode 100644 index d6c2be7..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_fetch_static_ips_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for FetchStaticIps -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_FetchStaticIps_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_fetch_static_ips(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.FetchStaticIpsRequest( - name="name_value", - ) - - # Make the request - page_result = client.fetch_static_ips(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END datastream_v1_generated_Datastream_FetchStaticIps_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_connection_profile_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_connection_profile_async.py deleted file mode 100644 index a22b482..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_connection_profile_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetConnectionProfile -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_GetConnectionProfile_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_get_connection_profile(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.GetConnectionProfileRequest( - name="name_value", - ) - - # Make the request - response = await client.get_connection_profile(request=request) - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_GetConnectionProfile_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_connection_profile_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_connection_profile_sync.py deleted file mode 100644 index 50c560a..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_connection_profile_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetConnectionProfile -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_GetConnectionProfile_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_get_connection_profile(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.GetConnectionProfileRequest( - name="name_value", - ) - - # Make the request - response = client.get_connection_profile(request=request) - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_GetConnectionProfile_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_private_connection_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_private_connection_async.py deleted file mode 100644 index a1549e5..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_private_connection_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetPrivateConnection -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_GetPrivateConnection_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_get_private_connection(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.GetPrivateConnectionRequest( - name="name_value", - ) - - # Make the request - response = await client.get_private_connection(request=request) - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_GetPrivateConnection_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_private_connection_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_private_connection_sync.py deleted file mode 100644 index 1ed9057..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_private_connection_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetPrivateConnection -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_GetPrivateConnection_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_get_private_connection(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.GetPrivateConnectionRequest( - name="name_value", - ) - - # Make the request - response = client.get_private_connection(request=request) - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_GetPrivateConnection_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_route_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_route_async.py deleted file mode 100644 index d74caa6..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_route_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetRoute -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_GetRoute_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_get_route(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.GetRouteRequest( - name="name_value", - ) - - # Make the request - response = await client.get_route(request=request) - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_GetRoute_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_route_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_route_sync.py deleted file mode 100644 index d423021..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_route_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetRoute -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_GetRoute_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_get_route(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.GetRouteRequest( - name="name_value", - ) - - # Make the request - response = client.get_route(request=request) - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_GetRoute_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_async.py deleted file mode 100644 index 2af0060..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetStream -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_GetStream_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_get_stream(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.GetStreamRequest( - name="name_value", - ) - - # Make the request - response = await client.get_stream(request=request) - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_GetStream_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_object_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_object_async.py deleted file mode 100644 index 8011717..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_object_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetStreamObject -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_GetStreamObject_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_get_stream_object(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.GetStreamObjectRequest( - name="name_value", - ) - - # Make the request - response = await client.get_stream_object(request=request) - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_GetStreamObject_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_object_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_object_sync.py deleted file mode 100644 index 38b225a..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_object_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetStreamObject -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_GetStreamObject_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_get_stream_object(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.GetStreamObjectRequest( - name="name_value", - ) - - # Make the request - response = client.get_stream_object(request=request) - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_GetStreamObject_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_sync.py deleted file mode 100644 index 31fbe34..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_get_stream_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetStream -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_GetStream_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_get_stream(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.GetStreamRequest( - name="name_value", - ) - - # Make the request - response = client.get_stream(request=request) - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_GetStream_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_connection_profiles_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_connection_profiles_async.py deleted file mode 100644 index 408b216..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_connection_profiles_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListConnectionProfiles -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_ListConnectionProfiles_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_list_connection_profiles(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.ListConnectionProfilesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_connection_profiles(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END datastream_v1_generated_Datastream_ListConnectionProfiles_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_connection_profiles_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_connection_profiles_sync.py deleted file mode 100644 index d4723be..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_connection_profiles_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListConnectionProfiles -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_ListConnectionProfiles_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_list_connection_profiles(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.ListConnectionProfilesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_connection_profiles(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END datastream_v1_generated_Datastream_ListConnectionProfiles_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_private_connections_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_private_connections_async.py deleted file mode 100644 index 2816c2f..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_private_connections_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListPrivateConnections -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_ListPrivateConnections_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_list_private_connections(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.ListPrivateConnectionsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_private_connections(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END datastream_v1_generated_Datastream_ListPrivateConnections_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_private_connections_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_private_connections_sync.py deleted file mode 100644 index 0be38d8..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_private_connections_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListPrivateConnections -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_ListPrivateConnections_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_list_private_connections(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.ListPrivateConnectionsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_private_connections(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END datastream_v1_generated_Datastream_ListPrivateConnections_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_routes_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_routes_async.py deleted file mode 100644 index 3d11060..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_routes_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListRoutes -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_ListRoutes_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_list_routes(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.ListRoutesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_routes(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END datastream_v1_generated_Datastream_ListRoutes_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_routes_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_routes_sync.py deleted file mode 100644 index 2b58ca9..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_routes_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListRoutes -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_ListRoutes_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_list_routes(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.ListRoutesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_routes(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END datastream_v1_generated_Datastream_ListRoutes_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_stream_objects_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_stream_objects_async.py deleted file mode 100644 index fc9ad86..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_stream_objects_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListStreamObjects -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_ListStreamObjects_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_list_stream_objects(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.ListStreamObjectsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_stream_objects(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END datastream_v1_generated_Datastream_ListStreamObjects_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_stream_objects_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_stream_objects_sync.py deleted file mode 100644 index 9c58e25..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_stream_objects_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListStreamObjects -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_ListStreamObjects_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_list_stream_objects(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.ListStreamObjectsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_stream_objects(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END datastream_v1_generated_Datastream_ListStreamObjects_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_streams_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_streams_async.py deleted file mode 100644 index 5ddde36..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_streams_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListStreams -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_ListStreams_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_list_streams(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.ListStreamsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_streams(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END datastream_v1_generated_Datastream_ListStreams_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_streams_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_streams_sync.py deleted file mode 100644 index 4a94337..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_list_streams_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListStreams -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_ListStreams_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_list_streams(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.ListStreamsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_streams(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END datastream_v1_generated_Datastream_ListStreams_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_lookup_stream_object_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_lookup_stream_object_async.py deleted file mode 100644 index b4092a7..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_lookup_stream_object_async.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for LookupStreamObject -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_LookupStreamObject_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_lookup_stream_object(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - source_object_identifier = datastream_v1.SourceObjectIdentifier() - source_object_identifier.oracle_identifier.schema = "schema_value" - source_object_identifier.oracle_identifier.table = "table_value" - - request = datastream_v1.LookupStreamObjectRequest( - parent="parent_value", - source_object_identifier=source_object_identifier, - ) - - # Make the request - response = await client.lookup_stream_object(request=request) - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_LookupStreamObject_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_lookup_stream_object_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_lookup_stream_object_sync.py deleted file mode 100644 index 803c067..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_lookup_stream_object_sync.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for LookupStreamObject -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_LookupStreamObject_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_lookup_stream_object(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - source_object_identifier = datastream_v1.SourceObjectIdentifier() - source_object_identifier.oracle_identifier.schema = "schema_value" - source_object_identifier.oracle_identifier.table = "table_value" - - request = datastream_v1.LookupStreamObjectRequest( - parent="parent_value", - source_object_identifier=source_object_identifier, - ) - - # Make the request - response = client.lookup_stream_object(request=request) - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_LookupStreamObject_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_start_backfill_job_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_start_backfill_job_async.py deleted file mode 100644 index 32e6c38..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_start_backfill_job_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for StartBackfillJob -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_StartBackfillJob_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_start_backfill_job(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.StartBackfillJobRequest( - object_="object__value", - ) - - # Make the request - response = await client.start_backfill_job(request=request) - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_StartBackfillJob_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_start_backfill_job_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_start_backfill_job_sync.py deleted file mode 100644 index d86713f..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_start_backfill_job_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for StartBackfillJob -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_StartBackfillJob_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_start_backfill_job(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.StartBackfillJobRequest( - object_="object__value", - ) - - # Make the request - response = client.start_backfill_job(request=request) - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_StartBackfillJob_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_stop_backfill_job_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_stop_backfill_job_async.py deleted file mode 100644 index 3ddedf8..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_stop_backfill_job_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for StopBackfillJob -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_StopBackfillJob_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_stop_backfill_job(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1.StopBackfillJobRequest( - object_="object__value", - ) - - # Make the request - response = await client.stop_backfill_job(request=request) - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_StopBackfillJob_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_stop_backfill_job_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_stop_backfill_job_sync.py deleted file mode 100644 index aeefdbc..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_stop_backfill_job_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for StopBackfillJob -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_StopBackfillJob_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_stop_backfill_job(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1.StopBackfillJobRequest( - object_="object__value", - ) - - # Make the request - response = client.stop_backfill_job(request=request) - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_StopBackfillJob_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_connection_profile_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_connection_profile_async.py deleted file mode 100644 index 5d1d762..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_connection_profile_async.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateConnectionProfile -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_UpdateConnectionProfile_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_update_connection_profile(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - connection_profile = datastream_v1.ConnectionProfile() - connection_profile.oracle_profile.hostname = "hostname_value" - connection_profile.oracle_profile.username = "username_value" - connection_profile.oracle_profile.password = "password_value" - connection_profile.oracle_profile.database_service = "database_service_value" - connection_profile.display_name = "display_name_value" - - request = datastream_v1.UpdateConnectionProfileRequest( - connection_profile=connection_profile, - ) - - # Make the request - operation = client.update_connection_profile(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_UpdateConnectionProfile_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_connection_profile_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_connection_profile_sync.py deleted file mode 100644 index 81a9077..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_connection_profile_sync.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateConnectionProfile -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_UpdateConnectionProfile_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_update_connection_profile(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - connection_profile = datastream_v1.ConnectionProfile() - connection_profile.oracle_profile.hostname = "hostname_value" - connection_profile.oracle_profile.username = "username_value" - connection_profile.oracle_profile.password = "password_value" - connection_profile.oracle_profile.database_service = "database_service_value" - connection_profile.display_name = "display_name_value" - - request = datastream_v1.UpdateConnectionProfileRequest( - connection_profile=connection_profile, - ) - - # Make the request - operation = client.update_connection_profile(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_UpdateConnectionProfile_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_stream_async.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_stream_async.py deleted file mode 100644 index e217b95..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_stream_async.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateStream -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_UpdateStream_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -async def sample_update_stream(): - # Create a client - client = datastream_v1.DatastreamAsyncClient() - - # Initialize request argument(s) - stream = datastream_v1.Stream() - stream.display_name = "display_name_value" - stream.source_config.source_connection_profile = "source_connection_profile_value" - stream.destination_config.destination_connection_profile = "destination_connection_profile_value" - - request = datastream_v1.UpdateStreamRequest( - stream=stream, - ) - - # Make the request - operation = client.update_stream(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_UpdateStream_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_stream_sync.py b/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_stream_sync.py deleted file mode 100644 index ba85efc..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/datastream_v1_generated_datastream_update_stream_sync.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateStream -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1_generated_Datastream_UpdateStream_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1 - - -def sample_update_stream(): - # Create a client - client = datastream_v1.DatastreamClient() - - # Initialize request argument(s) - stream = datastream_v1.Stream() - stream.display_name = "display_name_value" - stream.source_config.source_connection_profile = "source_connection_profile_value" - stream.destination_config.destination_connection_profile = "destination_connection_profile_value" - - request = datastream_v1.UpdateStreamRequest( - stream=stream, - ) - - # Make the request - operation = client.update_stream(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END datastream_v1_generated_Datastream_UpdateStream_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/snippet_metadata_google.cloud.datastream.v1.json b/owl-bot-staging/v1/samples/generated_samples/snippet_metadata_google.cloud.datastream.v1.json deleted file mode 100644 index 8a69b90..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/snippet_metadata_google.cloud.datastream.v1.json +++ /dev/null @@ -1,4104 +0,0 @@ -{ - "clientLibrary": { - "apis": [ - { - "id": "google.cloud.datastream.v1", - "version": "v1" - } - ], - "language": "PYTHON", - "name": "google-cloud-datastream", - "version": "0.1.0" - }, - "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": [ - { - "end": 64, - "start": 27, - "type": "FULL" - }, - { - "end": 64, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 54, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 61, - "start": 55, - "type": "REQUEST_EXECUTION" - }, - { - "end": 65, - "start": 62, - "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": [ - { - "end": 64, - "start": 27, - "type": "FULL" - }, - { - "end": 64, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 54, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 61, - "start": 55, - "type": "REQUEST_EXECUTION" - }, - { - "end": 65, - "start": 62, - "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": [ - { - "end": 60, - "start": 27, - "type": "FULL" - }, - { - "end": 60, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 57, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 61, - "start": 58, - "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": [ - { - "end": 60, - "start": 27, - "type": "FULL" - }, - { - "end": 60, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 57, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 61, - "start": 58, - "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": [ - { - "end": 61, - "start": 27, - "type": "FULL" - }, - { - "end": 61, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 51, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 58, - "start": 52, - "type": "REQUEST_EXECUTION" - }, - { - "end": 62, - "start": 59, - "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": [ - { - "end": 61, - "start": 27, - "type": "FULL" - }, - { - "end": 61, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 51, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 58, - "start": 52, - "type": "REQUEST_EXECUTION" - }, - { - "end": 62, - "start": 59, - "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": [ - { - "end": 62, - "start": 27, - "type": "FULL" - }, - { - "end": 62, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 52, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 59, - "start": 53, - "type": "REQUEST_EXECUTION" - }, - { - "end": 63, - "start": 60, - "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": [ - { - "end": 62, - "start": 27, - "type": "FULL" - }, - { - "end": 62, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 52, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 59, - "start": 53, - "type": "REQUEST_EXECUTION" - }, - { - "end": 63, - "start": 60, - "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": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "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": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "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": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "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": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "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": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "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": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "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": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "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": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "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": [ - { - "end": 60, - "start": 27, - "type": "FULL" - }, - { - "end": 60, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 54, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 57, - "start": 55, - "type": "REQUEST_EXECUTION" - }, - { - "end": 61, - "start": 58, - "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": [ - { - "end": 60, - "start": 27, - "type": "FULL" - }, - { - "end": 60, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 54, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 57, - "start": 55, - "type": "REQUEST_EXECUTION" - }, - { - "end": 61, - "start": 58, - "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": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "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": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "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": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "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": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "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": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "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": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "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": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "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": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "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": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "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": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "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": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "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": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "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": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "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": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "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": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "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": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "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": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "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": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "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": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "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": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "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": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "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": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "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": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 53, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 54, - "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": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 53, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 54, - "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": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "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": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "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": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "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": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "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": [ - { - "end": 62, - "start": 27, - "type": "FULL" - }, - { - "end": 62, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 52, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 59, - "start": 53, - "type": "REQUEST_EXECUTION" - }, - { - "end": 63, - "start": 60, - "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": [ - { - "end": 62, - "start": 27, - "type": "FULL" - }, - { - "end": 62, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 52, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 59, - "start": 53, - "type": "REQUEST_EXECUTION" - }, - { - "end": 63, - "start": 60, - "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": [ - { - "end": 60, - "start": 27, - "type": "FULL" - }, - { - "end": 60, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 57, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 61, - "start": 58, - "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": [ - { - "end": 60, - "start": 27, - "type": "FULL" - }, - { - "end": 60, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 57, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 61, - "start": 58, - "type": "RESPONSE_HANDLING" - } - ], - "title": "datastream_v1_generated_datastream_update_stream_sync.py" - } - ] -} diff --git a/owl-bot-staging/v1/scripts/fixup_datastream_v1_keywords.py b/owl-bot-staging/v1/scripts/fixup_datastream_v1_keywords.py deleted file mode 100644 index f390fcd..0000000 --- a/owl-bot-staging/v1/scripts/fixup_datastream_v1_keywords.py +++ /dev/null @@ -1,200 +0,0 @@ -#! /usr/bin/env python3 -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import argparse -import os -import libcst as cst -import pathlib -import sys -from typing import (Any, Callable, Dict, List, Sequence, Tuple) - - -def partition( - predicate: Callable[[Any], bool], - iterator: Sequence[Any] -) -> Tuple[List[Any], List[Any]]: - """A stable, out-of-place partition.""" - results = ([], []) - - for i in iterator: - results[int(predicate(i))].append(i) - - # Returns trueList, falseList - return results[1], results[0] - - -class datastreamCallTransformer(cst.CSTTransformer): - CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') - METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { - 'create_connection_profile': ('parent', 'connection_profile_id', 'connection_profile', 'request_id', 'validate_only', 'force', ), - 'create_private_connection': ('parent', 'private_connection_id', 'private_connection', 'request_id', ), - 'create_route': ('parent', 'route_id', 'route', 'request_id', ), - 'create_stream': ('parent', 'stream_id', 'stream', 'request_id', 'validate_only', 'force', ), - 'delete_connection_profile': ('name', 'request_id', ), - 'delete_private_connection': ('name', 'request_id', 'force', ), - 'delete_route': ('name', 'request_id', ), - 'delete_stream': ('name', 'request_id', ), - 'discover_connection_profile': ('parent', 'connection_profile', 'connection_profile_name', 'full_hierarchy', 'hierarchy_depth', 'oracle_rdbms', 'mysql_rdbms', 'postgresql_rdbms', ), - 'fetch_static_ips': ('name', 'page_size', 'page_token', ), - 'get_connection_profile': ('name', ), - 'get_private_connection': ('name', ), - 'get_route': ('name', ), - 'get_stream': ('name', ), - 'get_stream_object': ('name', ), - 'list_connection_profiles': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), - 'list_private_connections': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), - 'list_routes': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), - 'list_stream_objects': ('parent', 'page_size', 'page_token', ), - 'list_streams': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), - 'lookup_stream_object': ('parent', 'source_object_identifier', ), - 'start_backfill_job': ('object_', ), - 'stop_backfill_job': ('object_', ), - 'update_connection_profile': ('connection_profile', 'update_mask', 'request_id', 'validate_only', 'force', ), - 'update_stream': ('stream', 'update_mask', 'request_id', 'validate_only', 'force', ), - } - - def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: - try: - key = original.func.attr.value - kword_params = self.METHOD_TO_PARAMS[key] - except (AttributeError, KeyError): - # Either not a method from the API or too convoluted to be sure. - return updated - - # If the existing code is valid, keyword args come after positional args. - # Therefore, all positional args must map to the first parameters. - args, kwargs = partition(lambda a: not bool(a.keyword), updated.args) - if any(k.keyword.value == "request" for k in kwargs): - # We've already fixed this file, don't fix it again. - return updated - - kwargs, ctrl_kwargs = partition( - lambda a: a.keyword.value not in self.CTRL_PARAMS, - kwargs - ) - - args, ctrl_args = args[:len(kword_params)], args[len(kword_params):] - ctrl_kwargs.extend(cst.Arg(value=a.value, keyword=cst.Name(value=ctrl)) - for a, ctrl in zip(ctrl_args, self.CTRL_PARAMS)) - - request_arg = cst.Arg( - value=cst.Dict([ - cst.DictElement( - cst.SimpleString("'{}'".format(name)), -cst.Element(value=arg.value) - ) - # Note: the args + kwargs looks silly, but keep in mind that - # the control parameters had to be stripped out, and that - # those could have been passed positionally or by keyword. - for name, arg in zip(kword_params, args + kwargs)]), - keyword=cst.Name("request") - ) - - return updated.with_changes( - args=[request_arg] + ctrl_kwargs - ) - - -def fix_files( - in_dir: pathlib.Path, - out_dir: pathlib.Path, - *, - transformer=datastreamCallTransformer(), -): - """Duplicate the input dir to the output dir, fixing file method calls. - - Preconditions: - * in_dir is a real directory - * out_dir is a real, empty directory - """ - pyfile_gen = ( - pathlib.Path(os.path.join(root, f)) - for root, _, files in os.walk(in_dir) - for f in files if os.path.splitext(f)[1] == ".py" - ) - - for fpath in pyfile_gen: - with open(fpath, 'r') as f: - src = f.read() - - # Parse the code and insert method call fixes. - tree = cst.parse_module(src) - updated = tree.visit(transformer) - - # Create the path and directory structure for the new file. - updated_path = out_dir.joinpath(fpath.relative_to(in_dir)) - updated_path.parent.mkdir(parents=True, exist_ok=True) - - # Generate the updated source file at the corresponding path. - with open(updated_path, 'w') as f: - f.write(updated.code) - - -if __name__ == '__main__': - parser = argparse.ArgumentParser( - description="""Fix up source that uses the datastream client library. - -The existing sources are NOT overwritten but are copied to output_dir with changes made. - -Note: This tool operates at a best-effort level at converting positional - parameters in client method calls to keyword based parameters. - Cases where it WILL FAIL include - A) * or ** expansion in a method call. - B) Calls via function or method alias (includes free function calls) - C) Indirect or dispatched calls (e.g. the method is looked up dynamically) - - These all constitute false negatives. The tool will also detect false - positives when an API method shares a name with another method. -""") - parser.add_argument( - '-d', - '--input-directory', - required=True, - dest='input_dir', - help='the input directory to walk for python files to fix up', - ) - parser.add_argument( - '-o', - '--output-directory', - required=True, - dest='output_dir', - help='the directory to output files fixed via un-flattening', - ) - args = parser.parse_args() - input_dir = pathlib.Path(args.input_dir) - output_dir = pathlib.Path(args.output_dir) - if not input_dir.is_dir(): - print( - f"input directory '{input_dir}' does not exist or is not a directory", - file=sys.stderr, - ) - sys.exit(-1) - - if not output_dir.is_dir(): - print( - f"output directory '{output_dir}' does not exist or is not a directory", - file=sys.stderr, - ) - sys.exit(-1) - - if os.listdir(output_dir): - print( - f"output directory '{output_dir}' is not empty", - file=sys.stderr, - ) - sys.exit(-1) - - fix_files(input_dir, output_dir) diff --git a/owl-bot-staging/v1/setup.py b/owl-bot-staging/v1/setup.py deleted file mode 100644 index 098cbf9..0000000 --- a/owl-bot-staging/v1/setup.py +++ /dev/null @@ -1,91 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import io -import os - -import setuptools # type: ignore - -package_root = os.path.abspath(os.path.dirname(__file__)) - -name = 'google-cloud-datastream' - - -description = "Google Cloud Datastream API client library" - -version = {} -with open(os.path.join(package_root, 'google/cloud/datastream/gapic_version.py')) as fp: - exec(fp.read(), version) -version = version["__version__"] - -if version[0] == "0": - release_status = "Development Status :: 4 - Beta" -else: - release_status = "Development Status :: 5 - Production/Stable" - -dependencies = [ - "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", - "proto-plus >= 1.22.0, <2.0.0dev", - "proto-plus >= 1.22.2, <2.0.0dev; python_version>='3.11'", - "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", - 'grpc-google-iam-v1 >= 0.12.4, < 1.0.0dev', -] -url = "https://github.com/googleapis/python-datastream" - -package_root = os.path.abspath(os.path.dirname(__file__)) - -readme_filename = os.path.join(package_root, "README.rst") -with io.open(readme_filename, encoding="utf-8") as readme_file: - readme = readme_file.read() - -packages = [ - package - for package in setuptools.PEP420PackageFinder.find() - if package.startswith("google") -] - -namespaces = ["google", "google.cloud"] - -setuptools.setup( - name=name, - version=version, - description=description, - long_description=readme, - author="Google LLC", - author_email="googleapis-packages@google.com", - license="Apache 2.0", - url=url, - classifiers=[ - release_status, - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Operating System :: OS Independent", - "Topic :: Internet", - ], - platforms="Posix; MacOS X; Windows", - packages=packages, - python_requires=">=3.7", - namespace_packages=namespaces, - install_requires=dependencies, - include_package_data=True, - zip_safe=False, -) diff --git a/owl-bot-staging/v1/testing/constraints-3.10.txt b/owl-bot-staging/v1/testing/constraints-3.10.txt deleted file mode 100644 index ad3f0fa..0000000 --- a/owl-bot-staging/v1/testing/constraints-3.10.txt +++ /dev/null @@ -1,7 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf -grpc-google-iam-v1 diff --git a/owl-bot-staging/v1/testing/constraints-3.11.txt b/owl-bot-staging/v1/testing/constraints-3.11.txt deleted file mode 100644 index ad3f0fa..0000000 --- a/owl-bot-staging/v1/testing/constraints-3.11.txt +++ /dev/null @@ -1,7 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf -grpc-google-iam-v1 diff --git a/owl-bot-staging/v1/testing/constraints-3.12.txt b/owl-bot-staging/v1/testing/constraints-3.12.txt deleted file mode 100644 index ad3f0fa..0000000 --- a/owl-bot-staging/v1/testing/constraints-3.12.txt +++ /dev/null @@ -1,7 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf -grpc-google-iam-v1 diff --git a/owl-bot-staging/v1/testing/constraints-3.7.txt b/owl-bot-staging/v1/testing/constraints-3.7.txt deleted file mode 100644 index 2beecf9..0000000 --- a/owl-bot-staging/v1/testing/constraints-3.7.txt +++ /dev/null @@ -1,10 +0,0 @@ -# This constraints file is used to check that lower bounds -# are correct in setup.py -# List all library dependencies and extras in this file. -# Pin the version to the lower bound. -# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", -# Then this file should have google-cloud-foo==1.14.0 -google-api-core==1.34.0 -proto-plus==1.22.0 -protobuf==3.19.5 -grpc-google-iam-v1==0.12.4 diff --git a/owl-bot-staging/v1/testing/constraints-3.8.txt b/owl-bot-staging/v1/testing/constraints-3.8.txt deleted file mode 100644 index ad3f0fa..0000000 --- a/owl-bot-staging/v1/testing/constraints-3.8.txt +++ /dev/null @@ -1,7 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf -grpc-google-iam-v1 diff --git a/owl-bot-staging/v1/testing/constraints-3.9.txt b/owl-bot-staging/v1/testing/constraints-3.9.txt deleted file mode 100644 index ad3f0fa..0000000 --- a/owl-bot-staging/v1/testing/constraints-3.9.txt +++ /dev/null @@ -1,7 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf -grpc-google-iam-v1 diff --git a/owl-bot-staging/v1/tests/__init__.py b/owl-bot-staging/v1/tests/__init__.py deleted file mode 100644 index 231bc12..0000000 --- a/owl-bot-staging/v1/tests/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1/tests/unit/__init__.py b/owl-bot-staging/v1/tests/unit/__init__.py deleted file mode 100644 index 231bc12..0000000 --- a/owl-bot-staging/v1/tests/unit/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1/tests/unit/gapic/__init__.py b/owl-bot-staging/v1/tests/unit/gapic/__init__.py deleted file mode 100644 index 231bc12..0000000 --- a/owl-bot-staging/v1/tests/unit/gapic/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1/tests/unit/gapic/datastream_v1/__init__.py b/owl-bot-staging/v1/tests/unit/gapic/datastream_v1/__init__.py deleted file mode 100644 index 231bc12..0000000 --- a/owl-bot-staging/v1/tests/unit/gapic/datastream_v1/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1/tests/unit/gapic/datastream_v1/test_datastream.py b/owl-bot-staging/v1/tests/unit/gapic/datastream_v1/test_datastream.py deleted file mode 100644 index eb290d0..0000000 --- a/owl-bot-staging/v1/tests/unit/gapic/datastream_v1/test_datastream.py +++ /dev/null @@ -1,9022 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os -# try/except added for compatibility with python < 3.8 -try: - from unittest import mock - from unittest.mock import AsyncMock # pragma: NO COVER -except ImportError: # pragma: NO COVER - import mock - -import grpc -from grpc.experimental import aio -import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers - -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 -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.cloud.location import locations_pb2 -from google.iam.v1 import iam_policy_pb2 # type: ignore -from google.iam.v1 import options_pb2 # type: ignore -from google.iam.v1 import policy_pb2 # type: ignore -from google.longrunning import operations_pb2 -from google.oauth2 import service_account -from google.protobuf import duration_pb2 # type: ignore -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 -import google.auth - - -def client_cert_source_callback(): - return b"cert bytes", b"key bytes" - - -# If default endpoint is localhost, then default mtls endpoint will be the same. -# This method modifies the default endpoint so the client can produce a different -# mtls endpoint for endpoint testing purposes. -def modify_default_endpoint(client): - return "foo.googleapis.com" if ("localhost" in client.DEFAULT_ENDPOINT) else client.DEFAULT_ENDPOINT - - -def test__get_default_mtls_endpoint(): - api_endpoint = "example.googleapis.com" - api_mtls_endpoint = "example.mtls.googleapis.com" - sandbox_endpoint = "example.sandbox.googleapis.com" - sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" - non_googleapi = "api.example.com" - - assert DatastreamClient._get_default_mtls_endpoint(None) is None - assert DatastreamClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint - assert DatastreamClient._get_default_mtls_endpoint(api_mtls_endpoint) == api_mtls_endpoint - assert DatastreamClient._get_default_mtls_endpoint(sandbox_endpoint) == sandbox_mtls_endpoint - assert DatastreamClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) == sandbox_mtls_endpoint - assert DatastreamClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi - - -@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, transport=transport_name) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - 'datastream.googleapis.com:443' - ) - - -@pytest.mark.parametrize("transport_class,transport_name", [ - (transports.DatastreamGrpcTransport, "grpc"), - (transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio"), -]) -def test_datastream_client_service_account_always_use_jwt(transport_class, transport_name): - with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=True) - use_jwt.assert_called_once_with(True) - - with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=False) - use_jwt.assert_not_called() - - -@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", transport=transport_name) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - 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' - ) - - -def test_datastream_client_get_transport_class(): - transport = DatastreamClient.get_transport_class() - available_transports = [ - transports.DatastreamGrpcTransport, - ] - assert transport in available_transports - - transport = DatastreamClient.get_transport_class("grpc") - assert transport == transports.DatastreamGrpcTransport - - -@pytest.mark.parametrize("client_class,transport_class,transport_name", [ - (DatastreamClient, transports.DatastreamGrpcTransport, "grpc"), - (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio"), -]) -@mock.patch.object(DatastreamClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DatastreamClient)) -@mock.patch.object(DatastreamAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DatastreamAsyncClient)) -def test_datastream_client_client_options(client_class, transport_class, transport_name): - # Check that if channel is provided we won't create a new one. - with mock.patch.object(DatastreamClient, 'get_transport_class') as gtc: - transport = transport_class( - credentials=ga_credentials.AnonymousCredentials() - ) - client = client_class(transport=transport) - gtc.assert_not_called() - - # Check that if channel is provided via str we will create a new one. - with mock.patch.object(DatastreamClient, 'get_transport_class') as gtc: - client = client_class(transport=transport_name) - gtc.assert_called() - - # Check the case api_endpoint is provided. - options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(transport=transport_name, client_options=options) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_MTLS_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has - # unsupported value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): - with pytest.raises(MutualTLSChannelError): - client = client_class(transport=transport_name) - - # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}): - with pytest.raises(ValueError): - client = client_class(transport=transport_name) - - # Check the case quota_project_id is provided - options = client_options.ClientOptions(quota_project_id="octopus") - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id="octopus", - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - # Check the case api_endpoint is provided - options = client_options.ClientOptions(api_audience="https://language.googleapis.com") - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience="https://language.googleapis.com" - ) - -@pytest.mark.parametrize("client_class,transport_class,transport_name,use_client_cert_env", [ - (DatastreamClient, transports.DatastreamGrpcTransport, "grpc", "true"), - (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio", "true"), - (DatastreamClient, transports.DatastreamGrpcTransport, "grpc", "false"), - (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio", "false"), -]) -@mock.patch.object(DatastreamClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DatastreamClient)) -@mock.patch.object(DatastreamAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DatastreamAsyncClient)) -@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) -def test_datastream_client_mtls_env_auto(client_class, transport_class, transport_name, use_client_cert_env): - # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default - # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. - - # Check the case client_cert_source is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): - options = client_options.ClientOptions(client_cert_source=client_cert_source_callback) - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - - if use_client_cert_env == "false": - expected_client_cert_source = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_client_cert_source = client_cert_source_callback - expected_host = client.DEFAULT_MTLS_ENDPOINT - - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - client_cert_source_for_mtls=expected_client_cert_source, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case ADC client cert is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): - with mock.patch.object(transport_class, '__init__') as patched: - with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): - with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=client_cert_source_callback): - if use_client_cert_env == "false": - expected_host = client.DEFAULT_ENDPOINT - expected_client_cert_source = None - else: - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_client_cert_source = client_cert_source_callback - - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - client_cert_source_for_mtls=expected_client_cert_source, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): - with mock.patch.object(transport_class, '__init__') as patched: - with mock.patch("google.auth.transport.mtls.has_default_client_cert_source", return_value=False): - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize("client_class", [ - DatastreamClient, DatastreamAsyncClient -]) -@mock.patch.object(DatastreamClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DatastreamClient)) -@mock.patch.object(DatastreamAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DatastreamAsyncClient)) -def test_datastream_client_get_mtls_endpoint_and_cert_source(client_class): - mock_client_cert_source = mock.Mock() - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - mock_api_endpoint = "foo" - options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) - assert api_endpoint == mock_api_endpoint - assert cert_source == mock_client_cert_source - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): - mock_client_cert_source = mock.Mock() - mock_api_endpoint = "foo" - options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) - assert api_endpoint == mock_api_endpoint - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=False): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): - with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=mock_client_cert_source): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source == mock_client_cert_source - - -@pytest.mark.parametrize("client_class,transport_class,transport_name", [ - (DatastreamClient, transports.DatastreamGrpcTransport, "grpc"), - (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio"), -]) -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"], - ) - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=["1", "2"], - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - -@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ - (DatastreamClient, transports.DatastreamGrpcTransport, "grpc", grpc_helpers), - (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), -]) -def test_datastream_client_client_options_credentials_file(client_class, transport_class, transport_name, grpc_helpers): - # Check the case credentials file is provided. - options = client_options.ClientOptions( - credentials_file="credentials.json" - ) - - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - -def test_datastream_client_client_options_from_dict(): - with mock.patch('google.cloud.datastream_v1.services.datastream.transports.DatastreamGrpcTransport.__init__') as grpc_transport: - grpc_transport.return_value = None - client = DatastreamClient( - client_options={'api_endpoint': 'squid.clam.whelk'} - ) - grpc_transport.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ - (DatastreamClient, transports.DatastreamGrpcTransport, "grpc", grpc_helpers), - (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), -]) -def test_datastream_client_create_channel_credentials_file(client_class, transport_class, transport_name, grpc_helpers): - # Check the case credentials file is provided. - options = client_options.ClientOptions( - credentials_file="credentials.json" - ) - - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # test that the credentials from file are saved and used as the credentials. - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch.object( - google.auth, "default", autospec=True - ) as adc, mock.patch.object( - grpc_helpers, "create_channel" - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - file_creds = ga_credentials.AnonymousCredentials() - load_creds.return_value = (file_creds, None) - adc.return_value = (creds, None) - client = client_class(client_options=options, transport=transport_name) - create_channel.assert_called_with( - "datastream.googleapis.com:443", - credentials=file_creds, - credentials_file=None, - quota_project_id=None, - default_scopes=( - 'https://www.googleapis.com/auth/cloud-platform', -), - scopes=None, - default_host="datastream.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize("request_type", [ - datastream.ListConnectionProfilesRequest, - dict, -]) -def test_list_connection_profiles(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_connection_profiles), - '__call__') 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'], - ) - response = client.list_connection_profiles(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListConnectionProfilesRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListConnectionProfilesPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_connection_profiles), - '__call__') as call: - client.list_connection_profiles() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListConnectionProfilesRequest() - -@pytest.mark.asyncio -async def test_list_connection_profiles_async(transport: str = 'grpc_asyncio', request_type=datastream.ListConnectionProfilesRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_connection_profiles), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListConnectionProfilesResponse( - next_page_token='next_page_token_value', - unreachable=['unreachable_value'], - )) - response = await client.list_connection_profiles(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListConnectionProfilesRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListConnectionProfilesAsyncPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -@pytest.mark.asyncio -async def test_list_connection_profiles_async_from_dict(): - await test_list_connection_profiles_async(request_type=dict) - - -def test_list_connection_profiles_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_connection_profiles), - '__call__') as call: - call.return_value = datastream.ListConnectionProfilesResponse() - client.list_connection_profiles(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_connection_profiles), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListConnectionProfilesResponse()) - await client.list_connection_profiles(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_connection_profiles_flattened(): - 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_connection_profiles), - '__call__') as call: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_connection_profiles_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_list_connection_profiles_flattened_async(): - 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_connection_profiles), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream.ListConnectionProfilesResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListConnectionProfilesResponse()) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_connection_profiles_flattened_error_async(): - 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', - ) - - -def test_list_connection_profiles_pager(transport_name: str = "grpc"): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_connection_profiles), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListConnectionProfilesResponse( - connection_profiles=[ - datastream_resources.ConnectionProfile(), - datastream_resources.ConnectionProfile(), - datastream_resources.ConnectionProfile(), - ], - next_page_token='abc', - ), - datastream.ListConnectionProfilesResponse( - connection_profiles=[], - next_page_token='def', - ), - datastream.ListConnectionProfilesResponse( - connection_profiles=[ - datastream_resources.ConnectionProfile(), - ], - next_page_token='ghi', - ), - datastream.ListConnectionProfilesResponse( - connection_profiles=[ - datastream_resources.ConnectionProfile(), - datastream_resources.ConnectionProfile(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_connection_profiles(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, datastream_resources.ConnectionProfile) - for i in results) -def test_list_connection_profiles_pages(transport_name: str = "grpc"): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_connection_profiles), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListConnectionProfilesResponse( - connection_profiles=[ - datastream_resources.ConnectionProfile(), - datastream_resources.ConnectionProfile(), - datastream_resources.ConnectionProfile(), - ], - next_page_token='abc', - ), - datastream.ListConnectionProfilesResponse( - connection_profiles=[], - next_page_token='def', - ), - datastream.ListConnectionProfilesResponse( - connection_profiles=[ - datastream_resources.ConnectionProfile(), - ], - next_page_token='ghi', - ), - datastream.ListConnectionProfilesResponse( - connection_profiles=[ - datastream_resources.ConnectionProfile(), - datastream_resources.ConnectionProfile(), - ], - ), - RuntimeError, - ) - pages = list(client.list_connection_profiles(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_connection_profiles_async_pager(): - 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_connection_profiles), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListConnectionProfilesResponse( - connection_profiles=[ - datastream_resources.ConnectionProfile(), - datastream_resources.ConnectionProfile(), - datastream_resources.ConnectionProfile(), - ], - next_page_token='abc', - ), - datastream.ListConnectionProfilesResponse( - connection_profiles=[], - next_page_token='def', - ), - datastream.ListConnectionProfilesResponse( - connection_profiles=[ - datastream_resources.ConnectionProfile(), - ], - next_page_token='ghi', - ), - datastream.ListConnectionProfilesResponse( - connection_profiles=[ - datastream_resources.ConnectionProfile(), - datastream_resources.ConnectionProfile(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_connection_profiles(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, datastream_resources.ConnectionProfile) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_connection_profiles_async_pages(): - 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_connection_profiles), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListConnectionProfilesResponse( - connection_profiles=[ - datastream_resources.ConnectionProfile(), - datastream_resources.ConnectionProfile(), - datastream_resources.ConnectionProfile(), - ], - next_page_token='abc', - ), - datastream.ListConnectionProfilesResponse( - connection_profiles=[], - next_page_token='def', - ), - datastream.ListConnectionProfilesResponse( - connection_profiles=[ - datastream_resources.ConnectionProfile(), - ], - next_page_token='ghi', - ), - datastream.ListConnectionProfilesResponse( - connection_profiles=[ - datastream_resources.ConnectionProfile(), - datastream_resources.ConnectionProfile(), - ], - ), - RuntimeError, - ) - 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, -]) -def test_get_connection_profile(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream_resources.ConnectionProfile( - name='name_value', - display_name='display_name_value', - oracle_profile=datastream_resources.OracleProfile(hostname='hostname_value'), - static_service_ip_connectivity=None, - ) - response = client.get_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetConnectionProfileRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream_resources.ConnectionProfile) - assert response.name == 'name_value' - assert response.display_name == 'display_name_value' - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_connection_profile), - '__call__') as call: - client.get_connection_profile() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetConnectionProfileRequest() - -@pytest.mark.asyncio -async def test_get_connection_profile_async(transport: str = 'grpc_asyncio', request_type=datastream.GetConnectionProfileRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_connection_profile), - '__call__') as call: - # 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', - )) - response = await client.get_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetConnectionProfileRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream_resources.ConnectionProfile) - assert response.name == 'name_value' - assert response.display_name == 'display_name_value' - - -@pytest.mark.asyncio -async def test_get_connection_profile_async_from_dict(): - await test_get_connection_profile_async(request_type=dict) - - -def test_get_connection_profile_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_connection_profile), - '__call__') as call: - call.return_value = datastream_resources.ConnectionProfile() - client.get_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_connection_profile), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.ConnectionProfile()) - await client.get_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_connection_profile_flattened(): - 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_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_connection_profile_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_get_connection_profile_flattened_async(): - 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_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream_resources.ConnectionProfile() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.ConnectionProfile()) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_connection_profile_flattened_error_async(): - 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', - ) - - -@pytest.mark.parametrize("request_type", [ - datastream.CreateConnectionProfileRequest, - dict, -]) -def test_create_connection_profile(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.create_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreateConnectionProfileRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_connection_profile), - '__call__') as call: - client.create_connection_profile() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreateConnectionProfileRequest() - -@pytest.mark.asyncio -async def test_create_connection_profile_async(transport: str = 'grpc_asyncio', request_type=datastream.CreateConnectionProfileRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.create_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreateConnectionProfileRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_create_connection_profile_async_from_dict(): - await test_create_connection_profile_async(request_type=dict) - - -def test_create_connection_profile_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_connection_profile), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.create_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_connection_profile), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.create_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_create_connection_profile_flattened(): - 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_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - 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.create_connection_profile( - parent='parent_value', - connection_profile=datastream_resources.ConnectionProfile(name='name_value'), - connection_profile_id='connection_profile_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].connection_profile - mock_val = datastream_resources.ConnectionProfile(name='name_value') - assert arg == mock_val - arg = args[0].connection_profile_id - mock_val = 'connection_profile_id_value' - assert arg == mock_val - - -def test_create_connection_profile_flattened_error(): - 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.create_connection_profile( - datastream.CreateConnectionProfileRequest(), - parent='parent_value', - connection_profile=datastream_resources.ConnectionProfile(name='name_value'), - connection_profile_id='connection_profile_id_value', - ) - -@pytest.mark.asyncio -async def test_create_connection_profile_flattened_async(): - 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_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_connection_profile( - parent='parent_value', - connection_profile=datastream_resources.ConnectionProfile(name='name_value'), - connection_profile_id='connection_profile_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].connection_profile - mock_val = datastream_resources.ConnectionProfile(name='name_value') - assert arg == mock_val - arg = args[0].connection_profile_id - mock_val = 'connection_profile_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_create_connection_profile_flattened_error_async(): - 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.create_connection_profile( - datastream.CreateConnectionProfileRequest(), - parent='parent_value', - connection_profile=datastream_resources.ConnectionProfile(name='name_value'), - connection_profile_id='connection_profile_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - datastream.UpdateConnectionProfileRequest, - dict, -]) -def test_update_connection_profile(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.update_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.UpdateConnectionProfileRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_connection_profile), - '__call__') as call: - client.update_connection_profile() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.UpdateConnectionProfileRequest() - -@pytest.mark.asyncio -async def test_update_connection_profile_async(transport: str = 'grpc_asyncio', request_type=datastream.UpdateConnectionProfileRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.update_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.UpdateConnectionProfileRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_update_connection_profile_async_from_dict(): - await test_update_connection_profile_async(request_type=dict) - - -def test_update_connection_profile_field_headers(): - 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 = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_connection_profile), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.update_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - '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(), - ) - - # 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 = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_connection_profile), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.update_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'connection_profile.name=name_value', - ) in kw['metadata'] - - -def test_update_connection_profile_flattened(): - 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_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - 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.update_connection_profile( - connection_profile=datastream_resources.ConnectionProfile(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].connection_profile - mock_val = datastream_resources.ConnectionProfile(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - - -def test_update_connection_profile_flattened_error(): - 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.update_connection_profile( - datastream.UpdateConnectionProfileRequest(), - connection_profile=datastream_resources.ConnectionProfile(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - -@pytest.mark.asyncio -async def test_update_connection_profile_flattened_async(): - 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_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_connection_profile( - connection_profile=datastream_resources.ConnectionProfile(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].connection_profile - mock_val = datastream_resources.ConnectionProfile(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - -@pytest.mark.asyncio -async def test_update_connection_profile_flattened_error_async(): - 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.update_connection_profile( - datastream.UpdateConnectionProfileRequest(), - connection_profile=datastream_resources.ConnectionProfile(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - -@pytest.mark.parametrize("request_type", [ - datastream.DeleteConnectionProfileRequest, - dict, -]) -def test_delete_connection_profile(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.delete_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeleteConnectionProfileRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_connection_profile), - '__call__') as call: - client.delete_connection_profile() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeleteConnectionProfileRequest() - -@pytest.mark.asyncio -async def test_delete_connection_profile_async(transport: str = 'grpc_asyncio', request_type=datastream.DeleteConnectionProfileRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.delete_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeleteConnectionProfileRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_delete_connection_profile_async_from_dict(): - await test_delete_connection_profile_async(request_type=dict) - - -def test_delete_connection_profile_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_connection_profile), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.delete_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_connection_profile), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.delete_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_delete_connection_profile_flattened(): - 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_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_delete_connection_profile_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_delete_connection_profile_flattened_async(): - 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_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_delete_connection_profile_flattened_error_async(): - 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', - ) - - -@pytest.mark.parametrize("request_type", [ - datastream.DiscoverConnectionProfileRequest, - dict, -]) -def test_discover_connection_profile(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.discover_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream.DiscoverConnectionProfileResponse( - oracle_rdbms=datastream_resources.OracleRdbms(oracle_schemas=[datastream_resources.OracleSchema(schema='schema_value')]), - ) - response = client.discover_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DiscoverConnectionProfileRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream.DiscoverConnectionProfileResponse) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.discover_connection_profile), - '__call__') as call: - client.discover_connection_profile() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DiscoverConnectionProfileRequest() - -@pytest.mark.asyncio -async def test_discover_connection_profile_async(transport: str = 'grpc_asyncio', request_type=datastream.DiscoverConnectionProfileRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.discover_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.DiscoverConnectionProfileResponse( - )) - response = await client.discover_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DiscoverConnectionProfileRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream.DiscoverConnectionProfileResponse) - - -@pytest.mark.asyncio -async def test_discover_connection_profile_async_from_dict(): - await test_discover_connection_profile_async(request_type=dict) - - -def test_discover_connection_profile_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.discover_connection_profile), - '__call__') as call: - call.return_value = datastream.DiscoverConnectionProfileResponse() - client.discover_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.discover_connection_profile), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.DiscoverConnectionProfileResponse()) - await client.discover_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@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, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - 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'], - ) - response = client.list_streams(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListStreamsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListStreamsPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_streams), - '__call__') as call: - client.list_streams() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListStreamsRequest() - -@pytest.mark.asyncio -async def test_list_streams_async(transport: str = 'grpc_asyncio', request_type=datastream.ListStreamsRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_streams), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListStreamsResponse( - next_page_token='next_page_token_value', - unreachable=['unreachable_value'], - )) - response = await client.list_streams(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListStreamsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListStreamsAsyncPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -@pytest.mark.asyncio -async def test_list_streams_async_from_dict(): - await test_list_streams_async(request_type=dict) - - -def test_list_streams_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_streams), - '__call__') as call: - call.return_value = datastream.ListStreamsResponse() - client.list_streams(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_streams), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListStreamsResponse()) - await client.list_streams(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_streams_flattened(): - 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: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_streams_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_list_streams_flattened_async(): - 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: - # Designate an appropriate return value for the call. - call.return_value = datastream.ListStreamsResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListStreamsResponse()) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_streams_flattened_error_async(): - 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', - ) - - -def test_list_streams_pager(transport_name: str = "grpc"): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_streams), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListStreamsResponse( - streams=[ - datastream_resources.Stream(), - datastream_resources.Stream(), - datastream_resources.Stream(), - ], - next_page_token='abc', - ), - datastream.ListStreamsResponse( - streams=[], - next_page_token='def', - ), - datastream.ListStreamsResponse( - streams=[ - datastream_resources.Stream(), - ], - next_page_token='ghi', - ), - datastream.ListStreamsResponse( - streams=[ - datastream_resources.Stream(), - datastream_resources.Stream(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_streams(request={}) - - assert pager._metadata == metadata - - 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, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_streams), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListStreamsResponse( - streams=[ - datastream_resources.Stream(), - datastream_resources.Stream(), - datastream_resources.Stream(), - ], - next_page_token='abc', - ), - datastream.ListStreamsResponse( - streams=[], - next_page_token='def', - ), - datastream.ListStreamsResponse( - streams=[ - datastream_resources.Stream(), - ], - next_page_token='ghi', - ), - datastream.ListStreamsResponse( - streams=[ - datastream_resources.Stream(), - datastream_resources.Stream(), - ], - ), - RuntimeError, - ) - pages = list(client.list_streams(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_streams_async_pager(): - 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__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListStreamsResponse( - streams=[ - datastream_resources.Stream(), - datastream_resources.Stream(), - datastream_resources.Stream(), - ], - next_page_token='abc', - ), - datastream.ListStreamsResponse( - streams=[], - next_page_token='def', - ), - datastream.ListStreamsResponse( - 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={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, datastream_resources.Stream) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_streams_async_pages(): - 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__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListStreamsResponse( - streams=[ - datastream_resources.Stream(), - datastream_resources.Stream(), - datastream_resources.Stream(), - ], - next_page_token='abc', - ), - datastream.ListStreamsResponse( - streams=[], - next_page_token='def', - ), - datastream.ListStreamsResponse( - 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: # 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, -]) -def test_get_stream(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_stream), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream_resources.Stream( - name='name_value', - display_name='display_name_value', - state=datastream_resources.Stream.State.NOT_STARTED, - customer_managed_encryption_key='customer_managed_encryption_key_value', - backfill_all=datastream_resources.Stream.BackfillAllStrategy(oracle_excluded_objects=datastream_resources.OracleRdbms(oracle_schemas=[datastream_resources.OracleSchema(schema='schema_value')])), - ) - response = client.get_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetStreamRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream_resources.Stream) - assert response.name == 'name_value' - assert response.display_name == 'display_name_value' - assert response.state == datastream_resources.Stream.State.NOT_STARTED - assert response.customer_managed_encryption_key == 'customer_managed_encryption_key_value' - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_stream), - '__call__') as call: - client.get_stream() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetStreamRequest() - -@pytest.mark.asyncio -async def test_get_stream_async(transport: str = 'grpc_asyncio', request_type=datastream.GetStreamRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_stream), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.Stream( - name='name_value', - display_name='display_name_value', - state=datastream_resources.Stream.State.NOT_STARTED, - customer_managed_encryption_key='customer_managed_encryption_key_value', - )) - response = await client.get_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetStreamRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream_resources.Stream) - assert response.name == 'name_value' - assert response.display_name == 'display_name_value' - assert response.state == datastream_resources.Stream.State.NOT_STARTED - assert response.customer_managed_encryption_key == 'customer_managed_encryption_key_value' - - -@pytest.mark.asyncio -async def test_get_stream_async_from_dict(): - await test_get_stream_async(request_type=dict) - - -def test_get_stream_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_stream), - '__call__') as call: - call.return_value = datastream_resources.Stream() - client.get_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_stream), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.Stream()) - await client.get_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_stream_flattened(): - 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: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_stream_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_get_stream_flattened_async(): - 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: - # Designate an appropriate return value for the call. - call.return_value = datastream_resources.Stream() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.Stream()) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_stream_flattened_error_async(): - 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', - ) - - -@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, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_stream), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.create_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreateStreamRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_stream), - '__call__') as call: - client.create_stream() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreateStreamRequest() - -@pytest.mark.asyncio -async def test_create_stream_async(transport: str = 'grpc_asyncio', request_type=datastream.CreateStreamRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_stream), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.create_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreateStreamRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_create_stream_async_from_dict(): - await test_create_stream_async(request_type=dict) - - -def test_create_stream_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_stream), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.create_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_stream), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.create_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_create_stream_flattened(): - 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: - # Designate an appropriate return value for the call. - 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.create_stream( - parent='parent_value', - stream=datastream_resources.Stream(name='name_value'), - stream_id='stream_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].stream - mock_val = datastream_resources.Stream(name='name_value') - assert arg == mock_val - arg = args[0].stream_id - mock_val = 'stream_id_value' - assert arg == mock_val - - -def test_create_stream_flattened_error(): - 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.create_stream( - datastream.CreateStreamRequest(), - parent='parent_value', - stream=datastream_resources.Stream(name='name_value'), - stream_id='stream_id_value', - ) - -@pytest.mark.asyncio -async def test_create_stream_flattened_async(): - 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: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_stream( - parent='parent_value', - stream=datastream_resources.Stream(name='name_value'), - stream_id='stream_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].stream - mock_val = datastream_resources.Stream(name='name_value') - assert arg == mock_val - arg = args[0].stream_id - mock_val = 'stream_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_create_stream_flattened_error_async(): - 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.create_stream( - datastream.CreateStreamRequest(), - parent='parent_value', - stream=datastream_resources.Stream(name='name_value'), - stream_id='stream_id_value', - ) - - -@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, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_stream), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.update_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.UpdateStreamRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_stream), - '__call__') as call: - client.update_stream() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.UpdateStreamRequest() - -@pytest.mark.asyncio -async def test_update_stream_async(transport: str = 'grpc_asyncio', request_type=datastream.UpdateStreamRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_stream), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.update_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.UpdateStreamRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_update_stream_async_from_dict(): - await test_update_stream_async(request_type=dict) - - -def test_update_stream_field_headers(): - 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 = '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: - call.return_value = operations_pb2.Operation(name='operations/op') - client.update_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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 = '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: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.update_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'stream.name=name_value', - ) in kw['metadata'] - - -def test_update_stream_flattened(): - 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: - # Designate an appropriate return value for the call. - 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.update_stream( - stream=datastream_resources.Stream(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].stream - mock_val = datastream_resources.Stream(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - - -def test_update_stream_flattened_error(): - 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.update_stream( - datastream.UpdateStreamRequest(), - stream=datastream_resources.Stream(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - -@pytest.mark.asyncio -async def test_update_stream_flattened_async(): - 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: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_stream( - stream=datastream_resources.Stream(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].stream - mock_val = datastream_resources.Stream(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - -@pytest.mark.asyncio -async def test_update_stream_flattened_error_async(): - 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.update_stream( - datastream.UpdateStreamRequest(), - stream=datastream_resources.Stream(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - -@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, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_stream), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.delete_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeleteStreamRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_stream), - '__call__') as call: - client.delete_stream() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeleteStreamRequest() - -@pytest.mark.asyncio -async def test_delete_stream_async(transport: str = 'grpc_asyncio', request_type=datastream.DeleteStreamRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_stream), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.delete_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeleteStreamRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_delete_stream_async_from_dict(): - await test_delete_stream_async(request_type=dict) - - -def test_delete_stream_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_stream), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.delete_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_stream), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.delete_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_delete_stream_flattened(): - 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: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_delete_stream_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_delete_stream_flattened_async(): - 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: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_delete_stream_flattened_error_async(): - 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', - ) - - -@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, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_stream_object), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream_resources.StreamObject( - name='name_value', - display_name='display_name_value', - ) - response = client.get_stream_object(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetStreamObjectRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream_resources.StreamObject) - assert response.name == 'name_value' - assert response.display_name == 'display_name_value' - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_stream_object), - '__call__') as call: - client.get_stream_object() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetStreamObjectRequest() - -@pytest.mark.asyncio -async def test_get_stream_object_async(transport: str = 'grpc_asyncio', request_type=datastream.GetStreamObjectRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_stream_object), - '__call__') as call: - # 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', - )) - response = await client.get_stream_object(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetStreamObjectRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream_resources.StreamObject) - assert response.name == 'name_value' - assert response.display_name == 'display_name_value' - - -@pytest.mark.asyncio -async def test_get_stream_object_async_from_dict(): - await test_get_stream_object_async(request_type=dict) - - -def test_get_stream_object_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_stream_object), - '__call__') as call: - call.return_value = datastream_resources.StreamObject() - client.get_stream_object(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_stream_object), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.StreamObject()) - await client.get_stream_object(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_stream_object_flattened(): - 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_object), - '__call__') as call: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_stream_object_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_get_stream_object_flattened_async(): - 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_object), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream_resources.StreamObject() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.StreamObject()) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_stream_object_flattened_error_async(): - 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', - ) - - -@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, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.lookup_stream_object), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream_resources.StreamObject( - name='name_value', - display_name='display_name_value', - ) - response = client.lookup_stream_object(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.LookupStreamObjectRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream_resources.StreamObject) - assert response.name == 'name_value' - assert response.display_name == 'display_name_value' - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.lookup_stream_object), - '__call__') as call: - client.lookup_stream_object() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.LookupStreamObjectRequest() - -@pytest.mark.asyncio -async def test_lookup_stream_object_async(transport: str = 'grpc_asyncio', request_type=datastream.LookupStreamObjectRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.lookup_stream_object), - '__call__') as call: - # 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', - )) - response = await client.lookup_stream_object(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.LookupStreamObjectRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream_resources.StreamObject) - assert response.name == 'name_value' - assert response.display_name == 'display_name_value' - - -@pytest.mark.asyncio -async def test_lookup_stream_object_async_from_dict(): - await test_lookup_stream_object_async(request_type=dict) - - -def test_lookup_stream_object_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.lookup_stream_object), - '__call__') as call: - call.return_value = datastream_resources.StreamObject() - client.lookup_stream_object(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.lookup_stream_object), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.StreamObject()) - await client.lookup_stream_object(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@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, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_stream_objects), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream.ListStreamObjectsResponse( - next_page_token='next_page_token_value', - ) - response = client.list_stream_objects(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListStreamObjectsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListStreamObjectsPager) - assert response.next_page_token == 'next_page_token_value' - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_stream_objects), - '__call__') as call: - client.list_stream_objects() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListStreamObjectsRequest() - -@pytest.mark.asyncio -async def test_list_stream_objects_async(transport: str = 'grpc_asyncio', request_type=datastream.ListStreamObjectsRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_stream_objects), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListStreamObjectsResponse( - next_page_token='next_page_token_value', - )) - response = await client.list_stream_objects(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListStreamObjectsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListStreamObjectsAsyncPager) - assert response.next_page_token == 'next_page_token_value' - - -@pytest.mark.asyncio -async def test_list_stream_objects_async_from_dict(): - await test_list_stream_objects_async(request_type=dict) - - -def test_list_stream_objects_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_stream_objects), - '__call__') as call: - call.return_value = datastream.ListStreamObjectsResponse() - client.list_stream_objects(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_stream_objects), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListStreamObjectsResponse()) - await client.list_stream_objects(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_stream_objects_flattened(): - 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_stream_objects), - '__call__') as call: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_stream_objects_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_list_stream_objects_flattened_async(): - 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_stream_objects), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream.ListStreamObjectsResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListStreamObjectsResponse()) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_stream_objects_flattened_error_async(): - 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', - ) - - -def test_list_stream_objects_pager(transport_name: str = "grpc"): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_stream_objects), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListStreamObjectsResponse( - stream_objects=[ - datastream_resources.StreamObject(), - datastream_resources.StreamObject(), - datastream_resources.StreamObject(), - ], - next_page_token='abc', - ), - datastream.ListStreamObjectsResponse( - stream_objects=[], - next_page_token='def', - ), - datastream.ListStreamObjectsResponse( - stream_objects=[ - datastream_resources.StreamObject(), - ], - next_page_token='ghi', - ), - datastream.ListStreamObjectsResponse( - stream_objects=[ - datastream_resources.StreamObject(), - datastream_resources.StreamObject(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_stream_objects(request={}) - - assert pager._metadata == metadata - - 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, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_stream_objects), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListStreamObjectsResponse( - stream_objects=[ - datastream_resources.StreamObject(), - datastream_resources.StreamObject(), - datastream_resources.StreamObject(), - ], - next_page_token='abc', - ), - datastream.ListStreamObjectsResponse( - stream_objects=[], - next_page_token='def', - ), - datastream.ListStreamObjectsResponse( - stream_objects=[ - datastream_resources.StreamObject(), - ], - next_page_token='ghi', - ), - datastream.ListStreamObjectsResponse( - stream_objects=[ - datastream_resources.StreamObject(), - datastream_resources.StreamObject(), - ], - ), - RuntimeError, - ) - pages = list(client.list_stream_objects(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_stream_objects_async_pager(): - 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_stream_objects), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListStreamObjectsResponse( - stream_objects=[ - datastream_resources.StreamObject(), - datastream_resources.StreamObject(), - datastream_resources.StreamObject(), - ], - next_page_token='abc', - ), - datastream.ListStreamObjectsResponse( - stream_objects=[], - next_page_token='def', - ), - datastream.ListStreamObjectsResponse( - stream_objects=[ - datastream_resources.StreamObject(), - ], - next_page_token='ghi', - ), - datastream.ListStreamObjectsResponse( - stream_objects=[ - datastream_resources.StreamObject(), - datastream_resources.StreamObject(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_stream_objects(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, datastream_resources.StreamObject) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_stream_objects_async_pages(): - 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_stream_objects), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListStreamObjectsResponse( - stream_objects=[ - datastream_resources.StreamObject(), - datastream_resources.StreamObject(), - datastream_resources.StreamObject(), - ], - next_page_token='abc', - ), - datastream.ListStreamObjectsResponse( - stream_objects=[], - next_page_token='def', - ), - datastream.ListStreamObjectsResponse( - stream_objects=[ - datastream_resources.StreamObject(), - ], - next_page_token='ghi', - ), - datastream.ListStreamObjectsResponse( - stream_objects=[ - datastream_resources.StreamObject(), - datastream_resources.StreamObject(), - ], - ), - RuntimeError, - ) - 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, -]) -def test_start_backfill_job(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.start_backfill_job), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream.StartBackfillJobResponse( - ) - response = client.start_backfill_job(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.StartBackfillJobRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream.StartBackfillJobResponse) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.start_backfill_job), - '__call__') as call: - client.start_backfill_job() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.StartBackfillJobRequest() - -@pytest.mark.asyncio -async def test_start_backfill_job_async(transport: str = 'grpc_asyncio', request_type=datastream.StartBackfillJobRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.start_backfill_job), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.StartBackfillJobResponse( - )) - response = await client.start_backfill_job(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.StartBackfillJobRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream.StartBackfillJobResponse) - - -@pytest.mark.asyncio -async def test_start_backfill_job_async_from_dict(): - await test_start_backfill_job_async(request_type=dict) - - -def test_start_backfill_job_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.start_backfill_job), - '__call__') as call: - call.return_value = datastream.StartBackfillJobResponse() - client.start_backfill_job(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.start_backfill_job), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.StartBackfillJobResponse()) - await client.start_backfill_job(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'object=object__value', - ) in kw['metadata'] - - -def test_start_backfill_job_flattened(): - 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.start_backfill_job), - '__call__') as call: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].object_ - mock_val = 'object__value' - assert arg == mock_val - - -def test_start_backfill_job_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_start_backfill_job_flattened_async(): - 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.start_backfill_job), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream.StartBackfillJobResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.StartBackfillJobResponse()) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].object_ - mock_val = 'object__value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_start_backfill_job_flattened_error_async(): - 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', - ) - - -@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, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.stop_backfill_job), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream.StopBackfillJobResponse( - ) - response = client.stop_backfill_job(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.StopBackfillJobRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream.StopBackfillJobResponse) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.stop_backfill_job), - '__call__') as call: - client.stop_backfill_job() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.StopBackfillJobRequest() - -@pytest.mark.asyncio -async def test_stop_backfill_job_async(transport: str = 'grpc_asyncio', request_type=datastream.StopBackfillJobRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.stop_backfill_job), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.StopBackfillJobResponse( - )) - response = await client.stop_backfill_job(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.StopBackfillJobRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream.StopBackfillJobResponse) - - -@pytest.mark.asyncio -async def test_stop_backfill_job_async_from_dict(): - await test_stop_backfill_job_async(request_type=dict) - - -def test_stop_backfill_job_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.stop_backfill_job), - '__call__') as call: - call.return_value = datastream.StopBackfillJobResponse() - client.stop_backfill_job(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.stop_backfill_job), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.StopBackfillJobResponse()) - await client.stop_backfill_job(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'object=object__value', - ) in kw['metadata'] - - -def test_stop_backfill_job_flattened(): - 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.stop_backfill_job), - '__call__') as call: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].object_ - mock_val = 'object__value' - assert arg == mock_val - - -def test_stop_backfill_job_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_stop_backfill_job_flattened_async(): - 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.stop_backfill_job), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream.StopBackfillJobResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.StopBackfillJobResponse()) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].object_ - mock_val = 'object__value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_stop_backfill_job_flattened_error_async(): - 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', - ) - - -@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, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # 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: - # 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', - ) - response = client.fetch_static_ips(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.FetchStaticIpsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.FetchStaticIpsPager) - assert response.static_ips == ['static_ips_value'] - assert response.next_page_token == 'next_page_token_value' - - -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', - ) - - # 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: - client.fetch_static_ips() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.FetchStaticIpsRequest() - -@pytest.mark.asyncio -async def test_fetch_static_ips_async(transport: str = 'grpc_asyncio', request_type=datastream.FetchStaticIpsRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # 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: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.FetchStaticIpsResponse( - static_ips=['static_ips_value'], - next_page_token='next_page_token_value', - )) - response = await client.fetch_static_ips(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.FetchStaticIpsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.FetchStaticIpsAsyncPager) - assert response.static_ips == ['static_ips_value'] - assert response.next_page_token == 'next_page_token_value' - - -@pytest.mark.asyncio -async def test_fetch_static_ips_async_from_dict(): - await test_fetch_static_ips_async(request_type=dict) - - -def test_fetch_static_ips_field_headers(): - 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' - - # 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: - call.return_value = datastream.FetchStaticIpsResponse() - client.fetch_static_ips(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # 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: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.FetchStaticIpsResponse()) - await client.fetch_static_ips(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_fetch_static_ips_flattened(): - 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: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_fetch_static_ips_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_fetch_static_ips_flattened_async(): - 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: - # Designate an appropriate return value for the call. - call.return_value = datastream.FetchStaticIpsResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.FetchStaticIpsResponse()) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_fetch_static_ips_flattened_error_async(): - 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', - ) - - -def test_fetch_static_ips_pager(transport_name: str = "grpc"): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # 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: - # Set the response to a series of pages. - call.side_effect = ( - datastream.FetchStaticIpsResponse( - 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=[ - str(), - str(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('name', ''), - )), - ) - pager = client.fetch_static_ips(request={}) - - assert pager._metadata == metadata - - 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, - ) - - # 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: - # Set the response to a series of pages. - call.side_effect = ( - datastream.FetchStaticIpsResponse( - 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=[ - str(), - str(), - ], - ), - RuntimeError, - ) - pages = list(client.fetch_static_ips(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_fetch_static_ips_async_pager(): - 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__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.FetchStaticIpsResponse( - 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=[ - str(), - str(), - ], - ), - RuntimeError, - ) - async_pager = await client.fetch_static_ips(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, str) - for i in responses) - - -@pytest.mark.asyncio -async def test_fetch_static_ips_async_pages(): - 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__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.FetchStaticIpsResponse( - 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=[ - str(), - str(), - ], - ), - RuntimeError, - ) - 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, -]) -def test_create_private_connection(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_private_connection), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.create_private_connection(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreatePrivateConnectionRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_private_connection), - '__call__') as call: - client.create_private_connection() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreatePrivateConnectionRequest() - -@pytest.mark.asyncio -async def test_create_private_connection_async(transport: str = 'grpc_asyncio', request_type=datastream.CreatePrivateConnectionRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_private_connection), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.create_private_connection(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreatePrivateConnectionRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_create_private_connection_async_from_dict(): - await test_create_private_connection_async(request_type=dict) - - -def test_create_private_connection_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_private_connection), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.create_private_connection(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_private_connection), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.create_private_connection(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_create_private_connection_flattened(): - 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_private_connection), - '__call__') as call: - # Designate an appropriate return value for the call. - 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.create_private_connection( - parent='parent_value', - private_connection=datastream_resources.PrivateConnection(name='name_value'), - private_connection_id='private_connection_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].private_connection - mock_val = datastream_resources.PrivateConnection(name='name_value') - assert arg == mock_val - arg = args[0].private_connection_id - mock_val = 'private_connection_id_value' - assert arg == mock_val - - -def test_create_private_connection_flattened_error(): - 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.create_private_connection( - datastream.CreatePrivateConnectionRequest(), - parent='parent_value', - private_connection=datastream_resources.PrivateConnection(name='name_value'), - private_connection_id='private_connection_id_value', - ) - -@pytest.mark.asyncio -async def test_create_private_connection_flattened_async(): - 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_private_connection), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_private_connection( - parent='parent_value', - private_connection=datastream_resources.PrivateConnection(name='name_value'), - private_connection_id='private_connection_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].private_connection - mock_val = datastream_resources.PrivateConnection(name='name_value') - assert arg == mock_val - arg = args[0].private_connection_id - mock_val = 'private_connection_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_create_private_connection_flattened_error_async(): - 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.create_private_connection( - datastream.CreatePrivateConnectionRequest(), - parent='parent_value', - private_connection=datastream_resources.PrivateConnection(name='name_value'), - private_connection_id='private_connection_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - datastream.GetPrivateConnectionRequest, - dict, -]) -def test_get_private_connection(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_private_connection), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream_resources.PrivateConnection( - name='name_value', - display_name='display_name_value', - state=datastream_resources.PrivateConnection.State.CREATING, - ) - response = client.get_private_connection(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetPrivateConnectionRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream_resources.PrivateConnection) - assert response.name == 'name_value' - assert response.display_name == 'display_name_value' - assert response.state == datastream_resources.PrivateConnection.State.CREATING - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_private_connection), - '__call__') as call: - client.get_private_connection() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetPrivateConnectionRequest() - -@pytest.mark.asyncio -async def test_get_private_connection_async(transport: str = 'grpc_asyncio', request_type=datastream.GetPrivateConnectionRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_private_connection), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.PrivateConnection( - name='name_value', - display_name='display_name_value', - state=datastream_resources.PrivateConnection.State.CREATING, - )) - response = await client.get_private_connection(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetPrivateConnectionRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream_resources.PrivateConnection) - assert response.name == 'name_value' - assert response.display_name == 'display_name_value' - assert response.state == datastream_resources.PrivateConnection.State.CREATING - - -@pytest.mark.asyncio -async def test_get_private_connection_async_from_dict(): - await test_get_private_connection_async(request_type=dict) - - -def test_get_private_connection_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_private_connection), - '__call__') as call: - call.return_value = datastream_resources.PrivateConnection() - client.get_private_connection(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_private_connection), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.PrivateConnection()) - await client.get_private_connection(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_private_connection_flattened(): - 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_private_connection), - '__call__') as call: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_private_connection_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_get_private_connection_flattened_async(): - 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_private_connection), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream_resources.PrivateConnection() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.PrivateConnection()) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_private_connection_flattened_error_async(): - 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', - ) - - -@pytest.mark.parametrize("request_type", [ - datastream.ListPrivateConnectionsRequest, - dict, -]) -def test_list_private_connections(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_private_connections), - '__call__') 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'], - ) - response = client.list_private_connections(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListPrivateConnectionsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListPrivateConnectionsPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_private_connections), - '__call__') as call: - client.list_private_connections() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListPrivateConnectionsRequest() - -@pytest.mark.asyncio -async def test_list_private_connections_async(transport: str = 'grpc_asyncio', request_type=datastream.ListPrivateConnectionsRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_private_connections), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListPrivateConnectionsResponse( - next_page_token='next_page_token_value', - unreachable=['unreachable_value'], - )) - response = await client.list_private_connections(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListPrivateConnectionsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListPrivateConnectionsAsyncPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -@pytest.mark.asyncio -async def test_list_private_connections_async_from_dict(): - await test_list_private_connections_async(request_type=dict) - - -def test_list_private_connections_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_private_connections), - '__call__') as call: - call.return_value = datastream.ListPrivateConnectionsResponse() - client.list_private_connections(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_private_connections), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListPrivateConnectionsResponse()) - await client.list_private_connections(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_private_connections_flattened(): - 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_private_connections), - '__call__') as call: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_private_connections_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_list_private_connections_flattened_async(): - 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_private_connections), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream.ListPrivateConnectionsResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListPrivateConnectionsResponse()) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_private_connections_flattened_error_async(): - 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', - ) - - -def test_list_private_connections_pager(transport_name: str = "grpc"): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_private_connections), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListPrivateConnectionsResponse( - private_connections=[ - datastream_resources.PrivateConnection(), - datastream_resources.PrivateConnection(), - datastream_resources.PrivateConnection(), - ], - next_page_token='abc', - ), - datastream.ListPrivateConnectionsResponse( - private_connections=[], - next_page_token='def', - ), - datastream.ListPrivateConnectionsResponse( - private_connections=[ - datastream_resources.PrivateConnection(), - ], - next_page_token='ghi', - ), - datastream.ListPrivateConnectionsResponse( - private_connections=[ - datastream_resources.PrivateConnection(), - datastream_resources.PrivateConnection(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_private_connections(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, datastream_resources.PrivateConnection) - for i in results) -def test_list_private_connections_pages(transport_name: str = "grpc"): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_private_connections), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListPrivateConnectionsResponse( - private_connections=[ - datastream_resources.PrivateConnection(), - datastream_resources.PrivateConnection(), - datastream_resources.PrivateConnection(), - ], - next_page_token='abc', - ), - datastream.ListPrivateConnectionsResponse( - private_connections=[], - next_page_token='def', - ), - datastream.ListPrivateConnectionsResponse( - private_connections=[ - datastream_resources.PrivateConnection(), - ], - next_page_token='ghi', - ), - datastream.ListPrivateConnectionsResponse( - private_connections=[ - datastream_resources.PrivateConnection(), - datastream_resources.PrivateConnection(), - ], - ), - RuntimeError, - ) - pages = list(client.list_private_connections(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_private_connections_async_pager(): - 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_private_connections), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListPrivateConnectionsResponse( - private_connections=[ - datastream_resources.PrivateConnection(), - datastream_resources.PrivateConnection(), - datastream_resources.PrivateConnection(), - ], - next_page_token='abc', - ), - datastream.ListPrivateConnectionsResponse( - private_connections=[], - next_page_token='def', - ), - datastream.ListPrivateConnectionsResponse( - private_connections=[ - datastream_resources.PrivateConnection(), - ], - next_page_token='ghi', - ), - datastream.ListPrivateConnectionsResponse( - private_connections=[ - datastream_resources.PrivateConnection(), - datastream_resources.PrivateConnection(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_private_connections(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, datastream_resources.PrivateConnection) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_private_connections_async_pages(): - 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_private_connections), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListPrivateConnectionsResponse( - private_connections=[ - datastream_resources.PrivateConnection(), - datastream_resources.PrivateConnection(), - datastream_resources.PrivateConnection(), - ], - next_page_token='abc', - ), - datastream.ListPrivateConnectionsResponse( - private_connections=[], - next_page_token='def', - ), - datastream.ListPrivateConnectionsResponse( - private_connections=[ - datastream_resources.PrivateConnection(), - ], - next_page_token='ghi', - ), - datastream.ListPrivateConnectionsResponse( - private_connections=[ - datastream_resources.PrivateConnection(), - datastream_resources.PrivateConnection(), - ], - ), - RuntimeError, - ) - 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, -]) -def test_delete_private_connection(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_private_connection), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.delete_private_connection(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeletePrivateConnectionRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_private_connection), - '__call__') as call: - client.delete_private_connection() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeletePrivateConnectionRequest() - -@pytest.mark.asyncio -async def test_delete_private_connection_async(transport: str = 'grpc_asyncio', request_type=datastream.DeletePrivateConnectionRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_private_connection), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.delete_private_connection(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeletePrivateConnectionRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_delete_private_connection_async_from_dict(): - await test_delete_private_connection_async(request_type=dict) - - -def test_delete_private_connection_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_private_connection), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.delete_private_connection(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_private_connection), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.delete_private_connection(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_delete_private_connection_flattened(): - 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_private_connection), - '__call__') as call: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_delete_private_connection_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_delete_private_connection_flattened_async(): - 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_private_connection), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_delete_private_connection_flattened_error_async(): - 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', - ) - - -@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, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_route), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.create_route(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreateRouteRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_route), - '__call__') as call: - client.create_route() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreateRouteRequest() - -@pytest.mark.asyncio -async def test_create_route_async(transport: str = 'grpc_asyncio', request_type=datastream.CreateRouteRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_route), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.create_route(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreateRouteRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_create_route_async_from_dict(): - await test_create_route_async(request_type=dict) - - -def test_create_route_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_route), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.create_route(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_route), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.create_route(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_create_route_flattened(): - 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: - # Designate an appropriate return value for the call. - 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.create_route( - parent='parent_value', - route=datastream_resources.Route(name='name_value'), - route_id='route_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].route - mock_val = datastream_resources.Route(name='name_value') - assert arg == mock_val - arg = args[0].route_id - mock_val = 'route_id_value' - assert arg == mock_val - - -def test_create_route_flattened_error(): - 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.create_route( - datastream.CreateRouteRequest(), - parent='parent_value', - route=datastream_resources.Route(name='name_value'), - route_id='route_id_value', - ) - -@pytest.mark.asyncio -async def test_create_route_flattened_async(): - 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: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_route( - parent='parent_value', - route=datastream_resources.Route(name='name_value'), - route_id='route_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].route - mock_val = datastream_resources.Route(name='name_value') - assert arg == mock_val - arg = args[0].route_id - mock_val = 'route_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_create_route_flattened_error_async(): - 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.create_route( - datastream.CreateRouteRequest(), - parent='parent_value', - route=datastream_resources.Route(name='name_value'), - route_id='route_id_value', - ) - - -@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, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_route), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream_resources.Route( - name='name_value', - display_name='display_name_value', - destination_address='destination_address_value', - destination_port=1734, - ) - response = client.get_route(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetRouteRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream_resources.Route) - assert response.name == 'name_value' - assert response.display_name == 'display_name_value' - assert response.destination_address == 'destination_address_value' - assert response.destination_port == 1734 - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_route), - '__call__') as call: - client.get_route() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetRouteRequest() - -@pytest.mark.asyncio -async def test_get_route_async(transport: str = 'grpc_asyncio', request_type=datastream.GetRouteRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_route), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.Route( - name='name_value', - display_name='display_name_value', - destination_address='destination_address_value', - destination_port=1734, - )) - response = await client.get_route(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetRouteRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream_resources.Route) - assert response.name == 'name_value' - assert response.display_name == 'display_name_value' - assert response.destination_address == 'destination_address_value' - assert response.destination_port == 1734 - - -@pytest.mark.asyncio -async def test_get_route_async_from_dict(): - await test_get_route_async(request_type=dict) - - -def test_get_route_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_route), - '__call__') as call: - call.return_value = datastream_resources.Route() - client.get_route(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_route), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.Route()) - await client.get_route(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_route_flattened(): - 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: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_route_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_get_route_flattened_async(): - 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: - # Designate an appropriate return value for the call. - call.return_value = datastream_resources.Route() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.Route()) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_route_flattened_error_async(): - 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', - ) - - -@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, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - 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'], - ) - response = client.list_routes(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListRoutesRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListRoutesPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_routes), - '__call__') as call: - client.list_routes() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListRoutesRequest() - -@pytest.mark.asyncio -async def test_list_routes_async(transport: str = 'grpc_asyncio', request_type=datastream.ListRoutesRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_routes), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListRoutesResponse( - next_page_token='next_page_token_value', - unreachable=['unreachable_value'], - )) - response = await client.list_routes(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListRoutesRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListRoutesAsyncPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -@pytest.mark.asyncio -async def test_list_routes_async_from_dict(): - await test_list_routes_async(request_type=dict) - - -def test_list_routes_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_routes), - '__call__') as call: - call.return_value = datastream.ListRoutesResponse() - client.list_routes(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_routes), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListRoutesResponse()) - await client.list_routes(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_routes_flattened(): - 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: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_routes_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_list_routes_flattened_async(): - 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: - # Designate an appropriate return value for the call. - call.return_value = datastream.ListRoutesResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListRoutesResponse()) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_routes_flattened_error_async(): - 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', - ) - - -def test_list_routes_pager(transport_name: str = "grpc"): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_routes), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListRoutesResponse( - routes=[ - datastream_resources.Route(), - datastream_resources.Route(), - datastream_resources.Route(), - ], - next_page_token='abc', - ), - datastream.ListRoutesResponse( - routes=[], - next_page_token='def', - ), - datastream.ListRoutesResponse( - routes=[ - datastream_resources.Route(), - ], - next_page_token='ghi', - ), - datastream.ListRoutesResponse( - routes=[ - datastream_resources.Route(), - datastream_resources.Route(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_routes(request={}) - - assert pager._metadata == metadata - - 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, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_routes), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListRoutesResponse( - routes=[ - datastream_resources.Route(), - datastream_resources.Route(), - datastream_resources.Route(), - ], - next_page_token='abc', - ), - datastream.ListRoutesResponse( - routes=[], - next_page_token='def', - ), - datastream.ListRoutesResponse( - routes=[ - datastream_resources.Route(), - ], - next_page_token='ghi', - ), - datastream.ListRoutesResponse( - routes=[ - datastream_resources.Route(), - datastream_resources.Route(), - ], - ), - RuntimeError, - ) - pages = list(client.list_routes(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_routes_async_pager(): - 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__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListRoutesResponse( - routes=[ - datastream_resources.Route(), - datastream_resources.Route(), - datastream_resources.Route(), - ], - next_page_token='abc', - ), - datastream.ListRoutesResponse( - routes=[], - next_page_token='def', - ), - datastream.ListRoutesResponse( - routes=[ - datastream_resources.Route(), - ], - next_page_token='ghi', - ), - datastream.ListRoutesResponse( - routes=[ - datastream_resources.Route(), - datastream_resources.Route(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_routes(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, datastream_resources.Route) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_routes_async_pages(): - 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__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListRoutesResponse( - routes=[ - datastream_resources.Route(), - datastream_resources.Route(), - datastream_resources.Route(), - ], - next_page_token='abc', - ), - datastream.ListRoutesResponse( - routes=[], - next_page_token='def', - ), - datastream.ListRoutesResponse( - 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: # 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, -]) -def test_delete_route(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_route), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.delete_route(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeleteRouteRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_route), - '__call__') as call: - client.delete_route() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeleteRouteRequest() - -@pytest.mark.asyncio -async def test_delete_route_async(transport: str = 'grpc_asyncio', request_type=datastream.DeleteRouteRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_route), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.delete_route(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeleteRouteRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_delete_route_async_from_dict(): - await test_delete_route_async(request_type=dict) - - -def test_delete_route_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_route), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.delete_route(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_route), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.delete_route(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_delete_route_flattened(): - 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: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_delete_route_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_delete_route_flattened_async(): - 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: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_delete_route_flattened_error_async(): - 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', - ) - - -def test_credentials_transport_error(): - # It is an error to provide credentials and a transport instance. - transport = transports.DatastreamGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # It is an error to provide a credentials file and a transport instance. - transport = transports.DatastreamGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = DatastreamClient( - client_options={"credentials_file": "credentials.json"}, - transport=transport, - ) - - # It is an error to provide an api_key and a transport instance. - transport = transports.DatastreamGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - options = client_options.ClientOptions() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = DatastreamClient( - client_options=options, - transport=transport, - ) - - # It is an error to provide an api_key and a credential. - options = mock.Mock() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = DatastreamClient( - client_options=options, - credentials=ga_credentials.AnonymousCredentials() - ) - - # It is an error to provide scopes and a transport instance. - transport = transports.DatastreamGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = DatastreamClient( - client_options={"scopes": ["1", "2"]}, - transport=transport, - ) - - -def test_transport_instance(): - # A client may be instantiated with a custom transport instance. - transport = transports.DatastreamGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - client = DatastreamClient(transport=transport) - assert client.transport is transport - -def test_transport_get_channel(): - # A client may be instantiated with a custom transport instance. - transport = transports.DatastreamGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - - transport = transports.DatastreamGrpcAsyncIOTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - -@pytest.mark.parametrize("transport_class", [ - transports.DatastreamGrpcTransport, - transports.DatastreamGrpcAsyncIOTransport, -]) -def test_transport_adc(transport_class): - # Test default credentials are used if not provided. - with mock.patch.object(google.auth, 'default') as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - 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, - ) - -def test_datastream_base_transport_error(): - # Passing both a credentials object and credentials_file should raise an error - with pytest.raises(core_exceptions.DuplicateCredentialArgs): - transport = transports.DatastreamTransport( - credentials=ga_credentials.AnonymousCredentials(), - credentials_file="credentials.json" - ) - - -def test_datastream_base_transport(): - # Instantiate the base transport. - with mock.patch('google.cloud.datastream_v1.services.datastream.transports.DatastreamTransport.__init__') as Transport: - Transport.return_value = None - transport = transports.DatastreamTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Every method on the transport should just blindly - # raise NotImplementedError. - methods = ( - 'list_connection_profiles', - 'get_connection_profile', - 'create_connection_profile', - 'update_connection_profile', - 'delete_connection_profile', - 'discover_connection_profile', - 'list_streams', - 'get_stream', - 'create_stream', - 'update_stream', - 'delete_stream', - 'get_stream_object', - 'lookup_stream_object', - 'list_stream_objects', - 'start_backfill_job', - 'stop_backfill_job', - 'fetch_static_ips', - 'create_private_connection', - 'get_private_connection', - 'list_private_connections', - 'delete_private_connection', - 'create_route', - 'get_route', - 'list_routes', - 'delete_route', - 'get_location', - 'list_locations', - 'get_operation', - 'cancel_operation', - 'delete_operation', - 'list_operations', - ) - for method in methods: - with pytest.raises(NotImplementedError): - getattr(transport, method)(request=object()) - - with pytest.raises(NotImplementedError): - transport.close() - - # Additionally, the LRO client (a property) should - # also raise NotImplementedError - 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 - with mock.patch.object(google.auth, 'load_credentials_from_file', autospec=True) as load_creds, mock.patch('google.cloud.datastream_v1.services.datastream.transports.DatastreamTransport._prep_wrapped_messages') as Transport: - Transport.return_value = None - load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.DatastreamTransport( - credentials_file="credentials.json", - quota_project_id="octopus", - ) - load_creds.assert_called_once_with("credentials.json", - scopes=None, - default_scopes=( - 'https://www.googleapis.com/auth/cloud-platform', -), - quota_project_id="octopus", - ) - - -def test_datastream_base_transport_with_adc(): - # Test the default credentials are used if credentials and credentials_file are None. - with mock.patch.object(google.auth, 'default', autospec=True) as adc, mock.patch('google.cloud.datastream_v1.services.datastream.transports.DatastreamTransport._prep_wrapped_messages') as Transport: - Transport.return_value = None - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.DatastreamTransport() - adc.assert_called_once() - - -def test_datastream_auth_adc(): - # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(google.auth, 'default', autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - DatastreamClient() - adc.assert_called_once_with( - scopes=None, - default_scopes=( - 'https://www.googleapis.com/auth/cloud-platform', -), - quota_project_id=None, - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.DatastreamGrpcTransport, - transports.DatastreamGrpcAsyncIOTransport, - ], -) -def test_datastream_transport_auth_adc(transport_class): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, 'default', autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class(quota_project_id="octopus", scopes=["1", "2"]) - adc.assert_called_once_with( - scopes=["1", "2"], - default_scopes=( 'https://www.googleapis.com/auth/cloud-platform',), - quota_project_id="octopus", - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.DatastreamGrpcTransport, - transports.DatastreamGrpcAsyncIOTransport, - ], -) -def test_datastream_transport_auth_gdch_credentials(transport_class): - host = 'https://language.com' - api_audience_tests = [None, 'https://language2.com'] - api_audience_expect = [host, 'https://language2.com'] - for t, e in zip(api_audience_tests, api_audience_expect): - with mock.patch.object(google.auth, 'default', autospec=True) as adc: - gdch_mock = mock.MagicMock() - type(gdch_mock).with_gdch_audience = mock.PropertyMock(return_value=gdch_mock) - adc.return_value = (gdch_mock, None) - transport_class(host=host, api_audience=t) - gdch_mock.with_gdch_audience.assert_called_once_with( - e - ) - - -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.DatastreamGrpcTransport, grpc_helpers), - (transports.DatastreamGrpcAsyncIOTransport, grpc_helpers_async) - ], -) -def test_datastream_transport_create_channel(transport_class, grpc_helpers): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch.object( - grpc_helpers, "create_channel", autospec=True - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - adc.return_value = (creds, None) - transport_class( - quota_project_id="octopus", - scopes=["1", "2"] - ) - - create_channel.assert_called_with( - "datastream.googleapis.com:443", - credentials=creds, - credentials_file=None, - quota_project_id="octopus", - default_scopes=( - 'https://www.googleapis.com/auth/cloud-platform', -), - scopes=["1", "2"], - default_host="datastream.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize("transport_class", [transports.DatastreamGrpcTransport, transports.DatastreamGrpcAsyncIOTransport]) -def test_datastream_grpc_transport_client_cert_source_for_mtls( - transport_class -): - cred = ga_credentials.AnonymousCredentials() - - # Check ssl_channel_credentials is used if provided. - with mock.patch.object(transport_class, "create_channel") as mock_create_channel: - mock_ssl_channel_creds = mock.Mock() - transport_class( - host="squid.clam.whelk", - credentials=cred, - ssl_channel_credentials=mock_ssl_channel_creds - ) - mock_create_channel.assert_called_once_with( - "squid.clam.whelk:443", - credentials=cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_channel_creds, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls - # is used. - with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): - with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: - transport_class( - credentials=cred, - client_cert_source_for_mtls=client_cert_source_callback - ) - expected_cert, expected_key = client_cert_source_callback() - mock_ssl_cred.assert_called_once_with( - certificate_chain=expected_cert, - private_key=expected_key - ) - - -@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' - ) - -@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' - ) - -def test_datastream_grpc_transport_channel(): - channel = grpc.secure_channel('http://localhost/', grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.DatastreamGrpcTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - assert transport._ssl_channel_credentials == None - - -def test_datastream_grpc_asyncio_transport_channel(): - channel = aio.secure_channel('http://localhost/', grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.DatastreamGrpcAsyncIOTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - assert transport._ssl_channel_credentials == None - - -# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are -# removed from grpc/grpc_asyncio transport constructor. -@pytest.mark.parametrize("transport_class", [transports.DatastreamGrpcTransport, transports.DatastreamGrpcAsyncIOTransport]) -def test_datastream_transport_channel_mtls_with_client_cert_source( - transport_class -): - with mock.patch("grpc.ssl_channel_credentials", autospec=True) as grpc_ssl_channel_cred: - with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: - mock_ssl_cred = mock.Mock() - grpc_ssl_channel_cred.return_value = mock_ssl_cred - - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - - cred = ga_credentials.AnonymousCredentials() - with pytest.warns(DeprecationWarning): - with mock.patch.object(google.auth, 'default') as adc: - adc.return_value = (cred, None) - transport = transport_class( - host="squid.clam.whelk", - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=client_cert_source_callback, - ) - adc.assert_called_once() - - grpc_ssl_channel_cred.assert_called_once_with( - certificate_chain=b"cert bytes", private_key=b"key bytes" - ) - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - assert transport._ssl_channel_credentials == mock_ssl_cred - - -# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are -# removed from grpc/grpc_asyncio transport constructor. -@pytest.mark.parametrize("transport_class", [transports.DatastreamGrpcTransport, transports.DatastreamGrpcAsyncIOTransport]) -def test_datastream_transport_channel_mtls_with_adc( - transport_class -): - mock_ssl_cred = mock.Mock() - with mock.patch.multiple( - "google.auth.transport.grpc.SslCredentials", - __init__=mock.Mock(return_value=None), - ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), - ): - with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - mock_cred = mock.Mock() - - with pytest.warns(DeprecationWarning): - transport = transport_class( - host="squid.clam.whelk", - credentials=mock_cred, - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=None, - ) - - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=mock_cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - - -def test_datastream_grpc_lro_client(): - client = DatastreamClient( - 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, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -def test_datastream_grpc_lro_async_client(): - client = DatastreamAsyncClient( - 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, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -def test_connection_profile_path(): - project = "squid" - location = "clam" - connection_profile = "whelk" - expected = "projects/{project}/locations/{location}/connectionProfiles/{connection_profile}".format(project=project, location=location, connection_profile=connection_profile, ) - actual = DatastreamClient.connection_profile_path(project, location, connection_profile) - assert expected == actual - - -def test_parse_connection_profile_path(): - expected = { - "project": "octopus", - "location": "oyster", - "connection_profile": "nudibranch", - } - path = DatastreamClient.connection_profile_path(**expected) - - # Check that the path construction is reversible. - actual = DatastreamClient.parse_connection_profile_path(path) - assert expected == actual - -def test_networks_path(): - project = "cuttlefish" - network = "mussel" - expected = "projects/{project}/global/networks/{network}".format(project=project, network=network, ) - actual = DatastreamClient.networks_path(project, network) - assert expected == actual - - -def test_parse_networks_path(): - expected = { - "project": "winkle", - "network": "nautilus", - } - path = DatastreamClient.networks_path(**expected) - - # Check that the path construction is reversible. - actual = DatastreamClient.parse_networks_path(path) - assert expected == actual - -def test_private_connection_path(): - project = "scallop" - location = "abalone" - private_connection = "squid" - expected = "projects/{project}/locations/{location}/privateConnections/{private_connection}".format(project=project, location=location, private_connection=private_connection, ) - actual = DatastreamClient.private_connection_path(project, location, private_connection) - assert expected == actual - - -def test_parse_private_connection_path(): - expected = { - "project": "clam", - "location": "whelk", - "private_connection": "octopus", - } - path = DatastreamClient.private_connection_path(**expected) - - # Check that the path construction is reversible. - actual = DatastreamClient.parse_private_connection_path(path) - assert expected == actual - -def test_route_path(): - project = "oyster" - location = "nudibranch" - private_connection = "cuttlefish" - route = "mussel" - expected = "projects/{project}/locations/{location}/privateConnections/{private_connection}/routes/{route}".format(project=project, location=location, private_connection=private_connection, route=route, ) - actual = DatastreamClient.route_path(project, location, private_connection, route) - assert expected == actual - - -def test_parse_route_path(): - expected = { - "project": "winkle", - "location": "nautilus", - "private_connection": "scallop", - "route": "abalone", - } - path = DatastreamClient.route_path(**expected) - - # Check that the path construction is reversible. - actual = DatastreamClient.parse_route_path(path) - assert expected == actual - -def test_stream_path(): - project = "squid" - location = "clam" - stream = "whelk" - expected = "projects/{project}/locations/{location}/streams/{stream}".format(project=project, location=location, stream=stream, ) - actual = DatastreamClient.stream_path(project, location, stream) - assert expected == actual - - -def test_parse_stream_path(): - expected = { - "project": "octopus", - "location": "oyster", - "stream": "nudibranch", - } - path = DatastreamClient.stream_path(**expected) - - # Check that the path construction is reversible. - actual = DatastreamClient.parse_stream_path(path) - assert expected == actual - -def test_stream_object_path(): - project = "cuttlefish" - location = "mussel" - stream = "winkle" - object = "nautilus" - expected = "projects/{project}/locations/{location}/streams/{stream}/objects/{object}".format(project=project, location=location, stream=stream, object=object, ) - actual = DatastreamClient.stream_object_path(project, location, stream, object) - assert expected == actual - - -def test_parse_stream_object_path(): - expected = { - "project": "scallop", - "location": "abalone", - "stream": "squid", - "object": "clam", - } - path = DatastreamClient.stream_object_path(**expected) - - # Check that the path construction is reversible. - actual = DatastreamClient.parse_stream_object_path(path) - assert expected == actual - -def test_common_billing_account_path(): - billing_account = "whelk" - expected = "billingAccounts/{billing_account}".format(billing_account=billing_account, ) - actual = DatastreamClient.common_billing_account_path(billing_account) - assert expected == actual - - -def test_parse_common_billing_account_path(): - expected = { - "billing_account": "octopus", - } - path = DatastreamClient.common_billing_account_path(**expected) - - # Check that the path construction is reversible. - actual = DatastreamClient.parse_common_billing_account_path(path) - assert expected == actual - -def test_common_folder_path(): - folder = "oyster" - expected = "folders/{folder}".format(folder=folder, ) - actual = DatastreamClient.common_folder_path(folder) - assert expected == actual - - -def test_parse_common_folder_path(): - expected = { - "folder": "nudibranch", - } - path = DatastreamClient.common_folder_path(**expected) - - # Check that the path construction is reversible. - actual = DatastreamClient.parse_common_folder_path(path) - assert expected == actual - -def test_common_organization_path(): - organization = "cuttlefish" - expected = "organizations/{organization}".format(organization=organization, ) - actual = DatastreamClient.common_organization_path(organization) - assert expected == actual - - -def test_parse_common_organization_path(): - expected = { - "organization": "mussel", - } - path = DatastreamClient.common_organization_path(**expected) - - # Check that the path construction is reversible. - actual = DatastreamClient.parse_common_organization_path(path) - assert expected == actual - -def test_common_project_path(): - project = "winkle" - expected = "projects/{project}".format(project=project, ) - actual = DatastreamClient.common_project_path(project) - assert expected == actual - - -def test_parse_common_project_path(): - expected = { - "project": "nautilus", - } - path = DatastreamClient.common_project_path(**expected) - - # Check that the path construction is reversible. - actual = DatastreamClient.parse_common_project_path(path) - assert expected == actual - -def test_common_location_path(): - project = "scallop" - location = "abalone" - expected = "projects/{project}/locations/{location}".format(project=project, location=location, ) - actual = DatastreamClient.common_location_path(project, location) - assert expected == actual - - -def test_parse_common_location_path(): - expected = { - "project": "squid", - "location": "clam", - } - path = DatastreamClient.common_location_path(**expected) - - # Check that the path construction is reversible. - actual = DatastreamClient.parse_common_location_path(path) - assert expected == actual - - -def test_client_with_default_client_info(): - client_info = gapic_v1.client_info.ClientInfo() - - with mock.patch.object(transports.DatastreamTransport, '_prep_wrapped_messages') as prep: - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - with mock.patch.object(transports.DatastreamTransport, '_prep_wrapped_messages') as prep: - transport_class = DatastreamClient.get_transport_class() - transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - -@pytest.mark.asyncio -async def test_transport_close_async(): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc_asyncio", - ) - with mock.patch.object(type(getattr(client.transport, "grpc_channel")), "close") as close: - async with client: - close.assert_not_called() - close.assert_called_once() - - -def test_delete_operation(transport: str = "grpc"): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = operations_pb2.DeleteOperationRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = None - response = client.delete_operation(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the response is the type that we expect. - assert response is None -@pytest.mark.asyncio -async def test_delete_operation_async(transport: str = "grpc"): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = operations_pb2.DeleteOperationRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - None - ) - response = await client.delete_operation(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the response is the type that we expect. - assert response is None - -def test_delete_operation_field_headers(): - 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 = operations_pb2.DeleteOperationRequest() - request.name = "locations" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: - call.return_value = None - - client.delete_operation(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] -@pytest.mark.asyncio -async def test_delete_operation_field_headers_async(): - 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 = operations_pb2.DeleteOperationRequest() - request.name = "locations" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - None - ) - await client.delete_operation(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] - -def test_delete_operation_from_dict(): - 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_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = None - - response = client.delete_operation( - request={ - "name": "locations", - } - ) - call.assert_called() -@pytest.mark.asyncio -async def test_delete_operation_from_dict_async(): - 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_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - None - ) - response = await client.delete_operation( - request={ - "name": "locations", - } - ) - call.assert_called() - - -def test_cancel_operation(transport: str = "grpc"): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = operations_pb2.CancelOperationRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = None - response = client.cancel_operation(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the response is the type that we expect. - assert response is None -@pytest.mark.asyncio -async def test_cancel_operation_async(transport: str = "grpc"): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = operations_pb2.CancelOperationRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - None - ) - response = await client.cancel_operation(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the response is the type that we expect. - assert response is None - -def test_cancel_operation_field_headers(): - 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 = operations_pb2.CancelOperationRequest() - request.name = "locations" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: - call.return_value = None - - client.cancel_operation(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] -@pytest.mark.asyncio -async def test_cancel_operation_field_headers_async(): - 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 = operations_pb2.CancelOperationRequest() - request.name = "locations" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - None - ) - await client.cancel_operation(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] - -def test_cancel_operation_from_dict(): - 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.cancel_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = None - - response = client.cancel_operation( - request={ - "name": "locations", - } - ) - call.assert_called() -@pytest.mark.asyncio -async def test_cancel_operation_from_dict_async(): - 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.cancel_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - None - ) - response = await client.cancel_operation( - request={ - "name": "locations", - } - ) - call.assert_called() - - -def test_get_operation(transport: str = "grpc"): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = operations_pb2.GetOperationRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation() - response = client.get_operation(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, operations_pb2.Operation) -@pytest.mark.asyncio -async def test_get_operation_async(transport: str = "grpc"): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = operations_pb2.GetOperationRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation() - ) - response = await client.get_operation(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, operations_pb2.Operation) - -def test_get_operation_field_headers(): - 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 = operations_pb2.GetOperationRequest() - request.name = "locations" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_operation), "__call__") as call: - call.return_value = operations_pb2.Operation() - - client.get_operation(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] -@pytest.mark.asyncio -async def test_get_operation_field_headers_async(): - 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 = operations_pb2.GetOperationRequest() - request.name = "locations" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_operation), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation() - ) - await client.get_operation(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] - -def test_get_operation_from_dict(): - 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_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation() - - response = client.get_operation( - request={ - "name": "locations", - } - ) - call.assert_called() -@pytest.mark.asyncio -async def test_get_operation_from_dict_async(): - 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_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation() - ) - response = await client.get_operation( - request={ - "name": "locations", - } - ) - call.assert_called() - - -def test_list_operations(transport: str = "grpc"): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = operations_pb2.ListOperationsRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_operations), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.ListOperationsResponse() - response = client.list_operations(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, operations_pb2.ListOperationsResponse) -@pytest.mark.asyncio -async def test_list_operations_async(transport: str = "grpc"): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = operations_pb2.ListOperationsRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_operations), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.ListOperationsResponse() - ) - response = await client.list_operations(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, operations_pb2.ListOperationsResponse) - -def test_list_operations_field_headers(): - 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 = operations_pb2.ListOperationsRequest() - request.name = "locations" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_operations), "__call__") as call: - call.return_value = operations_pb2.ListOperationsResponse() - - client.list_operations(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] -@pytest.mark.asyncio -async def test_list_operations_field_headers_async(): - 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 = operations_pb2.ListOperationsRequest() - request.name = "locations" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_operations), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.ListOperationsResponse() - ) - await client.list_operations(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] - -def test_list_operations_from_dict(): - 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_operations), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.ListOperationsResponse() - - response = client.list_operations( - request={ - "name": "locations", - } - ) - call.assert_called() -@pytest.mark.asyncio -async def test_list_operations_from_dict_async(): - 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_operations), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.ListOperationsResponse() - ) - response = await client.list_operations( - request={ - "name": "locations", - } - ) - call.assert_called() - - -def test_list_locations(transport: str = "grpc"): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = locations_pb2.ListLocationsRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_locations), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = locations_pb2.ListLocationsResponse() - response = client.list_locations(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, locations_pb2.ListLocationsResponse) -@pytest.mark.asyncio -async def test_list_locations_async(transport: str = "grpc"): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = locations_pb2.ListLocationsRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_locations), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - locations_pb2.ListLocationsResponse() - ) - response = await client.list_locations(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, locations_pb2.ListLocationsResponse) - -def test_list_locations_field_headers(): - 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 = locations_pb2.ListLocationsRequest() - request.name = "locations" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_locations), "__call__") as call: - call.return_value = locations_pb2.ListLocationsResponse() - - client.list_locations(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] -@pytest.mark.asyncio -async def test_list_locations_field_headers_async(): - 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 = locations_pb2.ListLocationsRequest() - request.name = "locations" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_locations), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - locations_pb2.ListLocationsResponse() - ) - await client.list_locations(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] - -def test_list_locations_from_dict(): - 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_locations), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = locations_pb2.ListLocationsResponse() - - response = client.list_locations( - request={ - "name": "locations", - } - ) - call.assert_called() -@pytest.mark.asyncio -async def test_list_locations_from_dict_async(): - 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_locations), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - locations_pb2.ListLocationsResponse() - ) - response = await client.list_locations( - request={ - "name": "locations", - } - ) - call.assert_called() - - -def test_get_location(transport: str = "grpc"): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = locations_pb2.GetLocationRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_location), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = locations_pb2.Location() - response = client.get_location(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, locations_pb2.Location) -@pytest.mark.asyncio -async def test_get_location_async(transport: str = "grpc_asyncio"): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = locations_pb2.GetLocationRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_location), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - locations_pb2.Location() - ) - response = await client.get_location(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, locations_pb2.Location) - -def test_get_location_field_headers(): - 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 = locations_pb2.GetLocationRequest() - request.name = "locations/abc" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_location), "__call__") as call: - call.return_value = locations_pb2.Location() - - client.get_location(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations/abc",) in kw["metadata"] -@pytest.mark.asyncio -async def test_get_location_field_headers_async(): - 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 = locations_pb2.GetLocationRequest() - request.name = "locations/abc" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_location), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - locations_pb2.Location() - ) - await client.get_location(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations/abc",) in kw["metadata"] - -def test_get_location_from_dict(): - 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_locations), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = locations_pb2.Location() - - response = client.get_location( - request={ - "name": "locations/abc", - } - ) - call.assert_called() -@pytest.mark.asyncio -async def test_get_location_from_dict_async(): - 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_locations), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - locations_pb2.Location() - ) - response = await client.get_location( - request={ - "name": "locations", - } - ) - call.assert_called() - - -def test_transport_close(): - transports = { - "grpc": "_grpc_channel", - } - - for transport, close_name in transports.items(): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport - ) - with mock.patch.object(type(getattr(client.transport, close_name)), "close") as close: - with client: - close.assert_not_called() - close.assert_called_once() - -def test_client_ctx(): - transports = [ - 'grpc', - ] - for transport in transports: - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport - ) - # Test client calls underlying transport. - with mock.patch.object(type(client.transport), "close") as close: - close.assert_not_called() - with client: - pass - close.assert_called() - -@pytest.mark.parametrize("client_class,transport_class", [ - (DatastreamClient, transports.DatastreamGrpcTransport), - (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport), -]) -def test_api_key_credentials(client_class, transport_class): - with mock.patch.object( - google.auth._default, "get_api_key_credentials", create=True - ) as get_api_key_credentials: - mock_cred = mock.Mock() - get_api_key_credentials.return_value = mock_cred - options = client_options.ClientOptions() - options.api_key = "api_key" - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options) - patched.assert_called_once_with( - credentials=mock_cred, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) diff --git a/owl-bot-staging/v1alpha1/.coveragerc b/owl-bot-staging/v1alpha1/.coveragerc deleted file mode 100644 index 99bdb31..0000000 --- a/owl-bot-staging/v1alpha1/.coveragerc +++ /dev/null @@ -1,13 +0,0 @@ -[run] -branch = True - -[report] -show_missing = True -omit = - google/cloud/datastream/__init__.py - google/cloud/datastream/gapic_version.py -exclude_lines = - # Re-enable the standard pragma - pragma: NO COVER - # Ignore debug-only repr - def __repr__ diff --git a/owl-bot-staging/v1alpha1/.flake8 b/owl-bot-staging/v1alpha1/.flake8 deleted file mode 100644 index 29227d4..0000000 --- a/owl-bot-staging/v1alpha1/.flake8 +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Generated by synthtool. DO NOT EDIT! -[flake8] -ignore = E203, E266, E501, W503 -exclude = - # Exclude generated code. - **/proto/** - **/gapic/** - **/services/** - **/types/** - *_pb2.py - - # Standard linting exemptions. - **/.nox/** - __pycache__, - .git, - *.pyc, - conf.py diff --git a/owl-bot-staging/v1alpha1/MANIFEST.in b/owl-bot-staging/v1alpha1/MANIFEST.in deleted file mode 100644 index 9b55389..0000000 --- a/owl-bot-staging/v1alpha1/MANIFEST.in +++ /dev/null @@ -1,2 +0,0 @@ -recursive-include google/cloud/datastream *.py -recursive-include google/cloud/datastream_v1alpha1 *.py diff --git a/owl-bot-staging/v1alpha1/README.rst b/owl-bot-staging/v1alpha1/README.rst deleted file mode 100644 index 9a1922d..0000000 --- a/owl-bot-staging/v1alpha1/README.rst +++ /dev/null @@ -1,49 +0,0 @@ -Python Client for Google Cloud Datastream API -================================================= - -Quick Start ------------ - -In order to use this library, you first need to go through the following steps: - -1. `Select or create a Cloud Platform project.`_ -2. `Enable billing for your project.`_ -3. Enable the Google Cloud Datastream API. -4. `Setup Authentication.`_ - -.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project -.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project -.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html - -Installation -~~~~~~~~~~~~ - -Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to -create isolated Python environments. The basic problem it addresses is one of -dependencies and versions, and indirectly permissions. - -With `virtualenv`_, it's possible to install this library without needing system -install permissions, and without clashing with the installed system -dependencies. - -.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ - - -Mac/Linux -^^^^^^^^^ - -.. code-block:: console - - python3 -m venv - source /bin/activate - /bin/pip install /path/to/library - - -Windows -^^^^^^^ - -.. code-block:: console - - python3 -m venv - \Scripts\activate - \Scripts\pip.exe install \path\to\library diff --git a/owl-bot-staging/v1alpha1/docs/conf.py b/owl-bot-staging/v1alpha1/docs/conf.py deleted file mode 100644 index 38f6361..0000000 --- a/owl-bot-staging/v1alpha1/docs/conf.py +++ /dev/null @@ -1,376 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# google-cloud-datastream documentation build configuration file -# -# This file is execfile()d with the current directory set to its -# containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -import sys -import os -import shlex - -# 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 -# documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.insert(0, os.path.abspath("..")) - -__version__ = "0.1.0" - -# -- General configuration ------------------------------------------------ - -# If your documentation needs a minimal Sphinx version, state it here. -needs_sphinx = "4.0.1" - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - "sphinx.ext.autodoc", - "sphinx.ext.autosummary", - "sphinx.ext.intersphinx", - "sphinx.ext.coverage", - "sphinx.ext.napoleon", - "sphinx.ext.todo", - "sphinx.ext.viewcode", -] - -# autodoc/autosummary flags -autoclass_content = "both" -autodoc_default_flags = ["members"] -autosummary_generate = True - - -# Add any paths that contain templates here, relative to this directory. -templates_path = ["_templates"] - -# Allow markdown includes (so releases.md can include CHANGLEOG.md) -# http://www.sphinx-doc.org/en/master/markdown.html -source_parsers = {".md": "recommonmark.parser.CommonMarkParser"} - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: -source_suffix = [".rst", ".md"] - -# The encoding of source files. -# source_encoding = 'utf-8-sig' - -# The root toctree document. -root_doc = "index" - -# General information about the project. -project = u"google-cloud-datastream" -copyright = u"2022, Google, LLC" -author = u"Google APIs" # TODO: autogenerate this bit - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The full version, including alpha/beta/rc tags. -release = __version__ -# The short X.Y version. -version = ".".join(release.split(".")[0:2]) - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# -# This is also used if you do content translation via gettext catalogs. -# Usually you set "language" from the command line for these cases. -language = None - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -# today = '' -# Else, today_fmt is used as the format for a strftime call. -# today_fmt = '%B %d, %Y' - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -exclude_patterns = ["_build"] - -# The reST default role (used for this markup: `text`) to use for all -# documents. -# default_role = None - -# If true, '()' will be appended to :func: etc. cross-reference text. -# add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -# add_module_names = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -# show_authors = False - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = "sphinx" - -# A list of ignored prefixes for module index sorting. -# modindex_common_prefix = [] - -# If true, keep warnings as "system message" paragraphs in the built documents. -# keep_warnings = False - -# If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = True - - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -html_theme = "alabaster" - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -html_theme_options = { - "description": "Google Cloud Client Libraries for Python", - "github_user": "googleapis", - "github_repo": "google-cloud-python", - "github_banner": True, - "font_family": "'Roboto', Georgia, sans", - "head_font_family": "'Roboto', Georgia, serif", - "code_font_family": "'Roboto Mono', 'Consolas', monospace", -} - -# Add any paths that contain custom themes here, relative to this directory. -# html_theme_path = [] - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -# html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -# html_short_title = None - -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -# html_logo = None - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -# html_favicon = None - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ["_static"] - -# Add any extra paths that contain custom files (such as robots.txt or -# .htaccess) here, relative to this directory. These files are copied -# directly to the root of the documentation. -# html_extra_path = [] - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -# html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -# html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -# html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -# html_additional_pages = {} - -# If false, no module index is generated. -# html_domain_indices = True - -# If false, no index is generated. -# html_use_index = True - -# If true, the index is split into individual pages for each letter. -# html_split_index = False - -# If true, links to the reST sources are added to the pages. -# html_show_sourcelink = True - -# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -# html_show_sphinx = True - -# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -# html_show_copyright = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -# html_use_opensearch = '' - -# This is the file name suffix for HTML files (e.g. ".xhtml"). -# html_file_suffix = None - -# Language to be used for generating the HTML full-text search index. -# Sphinx supports the following languages: -# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' -# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' -# html_search_language = 'en' - -# A dictionary with options for the search language support, empty by default. -# Now only 'ja' uses this config value -# html_search_options = {'type': 'default'} - -# The name of a javascript file (relative to the configuration directory) that -# implements a search results scorer. If empty, the default will be used. -# html_search_scorer = 'scorer.js' - -# Output file base name for HTML help builder. -htmlhelp_basename = "google-cloud-datastream-doc" - -# -- Options for warnings ------------------------------------------------------ - - -suppress_warnings = [ - # Temporarily suppress this to avoid "more than one target found for - # cross-reference" warning, which are intractable for us to avoid while in - # a mono-repo. - # See https://github.com/sphinx-doc/sphinx/blob - # /2a65ffeef5c107c19084fabdd706cdff3f52d93c/sphinx/domains/python.py#L843 - "ref.python" -] - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). - # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. - # 'preamble': '', - # Latex figure (float) alignment - # 'figure_align': 'htbp', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - ( - root_doc, - "google-cloud-datastream.tex", - u"google-cloud-datastream Documentation", - author, - "manual", - ) -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -# latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -# latex_use_parts = False - -# If true, show page references after internal links. -# latex_show_pagerefs = False - -# If true, show URL addresses after external links. -# latex_show_urls = False - -# Documents to append as an appendix to all manuals. -# latex_appendices = [] - -# If false, no module index is generated. -# latex_domain_indices = True - - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - ( - root_doc, - "google-cloud-datastream", - u"Google Cloud Datastream Documentation", - [author], - 1, - ) -] - -# If true, show URL addresses after external links. -# man_show_urls = False - - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - ( - root_doc, - "google-cloud-datastream", - u"google-cloud-datastream Documentation", - author, - "google-cloud-datastream", - "GAPIC library for Google Cloud Datastream API", - "APIs", - ) -] - -# Documents to append as an appendix to all manuals. -# texinfo_appendices = [] - -# If false, no module index is generated. -# texinfo_domain_indices = True - -# How to display URL addresses: 'footnote', 'no', or 'inline'. -# texinfo_show_urls = 'footnote' - -# If true, do not generate a @detailmenu in the "Top" node's menu. -# texinfo_no_detailmenu = False - - -# Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = { - "python": ("http://python.readthedocs.org/en/latest/", None), - "gax": ("https://gax-python.readthedocs.org/en/latest/", None), - "google-auth": ("https://google-auth.readthedocs.io/en/stable", None), - "google-gax": ("https://gax-python.readthedocs.io/en/latest/", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None), - "grpc": ("https://grpc.io/grpc/python/", None), - "requests": ("http://requests.kennethreitz.org/en/stable/", None), - "proto": ("https://proto-plus-python.readthedocs.io/en/stable", None), - "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), -} - - -# Napoleon settings -napoleon_google_docstring = True -napoleon_numpy_docstring = True -napoleon_include_private_with_doc = False -napoleon_include_special_with_doc = True -napoleon_use_admonition_for_examples = False -napoleon_use_admonition_for_notes = False -napoleon_use_admonition_for_references = False -napoleon_use_ivar = False -napoleon_use_param = True -napoleon_use_rtype = True diff --git a/owl-bot-staging/v1alpha1/docs/datastream_v1alpha1/datastream.rst b/owl-bot-staging/v1alpha1/docs/datastream_v1alpha1/datastream.rst deleted file mode 100644 index 507205d..0000000 --- a/owl-bot-staging/v1alpha1/docs/datastream_v1alpha1/datastream.rst +++ /dev/null @@ -1,10 +0,0 @@ -Datastream ----------------------------- - -.. automodule:: google.cloud.datastream_v1alpha1.services.datastream - :members: - :inherited-members: - -.. automodule:: google.cloud.datastream_v1alpha1.services.datastream.pagers - :members: - :inherited-members: diff --git a/owl-bot-staging/v1alpha1/docs/datastream_v1alpha1/services.rst b/owl-bot-staging/v1alpha1/docs/datastream_v1alpha1/services.rst deleted file mode 100644 index 1711424..0000000 --- a/owl-bot-staging/v1alpha1/docs/datastream_v1alpha1/services.rst +++ /dev/null @@ -1,6 +0,0 @@ -Services for Google Cloud Datastream v1alpha1 API -================================================= -.. toctree:: - :maxdepth: 2 - - datastream diff --git a/owl-bot-staging/v1alpha1/docs/datastream_v1alpha1/types.rst b/owl-bot-staging/v1alpha1/docs/datastream_v1alpha1/types.rst deleted file mode 100644 index 62cc052..0000000 --- a/owl-bot-staging/v1alpha1/docs/datastream_v1alpha1/types.rst +++ /dev/null @@ -1,6 +0,0 @@ -Types for Google Cloud Datastream v1alpha1 API -============================================== - -.. automodule:: google.cloud.datastream_v1alpha1.types - :members: - :show-inheritance: diff --git a/owl-bot-staging/v1alpha1/docs/index.rst b/owl-bot-staging/v1alpha1/docs/index.rst deleted file mode 100644 index e0c9ba0..0000000 --- a/owl-bot-staging/v1alpha1/docs/index.rst +++ /dev/null @@ -1,7 +0,0 @@ -API Reference -------------- -.. toctree:: - :maxdepth: 2 - - datastream_v1alpha1/services - datastream_v1alpha1/types diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream/__init__.py b/owl-bot-staging/v1alpha1/google/cloud/datastream/__init__.py deleted file mode 100644 index 3e7dfdc..0000000 --- a/owl-bot-staging/v1alpha1/google/cloud/datastream/__init__.py +++ /dev/null @@ -1,153 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from google.cloud.datastream import gapic_version as package_version - -__version__ = package_version.__version__ - - -from google.cloud.datastream_v1alpha1.services.datastream.client import DatastreamClient -from google.cloud.datastream_v1alpha1.services.datastream.async_client import DatastreamAsyncClient - -from google.cloud.datastream_v1alpha1.types.datastream import CreateConnectionProfileRequest -from google.cloud.datastream_v1alpha1.types.datastream import CreatePrivateConnectionRequest -from google.cloud.datastream_v1alpha1.types.datastream import CreateRouteRequest -from google.cloud.datastream_v1alpha1.types.datastream import CreateStreamRequest -from google.cloud.datastream_v1alpha1.types.datastream import DeleteConnectionProfileRequest -from google.cloud.datastream_v1alpha1.types.datastream import DeletePrivateConnectionRequest -from google.cloud.datastream_v1alpha1.types.datastream import DeleteRouteRequest -from google.cloud.datastream_v1alpha1.types.datastream import DeleteStreamRequest -from google.cloud.datastream_v1alpha1.types.datastream import DiscoverConnectionProfileRequest -from google.cloud.datastream_v1alpha1.types.datastream import DiscoverConnectionProfileResponse -from google.cloud.datastream_v1alpha1.types.datastream import FetchErrorsRequest -from google.cloud.datastream_v1alpha1.types.datastream import FetchErrorsResponse -from google.cloud.datastream_v1alpha1.types.datastream import FetchStaticIpsRequest -from google.cloud.datastream_v1alpha1.types.datastream import FetchStaticIpsResponse -from google.cloud.datastream_v1alpha1.types.datastream import GetConnectionProfileRequest -from google.cloud.datastream_v1alpha1.types.datastream import GetPrivateConnectionRequest -from google.cloud.datastream_v1alpha1.types.datastream import GetRouteRequest -from google.cloud.datastream_v1alpha1.types.datastream import GetStreamRequest -from google.cloud.datastream_v1alpha1.types.datastream import ListConnectionProfilesRequest -from google.cloud.datastream_v1alpha1.types.datastream import ListConnectionProfilesResponse -from google.cloud.datastream_v1alpha1.types.datastream import ListPrivateConnectionsRequest -from google.cloud.datastream_v1alpha1.types.datastream import ListPrivateConnectionsResponse -from google.cloud.datastream_v1alpha1.types.datastream import ListRoutesRequest -from google.cloud.datastream_v1alpha1.types.datastream import ListRoutesResponse -from google.cloud.datastream_v1alpha1.types.datastream import ListStreamsRequest -from google.cloud.datastream_v1alpha1.types.datastream import ListStreamsResponse -from google.cloud.datastream_v1alpha1.types.datastream import OperationMetadata -from google.cloud.datastream_v1alpha1.types.datastream import UpdateConnectionProfileRequest -from google.cloud.datastream_v1alpha1.types.datastream import UpdateStreamRequest -from google.cloud.datastream_v1alpha1.types.datastream_resources import AvroFileFormat -from google.cloud.datastream_v1alpha1.types.datastream_resources import ConnectionProfile -from google.cloud.datastream_v1alpha1.types.datastream_resources import DestinationConfig -from google.cloud.datastream_v1alpha1.types.datastream_resources import Error -from google.cloud.datastream_v1alpha1.types.datastream_resources import ForwardSshTunnelConnectivity -from google.cloud.datastream_v1alpha1.types.datastream_resources import GcsDestinationConfig -from google.cloud.datastream_v1alpha1.types.datastream_resources import GcsProfile -from google.cloud.datastream_v1alpha1.types.datastream_resources import JsonFileFormat -from google.cloud.datastream_v1alpha1.types.datastream_resources import MysqlColumn -from google.cloud.datastream_v1alpha1.types.datastream_resources import MysqlDatabase -from google.cloud.datastream_v1alpha1.types.datastream_resources import MysqlProfile -from google.cloud.datastream_v1alpha1.types.datastream_resources import MysqlRdbms -from google.cloud.datastream_v1alpha1.types.datastream_resources import MysqlSourceConfig -from google.cloud.datastream_v1alpha1.types.datastream_resources import MysqlSslConfig -from google.cloud.datastream_v1alpha1.types.datastream_resources import MysqlTable -from google.cloud.datastream_v1alpha1.types.datastream_resources import NoConnectivitySettings -from google.cloud.datastream_v1alpha1.types.datastream_resources import OracleColumn -from google.cloud.datastream_v1alpha1.types.datastream_resources import OracleProfile -from google.cloud.datastream_v1alpha1.types.datastream_resources import OracleRdbms -from google.cloud.datastream_v1alpha1.types.datastream_resources import OracleSchema -from google.cloud.datastream_v1alpha1.types.datastream_resources import OracleSourceConfig -from google.cloud.datastream_v1alpha1.types.datastream_resources import OracleTable -from google.cloud.datastream_v1alpha1.types.datastream_resources import PrivateConnection -from google.cloud.datastream_v1alpha1.types.datastream_resources import PrivateConnectivity -from google.cloud.datastream_v1alpha1.types.datastream_resources import Route -from google.cloud.datastream_v1alpha1.types.datastream_resources import SourceConfig -from google.cloud.datastream_v1alpha1.types.datastream_resources import StaticServiceIpConnectivity -from google.cloud.datastream_v1alpha1.types.datastream_resources import Stream -from google.cloud.datastream_v1alpha1.types.datastream_resources import Validation -from google.cloud.datastream_v1alpha1.types.datastream_resources import ValidationMessage -from google.cloud.datastream_v1alpha1.types.datastream_resources import ValidationResult -from google.cloud.datastream_v1alpha1.types.datastream_resources import VpcPeeringConfig -from google.cloud.datastream_v1alpha1.types.datastream_resources import GcsFileFormat -from google.cloud.datastream_v1alpha1.types.datastream_resources import SchemaFileFormat - -__all__ = ('DatastreamClient', - 'DatastreamAsyncClient', - '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', - 'AvroFileFormat', - 'ConnectionProfile', - 'DestinationConfig', - 'Error', - 'ForwardSshTunnelConnectivity', - 'GcsDestinationConfig', - 'GcsProfile', - 'JsonFileFormat', - 'MysqlColumn', - 'MysqlDatabase', - 'MysqlProfile', - 'MysqlRdbms', - 'MysqlSourceConfig', - 'MysqlSslConfig', - 'MysqlTable', - 'NoConnectivitySettings', - 'OracleColumn', - 'OracleProfile', - 'OracleRdbms', - 'OracleSchema', - 'OracleSourceConfig', - 'OracleTable', - 'PrivateConnection', - 'PrivateConnectivity', - 'Route', - 'SourceConfig', - 'StaticServiceIpConnectivity', - 'Stream', - 'Validation', - 'ValidationMessage', - 'ValidationResult', - 'VpcPeeringConfig', - 'GcsFileFormat', - 'SchemaFileFormat', -) diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream/gapic_version.py b/owl-bot-staging/v1alpha1/google/cloud/datastream/gapic_version.py deleted file mode 100644 index 405b1ce..0000000 --- a/owl-bot-staging/v1alpha1/google/cloud/datastream/gapic_version.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -__version__ = "0.1.0" # {x-release-please-version} diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream/py.typed b/owl-bot-staging/v1alpha1/google/cloud/datastream/py.typed deleted file mode 100644 index 38ae0fa..0000000 --- a/owl-bot-staging/v1alpha1/google/cloud/datastream/py.typed +++ /dev/null @@ -1,2 +0,0 @@ -# Marker file for PEP 561. -# The google-cloud-datastream package uses inline types. diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/__init__.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/__init__.py deleted file mode 100644 index a071234..0000000 --- a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/__init__.py +++ /dev/null @@ -1,154 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from google.cloud.datastream_v1alpha1 import gapic_version as package_version - -__version__ = package_version.__version__ - - -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 - -__all__ = ( - 'DatastreamAsyncClient', -'AvroFileFormat', -'ConnectionProfile', -'CreateConnectionProfileRequest', -'CreatePrivateConnectionRequest', -'CreateRouteRequest', -'CreateStreamRequest', -'DatastreamClient', -'DeleteConnectionProfileRequest', -'DeletePrivateConnectionRequest', -'DeleteRouteRequest', -'DeleteStreamRequest', -'DestinationConfig', -'DiscoverConnectionProfileRequest', -'DiscoverConnectionProfileResponse', -'Error', -'FetchErrorsRequest', -'FetchErrorsResponse', -'FetchStaticIpsRequest', -'FetchStaticIpsResponse', -'ForwardSshTunnelConnectivity', -'GcsDestinationConfig', -'GcsFileFormat', -'GcsProfile', -'GetConnectionProfileRequest', -'GetPrivateConnectionRequest', -'GetRouteRequest', -'GetStreamRequest', -'JsonFileFormat', -'ListConnectionProfilesRequest', -'ListConnectionProfilesResponse', -'ListPrivateConnectionsRequest', -'ListPrivateConnectionsResponse', -'ListRoutesRequest', -'ListRoutesResponse', -'ListStreamsRequest', -'ListStreamsResponse', -'MysqlColumn', -'MysqlDatabase', -'MysqlProfile', -'MysqlRdbms', -'MysqlSourceConfig', -'MysqlSslConfig', -'MysqlTable', -'NoConnectivitySettings', -'OperationMetadata', -'OracleColumn', -'OracleProfile', -'OracleRdbms', -'OracleSchema', -'OracleSourceConfig', -'OracleTable', -'PrivateConnection', -'PrivateConnectivity', -'Route', -'SchemaFileFormat', -'SourceConfig', -'StaticServiceIpConnectivity', -'Stream', -'UpdateConnectionProfileRequest', -'UpdateStreamRequest', -'Validation', -'ValidationMessage', -'ValidationResult', -'VpcPeeringConfig', -) diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/gapic_metadata.json b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/gapic_metadata.json deleted file mode 100644 index a82501e..0000000 --- a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/gapic_metadata.json +++ /dev/null @@ -1,233 +0,0 @@ - { - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "python", - "libraryPackage": "google.cloud.datastream_v1alpha1", - "protoPackage": "google.cloud.datastream.v1alpha1", - "schema": "1.0", - "services": { - "Datastream": { - "clients": { - "grpc": { - "libraryClient": "DatastreamClient", - "rpcs": { - "CreateConnectionProfile": { - "methods": [ - "create_connection_profile" - ] - }, - "CreatePrivateConnection": { - "methods": [ - "create_private_connection" - ] - }, - "CreateRoute": { - "methods": [ - "create_route" - ] - }, - "CreateStream": { - "methods": [ - "create_stream" - ] - }, - "DeleteConnectionProfile": { - "methods": [ - "delete_connection_profile" - ] - }, - "DeletePrivateConnection": { - "methods": [ - "delete_private_connection" - ] - }, - "DeleteRoute": { - "methods": [ - "delete_route" - ] - }, - "DeleteStream": { - "methods": [ - "delete_stream" - ] - }, - "DiscoverConnectionProfile": { - "methods": [ - "discover_connection_profile" - ] - }, - "FetchErrors": { - "methods": [ - "fetch_errors" - ] - }, - "FetchStaticIps": { - "methods": [ - "fetch_static_ips" - ] - }, - "GetConnectionProfile": { - "methods": [ - "get_connection_profile" - ] - }, - "GetPrivateConnection": { - "methods": [ - "get_private_connection" - ] - }, - "GetRoute": { - "methods": [ - "get_route" - ] - }, - "GetStream": { - "methods": [ - "get_stream" - ] - }, - "ListConnectionProfiles": { - "methods": [ - "list_connection_profiles" - ] - }, - "ListPrivateConnections": { - "methods": [ - "list_private_connections" - ] - }, - "ListRoutes": { - "methods": [ - "list_routes" - ] - }, - "ListStreams": { - "methods": [ - "list_streams" - ] - }, - "UpdateConnectionProfile": { - "methods": [ - "update_connection_profile" - ] - }, - "UpdateStream": { - "methods": [ - "update_stream" - ] - } - } - }, - "grpc-async": { - "libraryClient": "DatastreamAsyncClient", - "rpcs": { - "CreateConnectionProfile": { - "methods": [ - "create_connection_profile" - ] - }, - "CreatePrivateConnection": { - "methods": [ - "create_private_connection" - ] - }, - "CreateRoute": { - "methods": [ - "create_route" - ] - }, - "CreateStream": { - "methods": [ - "create_stream" - ] - }, - "DeleteConnectionProfile": { - "methods": [ - "delete_connection_profile" - ] - }, - "DeletePrivateConnection": { - "methods": [ - "delete_private_connection" - ] - }, - "DeleteRoute": { - "methods": [ - "delete_route" - ] - }, - "DeleteStream": { - "methods": [ - "delete_stream" - ] - }, - "DiscoverConnectionProfile": { - "methods": [ - "discover_connection_profile" - ] - }, - "FetchErrors": { - "methods": [ - "fetch_errors" - ] - }, - "FetchStaticIps": { - "methods": [ - "fetch_static_ips" - ] - }, - "GetConnectionProfile": { - "methods": [ - "get_connection_profile" - ] - }, - "GetPrivateConnection": { - "methods": [ - "get_private_connection" - ] - }, - "GetRoute": { - "methods": [ - "get_route" - ] - }, - "GetStream": { - "methods": [ - "get_stream" - ] - }, - "ListConnectionProfiles": { - "methods": [ - "list_connection_profiles" - ] - }, - "ListPrivateConnections": { - "methods": [ - "list_private_connections" - ] - }, - "ListRoutes": { - "methods": [ - "list_routes" - ] - }, - "ListStreams": { - "methods": [ - "list_streams" - ] - }, - "UpdateConnectionProfile": { - "methods": [ - "update_connection_profile" - ] - }, - "UpdateStream": { - "methods": [ - "update_stream" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/gapic_version.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/gapic_version.py deleted file mode 100644 index 405b1ce..0000000 --- a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/gapic_version.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -__version__ = "0.1.0" # {x-release-please-version} diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/py.typed b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/py.typed deleted file mode 100644 index 38ae0fa..0000000 --- a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/py.typed +++ /dev/null @@ -1,2 +0,0 @@ -# Marker file for PEP 561. -# The google-cloud-datastream package uses inline types. diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/__init__.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/__init__.py deleted file mode 100644 index e8e1c38..0000000 --- a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/__init__.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/__init__.py deleted file mode 100644 index f03a8e0..0000000 --- a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from .client import DatastreamClient -from .async_client import DatastreamAsyncClient - -__all__ = ( - 'DatastreamClient', - 'DatastreamAsyncClient', -) diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/async_client.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/async_client.py deleted file mode 100644 index 9011ff9..0000000 --- a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/async_client.py +++ /dev/null @@ -1,2690 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from collections import OrderedDict -import functools -import re -from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union - -from google.cloud.datastream_v1alpha1 import gapic_version as package_version - -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.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -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 .client import DatastreamClient - - -class DatastreamAsyncClient: - """Datastream service""" - - _client: DatastreamClient - - DEFAULT_ENDPOINT = DatastreamClient.DEFAULT_ENDPOINT - DEFAULT_MTLS_ENDPOINT = DatastreamClient.DEFAULT_MTLS_ENDPOINT - - connection_profile_path = staticmethod(DatastreamClient.connection_profile_path) - parse_connection_profile_path = staticmethod(DatastreamClient.parse_connection_profile_path) - private_connection_path = staticmethod(DatastreamClient.private_connection_path) - parse_private_connection_path = staticmethod(DatastreamClient.parse_private_connection_path) - route_path = staticmethod(DatastreamClient.route_path) - parse_route_path = staticmethod(DatastreamClient.parse_route_path) - stream_path = staticmethod(DatastreamClient.stream_path) - parse_stream_path = staticmethod(DatastreamClient.parse_stream_path) - common_billing_account_path = staticmethod(DatastreamClient.common_billing_account_path) - parse_common_billing_account_path = staticmethod(DatastreamClient.parse_common_billing_account_path) - common_folder_path = staticmethod(DatastreamClient.common_folder_path) - parse_common_folder_path = staticmethod(DatastreamClient.parse_common_folder_path) - common_organization_path = staticmethod(DatastreamClient.common_organization_path) - parse_common_organization_path = staticmethod(DatastreamClient.parse_common_organization_path) - common_project_path = staticmethod(DatastreamClient.common_project_path) - parse_common_project_path = staticmethod(DatastreamClient.parse_common_project_path) - common_location_path = staticmethod(DatastreamClient.common_location_path) - parse_common_location_path = staticmethod(DatastreamClient.parse_common_location_path) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials - info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - DatastreamAsyncClient: The constructed client. - """ - return DatastreamClient.from_service_account_info.__func__(DatastreamAsyncClient, info, *args, **kwargs) # type: ignore - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - DatastreamAsyncClient: The constructed client. - """ - return DatastreamClient.from_service_account_file.__func__(DatastreamAsyncClient, filename, *args, **kwargs) # type: ignore - - from_service_account_json = from_service_account_file - - @classmethod - def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[ClientOptions] = None): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variable is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - return DatastreamClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore - - @property - def transport(self) -> DatastreamTransport: - """Returns the transport used by the client instance. - - Returns: - DatastreamTransport: The transport used by the client instance. - """ - return self._client.transport - - get_transport_class = functools.partial(type(DatastreamClient).get_transport_class, type(DatastreamClient)) - - def __init__(self, *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, DatastreamTransport] = "grpc_asyncio", - client_options: Optional[ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the datastream client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.DatastreamTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (ClientOptions): Custom options for the client. It - won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._client = DatastreamClient( - credentials=credentials, - transport=transport, - client_options=client_options, - client_info=client_info, - - ) - - async def list_connection_profiles(self, - request: Optional[Union[datastream.ListConnectionProfilesRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListConnectionProfilesAsyncPager: - r"""Use this method to list connection profiles created - in a project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - async def sample_list_connection_profiles(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.ListConnectionProfilesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_connection_profiles(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1alpha1.types.ListConnectionProfilesRequest, dict]]): - The request object. - parent (:class:`str`): - Required. The parent that owns the - collection of connection profiles. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1alpha1.services.datastream.pagers.ListConnectionProfilesAsyncPager: - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.ListConnectionProfilesRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_connection_profiles, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - 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, - ) - - # Done; return the response. - return response - - async def get_connection_profile(self, - request: Optional[Union[datastream.GetConnectionProfileRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream_resources.ConnectionProfile: - r"""Use this method to get details about a connection - profile. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - async def sample_get_connection_profile(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.GetConnectionProfileRequest( - name="name_value", - ) - - # Make the request - response = await client.get_connection_profile(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1alpha1.types.GetConnectionProfileRequest, dict]]): - The request object. - name (:class:`str`): - Required. The name of the connection - profile resource to get. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1alpha1.types.ConnectionProfile: - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.GetConnectionProfileRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_connection_profile, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def create_connection_profile(self, - request: Optional[Union[datastream.CreateConnectionProfileRequest, dict]] = None, - *, - parent: Optional[str] = None, - connection_profile: Optional[datastream_resources.ConnectionProfile] = None, - connection_profile_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Use this method to create a connection profile in a - project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - async def sample_create_connection_profile(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - connection_profile = datastream_v1alpha1.ConnectionProfile() - connection_profile.oracle_profile.hostname = "hostname_value" - connection_profile.oracle_profile.username = "username_value" - connection_profile.oracle_profile.password = "password_value" - connection_profile.oracle_profile.database_service = "database_service_value" - connection_profile.display_name = "display_name_value" - - request = datastream_v1alpha1.CreateConnectionProfileRequest( - parent="parent_value", - connection_profile_id="connection_profile_id_value", - connection_profile=connection_profile, - ) - - # Make the request - operation = client.create_connection_profile(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1alpha1.types.CreateConnectionProfileRequest, dict]]): - The request object. - parent (:class:`str`): - Required. The parent that owns the - collection of ConnectionProfiles. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - connection_profile (:class:`google.cloud.datastream_v1alpha1.types.ConnectionProfile`): - Required. The connection profile - resource to create. - - This corresponds to the ``connection_profile`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - connection_profile_id (:class:`str`): - Required. The connection profile - identifier. - - This corresponds to the ``connection_profile_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.datastream_v1alpha1.types.ConnectionProfile` - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, connection_profile, connection_profile_id]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.CreateConnectionProfileRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if connection_profile is not None: - request.connection_profile = connection_profile - if connection_profile_id is not None: - request.connection_profile_id = connection_profile_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_connection_profile, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - datastream_resources.ConnectionProfile, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - async def update_connection_profile(self, - request: Optional[Union[datastream.UpdateConnectionProfileRequest, dict]] = None, - *, - connection_profile: Optional[datastream_resources.ConnectionProfile] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Use this method to update the parameters of a - connection profile. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - async def sample_update_connection_profile(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - connection_profile = datastream_v1alpha1.ConnectionProfile() - connection_profile.oracle_profile.hostname = "hostname_value" - connection_profile.oracle_profile.username = "username_value" - connection_profile.oracle_profile.password = "password_value" - connection_profile.oracle_profile.database_service = "database_service_value" - connection_profile.display_name = "display_name_value" - - request = datastream_v1alpha1.UpdateConnectionProfileRequest( - connection_profile=connection_profile, - ) - - # Make the request - operation = client.update_connection_profile(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1alpha1.types.UpdateConnectionProfileRequest, dict]]): - The request object. - connection_profile (:class:`google.cloud.datastream_v1alpha1.types.ConnectionProfile`): - Required. The ConnectionProfile to - update. - - This corresponds to the ``connection_profile`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Optional. Field mask is used to specify the fields to be - overwritten in the ConnectionProfile resource by the - update. The fields specified in the update_mask are - relative to the resource, not the full request. A field - will be overwritten if it is in the mask. If the user - does not provide a mask then all fields will be - overwritten. - - This corresponds to the ``update_mask`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.datastream_v1alpha1.types.ConnectionProfile` - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([connection_profile, update_mask]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.UpdateConnectionProfileRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if connection_profile is not None: - request.connection_profile = connection_profile - if update_mask is not None: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_connection_profile, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("connection_profile.name", request.connection_profile.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - datastream_resources.ConnectionProfile, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - async def delete_connection_profile(self, - request: Optional[Union[datastream.DeleteConnectionProfileRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Use this method to delete a connection profile.. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - async def sample_delete_connection_profile(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.DeleteConnectionProfileRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_connection_profile(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1alpha1.types.DeleteConnectionProfileRequest, dict]]): - The request object. - name (:class:`str`): - Required. The name of the connection - profile resource to delete. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.DeleteConnectionProfileRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_connection_profile, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - empty_pb2.Empty, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - async def discover_connection_profile(self, - request: Optional[Union[datastream.DiscoverConnectionProfileRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream.DiscoverConnectionProfileResponse: - r"""Use this method to discover a connection profile. - The discover API call exposes the data objects and - metadata belonging to the profile. Typically, a request - returns children data objects under a parent data object - that's optionally supplied in the request. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - async def sample_discover_connection_profile(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - connection_profile = datastream_v1alpha1.ConnectionProfile() - connection_profile.oracle_profile.hostname = "hostname_value" - connection_profile.oracle_profile.username = "username_value" - connection_profile.oracle_profile.password = "password_value" - connection_profile.oracle_profile.database_service = "database_service_value" - connection_profile.display_name = "display_name_value" - - request = datastream_v1alpha1.DiscoverConnectionProfileRequest( - connection_profile=connection_profile, - recursive=True, - parent="parent_value", - ) - - # Make the request - response = await client.discover_connection_profile(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1alpha1.types.DiscoverConnectionProfileRequest, dict]]): - The request object. Request message for 'discover' - ConnectionProfile request. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1alpha1.types.DiscoverConnectionProfileResponse: - - """ - # Create or coerce a protobuf request object. - request = datastream.DiscoverConnectionProfileRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.discover_connection_profile, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_streams(self, - request: Optional[Union[datastream.ListStreamsRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListStreamsAsyncPager: - r"""Use this method to list streams in a project and - location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - async def sample_list_streams(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.ListStreamsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_streams(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1alpha1.types.ListStreamsRequest, dict]]): - The request object. - parent (:class:`str`): - Required. The parent that owns the - collection of streams. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1alpha1.services.datastream.pagers.ListStreamsAsyncPager: - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.ListStreamsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_streams, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - 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, - ) - - # Done; return the response. - return response - - async def get_stream(self, - request: Optional[Union[datastream.GetStreamRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream_resources.Stream: - r"""Use this method to get details about a stream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - async def sample_get_stream(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.GetStreamRequest( - name="name_value", - ) - - # Make the request - response = await client.get_stream(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1alpha1.types.GetStreamRequest, dict]]): - The request object. - name (:class:`str`): - Required. The name of the stream - resource to get. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1alpha1.types.Stream: - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.GetStreamRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_stream, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def create_stream(self, - request: Optional[Union[datastream.CreateStreamRequest, dict]] = None, - *, - parent: Optional[str] = None, - stream: Optional[datastream_resources.Stream] = None, - stream_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Use this method to create a stream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - async def sample_create_stream(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - stream = datastream_v1alpha1.Stream() - stream.display_name = "display_name_value" - stream.source_config.source_connection_profile_name = "source_connection_profile_name_value" - stream.destination_config.destination_connection_profile_name = "destination_connection_profile_name_value" - - request = datastream_v1alpha1.CreateStreamRequest( - parent="parent_value", - stream_id="stream_id_value", - stream=stream, - ) - - # Make the request - operation = client.create_stream(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1alpha1.types.CreateStreamRequest, dict]]): - The request object. - parent (:class:`str`): - Required. The parent that owns the - collection of streams. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - stream (:class:`google.cloud.datastream_v1alpha1.types.Stream`): - Required. The stream resource to - create. - - This corresponds to the ``stream`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - stream_id (:class:`str`): - Required. The stream identifier. - This corresponds to the ``stream_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.datastream_v1alpha1.types.Stream` - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, stream, stream_id]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.CreateStreamRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if stream is not None: - request.stream = stream - if stream_id is not None: - request.stream_id = stream_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_stream, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - datastream_resources.Stream, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - async def update_stream(self, - request: Optional[Union[datastream.UpdateStreamRequest, dict]] = None, - *, - stream: Optional[datastream_resources.Stream] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Use this method to update the configuration of a - stream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - async def sample_update_stream(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - stream = datastream_v1alpha1.Stream() - stream.display_name = "display_name_value" - stream.source_config.source_connection_profile_name = "source_connection_profile_name_value" - stream.destination_config.destination_connection_profile_name = "destination_connection_profile_name_value" - - request = datastream_v1alpha1.UpdateStreamRequest( - stream=stream, - ) - - # Make the request - operation = client.update_stream(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1alpha1.types.UpdateStreamRequest, dict]]): - The request object. - stream (:class:`google.cloud.datastream_v1alpha1.types.Stream`): - Required. The stream resource to - update. - - This corresponds to the ``stream`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Optional. Field mask is used to specify the fields to be - overwritten in the stream resource by the update. The - fields specified in the update_mask are relative to the - resource, not the full request. A field will be - overwritten if it is in the mask. If the user does not - provide a mask then all fields will be overwritten. - - This corresponds to the ``update_mask`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.datastream_v1alpha1.types.Stream` - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([stream, update_mask]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.UpdateStreamRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if stream is not None: - request.stream = stream - if update_mask is not None: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_stream, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("stream.name", request.stream.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - datastream_resources.Stream, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - async def delete_stream(self, - request: Optional[Union[datastream.DeleteStreamRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Use this method to delete a stream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - async def sample_delete_stream(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.DeleteStreamRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_stream(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1alpha1.types.DeleteStreamRequest, dict]]): - The request object. - name (:class:`str`): - Required. The name of the stream - resource to delete. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.DeleteStreamRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_stream, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - empty_pb2.Empty, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - async def fetch_errors(self, - request: Optional[Union[datastream.FetchErrorsRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Use this method to fetch any errors associated with a - stream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - async def sample_fetch_errors(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.FetchErrorsRequest( - ) - - # Make the request - operation = client.fetch_errors(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1alpha1.types.FetchErrorsRequest, dict]]): - The request object. Request message for 'FetchErrors' - request. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.datastream_v1alpha1.types.FetchErrorsResponse` - Response message for a 'FetchErrors' response. - - """ - # Create or coerce a protobuf request object. - request = datastream.FetchErrorsRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.fetch_errors, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("stream", request.stream), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - datastream.FetchErrorsResponse, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - async def fetch_static_ips(self, - request: Optional[Union[datastream.FetchStaticIpsRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.FetchStaticIpsAsyncPager: - r"""The FetchStaticIps API call exposes the static ips - used by Datastream. Typically, a request returns - children data objects under a parent data object that's - optionally supplied in the request. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - async def sample_fetch_static_ips(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.FetchStaticIpsRequest( - name="name_value", - ) - - # Make the request - page_result = client.fetch_static_ips(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1alpha1.types.FetchStaticIpsRequest, dict]]): - The request object. Request message for 'FetchStaticIps' - request. - name (:class:`str`): - Required. The name resource of the Response type. Must - be in the format ``projects/*/locations/*``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1alpha1.services.datastream.pagers.FetchStaticIpsAsyncPager: - Response message for a - 'FetchStaticIps' response. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.FetchStaticIpsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.fetch_static_ips, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - 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, - ) - - # Done; return the response. - return response - - async def create_private_connection(self, - request: Optional[Union[datastream.CreatePrivateConnectionRequest, dict]] = None, - *, - parent: Optional[str] = None, - private_connection: Optional[datastream_resources.PrivateConnection] = None, - private_connection_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Use this method to create a private connectivity - configuration. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - async def sample_create_private_connection(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - private_connection = datastream_v1alpha1.PrivateConnection() - private_connection.display_name = "display_name_value" - - request = datastream_v1alpha1.CreatePrivateConnectionRequest( - parent="parent_value", - private_connection_id="private_connection_id_value", - private_connection=private_connection, - ) - - # Make the request - operation = client.create_private_connection(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1alpha1.types.CreatePrivateConnectionRequest, dict]]): - The request object. - parent (:class:`str`): - Required. The parent that owns the - collection of PrivateConnections. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - private_connection (:class:`google.cloud.datastream_v1alpha1.types.PrivateConnection`): - Required. The Private Connectivity - resource to create. - - This corresponds to the ``private_connection`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - private_connection_id (:class:`str`): - Required. The private connectivity - identifier. - - This corresponds to the ``private_connection_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.datastream_v1alpha1.types.PrivateConnection` The PrivateConnection resource is used to establish private connectivity - between Datastream and a customer's network. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, private_connection, private_connection_id]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.CreatePrivateConnectionRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if private_connection is not None: - request.private_connection = private_connection - if private_connection_id is not None: - request.private_connection_id = private_connection_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_private_connection, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - datastream_resources.PrivateConnection, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - async def get_private_connection(self, - request: Optional[Union[datastream.GetPrivateConnectionRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream_resources.PrivateConnection: - r"""Use this method to get details about a private - connectivity configuration. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - async def sample_get_private_connection(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.GetPrivateConnectionRequest( - name="name_value", - ) - - # Make the request - response = await client.get_private_connection(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1alpha1.types.GetPrivateConnectionRequest, dict]]): - The request object. - name (:class:`str`): - Required. The name of the private - connectivity configuration to get. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1alpha1.types.PrivateConnection: - The PrivateConnection resource is - used to establish private connectivity - between Datastream and a customer's - network. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.GetPrivateConnectionRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_private_connection, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_private_connections(self, - request: Optional[Union[datastream.ListPrivateConnectionsRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListPrivateConnectionsAsyncPager: - r"""Use this method to list private connectivity - configurations in a project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - async def sample_list_private_connections(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.ListPrivateConnectionsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_private_connections(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1alpha1.types.ListPrivateConnectionsRequest, dict]]): - The request object. - parent (:class:`str`): - Required. The parent that owns the - collection of private connectivity - configurations. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1alpha1.services.datastream.pagers.ListPrivateConnectionsAsyncPager: - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.ListPrivateConnectionsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_private_connections, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - 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, - ) - - # Done; return the response. - return response - - async def delete_private_connection(self, - request: Optional[Union[datastream.DeletePrivateConnectionRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Use this method to delete a private connectivity - configuration. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - async def sample_delete_private_connection(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.DeletePrivateConnectionRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_private_connection(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1alpha1.types.DeletePrivateConnectionRequest, dict]]): - The request object. - name (:class:`str`): - Required. The name of the private - connectivity configuration to delete. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.DeletePrivateConnectionRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_private_connection, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - empty_pb2.Empty, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - async def create_route(self, - request: Optional[Union[datastream.CreateRouteRequest, dict]] = None, - *, - parent: Optional[str] = None, - route: Optional[datastream_resources.Route] = None, - route_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Use this method to create a route for a private - connectivity in a project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - async def sample_create_route(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - route = datastream_v1alpha1.Route() - route.display_name = "display_name_value" - route.destination_address = "destination_address_value" - - request = datastream_v1alpha1.CreateRouteRequest( - parent="parent_value", - route_id="route_id_value", - route=route, - ) - - # Make the request - operation = client.create_route(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1alpha1.types.CreateRouteRequest, dict]]): - The request object. route creation request - parent (:class:`str`): - Required. The parent that owns the - collection of Routes. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - route (:class:`google.cloud.datastream_v1alpha1.types.Route`): - Required. The Route resource to - create. - - This corresponds to the ``route`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - route_id (:class:`str`): - Required. The Route identifier. - This corresponds to the ``route_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.datastream_v1alpha1.types.Route` The Route resource is the child of the PrivateConnection resource. - It used to define a route for a PrivateConnection - setup. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, route, route_id]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.CreateRouteRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if route is not None: - request.route = route - if route_id is not None: - request.route_id = route_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_route, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - datastream_resources.Route, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - async def get_route(self, - request: Optional[Union[datastream.GetRouteRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream_resources.Route: - r"""Use this method to get details about a route. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - async def sample_get_route(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.GetRouteRequest( - name="name_value", - ) - - # Make the request - response = await client.get_route(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1alpha1.types.GetRouteRequest, dict]]): - The request object. route get request - name (:class:`str`): - Required. The name of the Route - resource to get. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1alpha1.types.Route: - The Route resource is the child of - the PrivateConnection resource. It used - to define a route for a - PrivateConnection setup. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.GetRouteRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_route, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_routes(self, - request: Optional[Union[datastream.ListRoutesRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListRoutesAsyncPager: - r"""Use this method to list routes created for a private - connectivity in a project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - async def sample_list_routes(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.ListRoutesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_routes(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1alpha1.types.ListRoutesRequest, dict]]): - The request object. route list request - parent (:class:`str`): - Required. The parent that owns the - collection of Routess. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1alpha1.services.datastream.pagers.ListRoutesAsyncPager: - route list response - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.ListRoutesRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_routes, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - 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, - ) - - # Done; return the response. - return response - - async def delete_route(self, - request: Optional[Union[datastream.DeleteRouteRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Use this method to delete a route. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - async def sample_delete_route(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.DeleteRouteRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_route(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.datastream_v1alpha1.types.DeleteRouteRequest, dict]]): - The request object. route deletion request - name (:class:`str`): - Required. The name of the Route - resource to delete. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = datastream.DeleteRouteRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_route, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - empty_pb2.Empty, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - async def __aenter__(self): - return self - - async def __aexit__(self, exc_type, exc, tb): - await self.transport.close() - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) - - -__all__ = ( - "DatastreamAsyncClient", -) diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/client.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/client.py deleted file mode 100644 index 21cae90..0000000 --- a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/client.py +++ /dev/null @@ -1,2921 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from collections import OrderedDict -import os -import re -from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union, cast - -from google.cloud.datastream_v1alpha1 import gapic_version as package_version - -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.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 - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -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 import DatastreamGrpcTransport -from .transports.grpc_asyncio import DatastreamGrpcAsyncIOTransport - - -class DatastreamClientMeta(type): - """Metaclass for the Datastream client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - _transport_registry = OrderedDict() # type: Dict[str, Type[DatastreamTransport]] - _transport_registry["grpc"] = DatastreamGrpcTransport - _transport_registry["grpc_asyncio"] = DatastreamGrpcAsyncIOTransport - - def get_transport_class(cls, - label: Optional[str] = None, - ) -> Type[DatastreamTransport]: - """Returns an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class DatastreamClient(metaclass=DatastreamClientMeta): - """Datastream service""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Converts api endpoint to mTLS endpoint. - - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "datastream.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials - info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - DatastreamClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - DatastreamClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> DatastreamTransport: - """Returns the transport used by the client instance. - - Returns: - DatastreamTransport: The transport used by the client - instance. - """ - return self._transport - - @staticmethod - def connection_profile_path(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, ) - - @staticmethod - def parse_connection_profile_path(path: str) -> Dict[str,str]: - """Parses a connection_profile path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/connectionProfiles/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def private_connection_path(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, ) - - @staticmethod - def parse_private_connection_path(path: str) -> Dict[str,str]: - """Parses a private_connection path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/privateConnections/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def route_path(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(project=project, location=location, private_connection=private_connection, route=route, ) - - @staticmethod - def parse_route_path(path: str) -> Dict[str,str]: - """Parses a route path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/privateConnections/(?P.+?)/routes/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - 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, ) - - @staticmethod - def parse_stream_path(path: str) -> Dict[str,str]: - """Parses a stream path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/streams/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - 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, ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str,str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str, ) -> str: - """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder, ) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str,str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str, ) -> str: - """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization, ) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str,str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str, ) -> str: - """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project, ) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str,str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - 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, ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str,str]: - """Parse a location path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @classmethod - def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[client_options_lib.ClientOptions] = None): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variable is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - if client_options is None: - client_options = client_options_lib.ClientOptions() - use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_client_cert not in ("true", "false"): - raise ValueError("Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`") - if use_mtls_endpoint not in ("auto", "never", "always"): - raise MutualTLSChannelError("Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`") - - # Figure out the client cert source to use. - client_cert_source = None - if use_client_cert == "true": - if client_options.client_cert_source: - client_cert_source = client_options.client_cert_source - elif mtls.has_default_client_cert_source(): - client_cert_source = mtls.default_client_cert_source() - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - elif use_mtls_endpoint == "always" or (use_mtls_endpoint == "auto" and client_cert_source): - api_endpoint = cls.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = cls.DEFAULT_ENDPOINT - - return api_endpoint, client_cert_source - - def __init__(self, *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Optional[Union[str, DatastreamTransport]] = None, - client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the datastream client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, DatastreamTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - client_options = cast(client_options_lib.ClientOptions, client_options) - - api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source(client_options) - - api_key_value = getattr(client_options, "api_key", None) - if api_key_value and credentials: - raise ValueError("client_options.api_key and credentials are mutually exclusive") - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, DatastreamTransport): - # transport is a DatastreamTransport instance. - if credentials or client_options.credentials_file or api_key_value: - raise ValueError("When providing a transport instance, " - "provide its credentials directly.") - if client_options.scopes: - raise ValueError( - "When providing a transport instance, provide its scopes " - "directly." - ) - self._transport = transport - else: - import google.auth._default # type: ignore - - if api_key_value and hasattr(google.auth._default, "get_api_key_credentials"): - credentials = google.auth._default.get_api_key_credentials(api_key_value) - - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, - credentials_file=client_options.credentials_file, - host=api_endpoint, - scopes=client_options.scopes, - client_cert_source_for_mtls=client_cert_source_func, - quota_project_id=client_options.quota_project_id, - client_info=client_info, - always_use_jwt_access=True, - api_audience=client_options.api_audience, - ) - - def list_connection_profiles(self, - request: Optional[Union[datastream.ListConnectionProfilesRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListConnectionProfilesPager: - r"""Use this method to list connection profiles created - in a project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - def sample_list_connection_profiles(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.ListConnectionProfilesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_connection_profiles(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.datastream_v1alpha1.types.ListConnectionProfilesRequest, dict]): - The request object. - parent (str): - Required. The parent that owns the - collection of connection profiles. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1alpha1.services.datastream.pagers.ListConnectionProfilesPager: - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.ListConnectionProfilesRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.ListConnectionProfilesRequest): - request = datastream.ListConnectionProfilesRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_connection_profiles] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - 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, - ) - - # Done; return the response. - return response - - def get_connection_profile(self, - request: Optional[Union[datastream.GetConnectionProfileRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream_resources.ConnectionProfile: - r"""Use this method to get details about a connection - profile. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - def sample_get_connection_profile(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.GetConnectionProfileRequest( - name="name_value", - ) - - # Make the request - response = client.get_connection_profile(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1alpha1.types.GetConnectionProfileRequest, dict]): - The request object. - name (str): - Required. The name of the connection - profile resource to get. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1alpha1.types.ConnectionProfile: - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.GetConnectionProfileRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.GetConnectionProfileRequest): - request = datastream.GetConnectionProfileRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_connection_profile] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def create_connection_profile(self, - request: Optional[Union[datastream.CreateConnectionProfileRequest, dict]] = None, - *, - parent: Optional[str] = None, - connection_profile: Optional[datastream_resources.ConnectionProfile] = None, - connection_profile_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Use this method to create a connection profile in a - project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - def sample_create_connection_profile(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - connection_profile = datastream_v1alpha1.ConnectionProfile() - connection_profile.oracle_profile.hostname = "hostname_value" - connection_profile.oracle_profile.username = "username_value" - connection_profile.oracle_profile.password = "password_value" - connection_profile.oracle_profile.database_service = "database_service_value" - connection_profile.display_name = "display_name_value" - - request = datastream_v1alpha1.CreateConnectionProfileRequest( - parent="parent_value", - connection_profile_id="connection_profile_id_value", - connection_profile=connection_profile, - ) - - # Make the request - operation = client.create_connection_profile(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1alpha1.types.CreateConnectionProfileRequest, dict]): - The request object. - parent (str): - Required. The parent that owns the - collection of ConnectionProfiles. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - connection_profile (google.cloud.datastream_v1alpha1.types.ConnectionProfile): - Required. The connection profile - resource to create. - - This corresponds to the ``connection_profile`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - connection_profile_id (str): - Required. The connection profile - identifier. - - This corresponds to the ``connection_profile_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.datastream_v1alpha1.types.ConnectionProfile` - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, connection_profile, connection_profile_id]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.CreateConnectionProfileRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.CreateConnectionProfileRequest): - request = datastream.CreateConnectionProfileRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if connection_profile is not None: - request.connection_profile = connection_profile - if connection_profile_id is not None: - request.connection_profile_id = connection_profile_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_connection_profile] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - datastream_resources.ConnectionProfile, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - def update_connection_profile(self, - request: Optional[Union[datastream.UpdateConnectionProfileRequest, dict]] = None, - *, - connection_profile: Optional[datastream_resources.ConnectionProfile] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Use this method to update the parameters of a - connection profile. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - def sample_update_connection_profile(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - connection_profile = datastream_v1alpha1.ConnectionProfile() - connection_profile.oracle_profile.hostname = "hostname_value" - connection_profile.oracle_profile.username = "username_value" - connection_profile.oracle_profile.password = "password_value" - connection_profile.oracle_profile.database_service = "database_service_value" - connection_profile.display_name = "display_name_value" - - request = datastream_v1alpha1.UpdateConnectionProfileRequest( - connection_profile=connection_profile, - ) - - # Make the request - operation = client.update_connection_profile(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1alpha1.types.UpdateConnectionProfileRequest, dict]): - The request object. - connection_profile (google.cloud.datastream_v1alpha1.types.ConnectionProfile): - Required. The ConnectionProfile to - update. - - This corresponds to the ``connection_profile`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Optional. Field mask is used to specify the fields to be - overwritten in the ConnectionProfile resource by the - update. The fields specified in the update_mask are - relative to the resource, not the full request. A field - will be overwritten if it is in the mask. If the user - does not provide a mask then all fields will be - overwritten. - - This corresponds to the ``update_mask`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.datastream_v1alpha1.types.ConnectionProfile` - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([connection_profile, update_mask]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.UpdateConnectionProfileRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.UpdateConnectionProfileRequest): - request = datastream.UpdateConnectionProfileRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if connection_profile is not None: - request.connection_profile = connection_profile - if update_mask is not None: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_connection_profile] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("connection_profile.name", request.connection_profile.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - datastream_resources.ConnectionProfile, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - def delete_connection_profile(self, - request: Optional[Union[datastream.DeleteConnectionProfileRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Use this method to delete a connection profile.. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - def sample_delete_connection_profile(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.DeleteConnectionProfileRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_connection_profile(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1alpha1.types.DeleteConnectionProfileRequest, dict]): - The request object. - name (str): - Required. The name of the connection - profile resource to delete. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.DeleteConnectionProfileRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.DeleteConnectionProfileRequest): - request = datastream.DeleteConnectionProfileRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_connection_profile] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - empty_pb2.Empty, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - def discover_connection_profile(self, - request: Optional[Union[datastream.DiscoverConnectionProfileRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream.DiscoverConnectionProfileResponse: - r"""Use this method to discover a connection profile. - The discover API call exposes the data objects and - metadata belonging to the profile. Typically, a request - returns children data objects under a parent data object - that's optionally supplied in the request. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - def sample_discover_connection_profile(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - connection_profile = datastream_v1alpha1.ConnectionProfile() - connection_profile.oracle_profile.hostname = "hostname_value" - connection_profile.oracle_profile.username = "username_value" - connection_profile.oracle_profile.password = "password_value" - connection_profile.oracle_profile.database_service = "database_service_value" - connection_profile.display_name = "display_name_value" - - request = datastream_v1alpha1.DiscoverConnectionProfileRequest( - connection_profile=connection_profile, - recursive=True, - parent="parent_value", - ) - - # Make the request - response = client.discover_connection_profile(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1alpha1.types.DiscoverConnectionProfileRequest, dict]): - The request object. Request message for 'discover' - ConnectionProfile request. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1alpha1.types.DiscoverConnectionProfileResponse: - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a datastream.DiscoverConnectionProfileRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.DiscoverConnectionProfileRequest): - request = datastream.DiscoverConnectionProfileRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.discover_connection_profile] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_streams(self, - request: Optional[Union[datastream.ListStreamsRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListStreamsPager: - r"""Use this method to list streams in a project and - location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - def sample_list_streams(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.ListStreamsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_streams(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.datastream_v1alpha1.types.ListStreamsRequest, dict]): - The request object. - parent (str): - Required. The parent that owns the - collection of streams. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1alpha1.services.datastream.pagers.ListStreamsPager: - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.ListStreamsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.ListStreamsRequest): - request = datastream.ListStreamsRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_streams] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - 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, - ) - - # Done; return the response. - return response - - def get_stream(self, - request: Optional[Union[datastream.GetStreamRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream_resources.Stream: - r"""Use this method to get details about a stream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - def sample_get_stream(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.GetStreamRequest( - name="name_value", - ) - - # Make the request - response = client.get_stream(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1alpha1.types.GetStreamRequest, dict]): - The request object. - name (str): - Required. The name of the stream - resource to get. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1alpha1.types.Stream: - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.GetStreamRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.GetStreamRequest): - request = datastream.GetStreamRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_stream] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def create_stream(self, - request: Optional[Union[datastream.CreateStreamRequest, dict]] = None, - *, - parent: Optional[str] = None, - stream: Optional[datastream_resources.Stream] = None, - stream_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Use this method to create a stream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - def sample_create_stream(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - stream = datastream_v1alpha1.Stream() - stream.display_name = "display_name_value" - stream.source_config.source_connection_profile_name = "source_connection_profile_name_value" - stream.destination_config.destination_connection_profile_name = "destination_connection_profile_name_value" - - request = datastream_v1alpha1.CreateStreamRequest( - parent="parent_value", - stream_id="stream_id_value", - stream=stream, - ) - - # Make the request - operation = client.create_stream(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1alpha1.types.CreateStreamRequest, dict]): - The request object. - parent (str): - Required. The parent that owns the - collection of streams. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - stream (google.cloud.datastream_v1alpha1.types.Stream): - Required. The stream resource to - create. - - This corresponds to the ``stream`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - stream_id (str): - Required. The stream identifier. - This corresponds to the ``stream_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.datastream_v1alpha1.types.Stream` - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, stream, stream_id]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.CreateStreamRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.CreateStreamRequest): - request = datastream.CreateStreamRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if stream is not None: - request.stream = stream - if stream_id is not None: - request.stream_id = stream_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_stream] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - datastream_resources.Stream, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - def update_stream(self, - request: Optional[Union[datastream.UpdateStreamRequest, dict]] = None, - *, - stream: Optional[datastream_resources.Stream] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Use this method to update the configuration of a - stream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - def sample_update_stream(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - stream = datastream_v1alpha1.Stream() - stream.display_name = "display_name_value" - stream.source_config.source_connection_profile_name = "source_connection_profile_name_value" - stream.destination_config.destination_connection_profile_name = "destination_connection_profile_name_value" - - request = datastream_v1alpha1.UpdateStreamRequest( - stream=stream, - ) - - # Make the request - operation = client.update_stream(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1alpha1.types.UpdateStreamRequest, dict]): - The request object. - stream (google.cloud.datastream_v1alpha1.types.Stream): - Required. The stream resource to - update. - - This corresponds to the ``stream`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Optional. Field mask is used to specify the fields to be - overwritten in the stream resource by the update. The - fields specified in the update_mask are relative to the - resource, not the full request. A field will be - overwritten if it is in the mask. If the user does not - provide a mask then all fields will be overwritten. - - This corresponds to the ``update_mask`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.datastream_v1alpha1.types.Stream` - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([stream, update_mask]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.UpdateStreamRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.UpdateStreamRequest): - request = datastream.UpdateStreamRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if stream is not None: - request.stream = stream - if update_mask is not None: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_stream] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("stream.name", request.stream.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - datastream_resources.Stream, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - def delete_stream(self, - request: Optional[Union[datastream.DeleteStreamRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Use this method to delete a stream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - def sample_delete_stream(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.DeleteStreamRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_stream(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1alpha1.types.DeleteStreamRequest, dict]): - The request object. - name (str): - Required. The name of the stream - resource to delete. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.DeleteStreamRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.DeleteStreamRequest): - request = datastream.DeleteStreamRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_stream] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - empty_pb2.Empty, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - def fetch_errors(self, - request: Optional[Union[datastream.FetchErrorsRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Use this method to fetch any errors associated with a - stream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - def sample_fetch_errors(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.FetchErrorsRequest( - ) - - # Make the request - operation = client.fetch_errors(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1alpha1.types.FetchErrorsRequest, dict]): - The request object. Request message for 'FetchErrors' - request. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.datastream_v1alpha1.types.FetchErrorsResponse` - Response message for a 'FetchErrors' response. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a datastream.FetchErrorsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.FetchErrorsRequest): - request = datastream.FetchErrorsRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.fetch_errors] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("stream", request.stream), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - datastream.FetchErrorsResponse, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - def fetch_static_ips(self, - request: Optional[Union[datastream.FetchStaticIpsRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.FetchStaticIpsPager: - r"""The FetchStaticIps API call exposes the static ips - used by Datastream. Typically, a request returns - children data objects under a parent data object that's - optionally supplied in the request. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - def sample_fetch_static_ips(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.FetchStaticIpsRequest( - name="name_value", - ) - - # Make the request - page_result = client.fetch_static_ips(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.datastream_v1alpha1.types.FetchStaticIpsRequest, dict]): - The request object. Request message for 'FetchStaticIps' - request. - name (str): - Required. The name resource of the Response type. Must - be in the format ``projects/*/locations/*``. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1alpha1.services.datastream.pagers.FetchStaticIpsPager: - Response message for a - 'FetchStaticIps' response. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.FetchStaticIpsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.FetchStaticIpsRequest): - request = datastream.FetchStaticIpsRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.fetch_static_ips] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - 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, - ) - - # Done; return the response. - return response - - def create_private_connection(self, - request: Optional[Union[datastream.CreatePrivateConnectionRequest, dict]] = None, - *, - parent: Optional[str] = None, - private_connection: Optional[datastream_resources.PrivateConnection] = None, - private_connection_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Use this method to create a private connectivity - configuration. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - def sample_create_private_connection(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - private_connection = datastream_v1alpha1.PrivateConnection() - private_connection.display_name = "display_name_value" - - request = datastream_v1alpha1.CreatePrivateConnectionRequest( - parent="parent_value", - private_connection_id="private_connection_id_value", - private_connection=private_connection, - ) - - # Make the request - operation = client.create_private_connection(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1alpha1.types.CreatePrivateConnectionRequest, dict]): - The request object. - parent (str): - Required. The parent that owns the - collection of PrivateConnections. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - private_connection (google.cloud.datastream_v1alpha1.types.PrivateConnection): - Required. The Private Connectivity - resource to create. - - This corresponds to the ``private_connection`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - private_connection_id (str): - Required. The private connectivity - identifier. - - This corresponds to the ``private_connection_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.datastream_v1alpha1.types.PrivateConnection` The PrivateConnection resource is used to establish private connectivity - between Datastream and a customer's network. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, private_connection, private_connection_id]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.CreatePrivateConnectionRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.CreatePrivateConnectionRequest): - request = datastream.CreatePrivateConnectionRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if private_connection is not None: - request.private_connection = private_connection - if private_connection_id is not None: - request.private_connection_id = private_connection_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_private_connection] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - datastream_resources.PrivateConnection, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - def get_private_connection(self, - request: Optional[Union[datastream.GetPrivateConnectionRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream_resources.PrivateConnection: - r"""Use this method to get details about a private - connectivity configuration. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - def sample_get_private_connection(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.GetPrivateConnectionRequest( - name="name_value", - ) - - # Make the request - response = client.get_private_connection(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1alpha1.types.GetPrivateConnectionRequest, dict]): - The request object. - name (str): - Required. The name of the private - connectivity configuration to get. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1alpha1.types.PrivateConnection: - The PrivateConnection resource is - used to establish private connectivity - between Datastream and a customer's - network. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.GetPrivateConnectionRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.GetPrivateConnectionRequest): - request = datastream.GetPrivateConnectionRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_private_connection] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_private_connections(self, - request: Optional[Union[datastream.ListPrivateConnectionsRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListPrivateConnectionsPager: - r"""Use this method to list private connectivity - configurations in a project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - def sample_list_private_connections(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.ListPrivateConnectionsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_private_connections(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.datastream_v1alpha1.types.ListPrivateConnectionsRequest, dict]): - The request object. - parent (str): - Required. The parent that owns the - collection of private connectivity - configurations. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1alpha1.services.datastream.pagers.ListPrivateConnectionsPager: - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.ListPrivateConnectionsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.ListPrivateConnectionsRequest): - request = datastream.ListPrivateConnectionsRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_private_connections] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - 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, - ) - - # Done; return the response. - return response - - def delete_private_connection(self, - request: Optional[Union[datastream.DeletePrivateConnectionRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Use this method to delete a private connectivity - configuration. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - def sample_delete_private_connection(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.DeletePrivateConnectionRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_private_connection(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1alpha1.types.DeletePrivateConnectionRequest, dict]): - The request object. - name (str): - Required. The name of the private - connectivity configuration to delete. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.DeletePrivateConnectionRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.DeletePrivateConnectionRequest): - request = datastream.DeletePrivateConnectionRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_private_connection] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - empty_pb2.Empty, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - def create_route(self, - request: Optional[Union[datastream.CreateRouteRequest, dict]] = None, - *, - parent: Optional[str] = None, - route: Optional[datastream_resources.Route] = None, - route_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Use this method to create a route for a private - connectivity in a project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - def sample_create_route(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - route = datastream_v1alpha1.Route() - route.display_name = "display_name_value" - route.destination_address = "destination_address_value" - - request = datastream_v1alpha1.CreateRouteRequest( - parent="parent_value", - route_id="route_id_value", - route=route, - ) - - # Make the request - operation = client.create_route(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1alpha1.types.CreateRouteRequest, dict]): - The request object. route creation request - parent (str): - Required. The parent that owns the - collection of Routes. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - route (google.cloud.datastream_v1alpha1.types.Route): - Required. The Route resource to - create. - - This corresponds to the ``route`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - route_id (str): - Required. The Route identifier. - This corresponds to the ``route_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.datastream_v1alpha1.types.Route` The Route resource is the child of the PrivateConnection resource. - It used to define a route for a PrivateConnection - setup. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, route, route_id]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.CreateRouteRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.CreateRouteRequest): - request = datastream.CreateRouteRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if route is not None: - request.route = route - if route_id is not None: - request.route_id = route_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_route] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - datastream_resources.Route, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - def get_route(self, - request: Optional[Union[datastream.GetRouteRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> datastream_resources.Route: - r"""Use this method to get details about a route. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - def sample_get_route(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.GetRouteRequest( - name="name_value", - ) - - # Make the request - response = client.get_route(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1alpha1.types.GetRouteRequest, dict]): - The request object. route get request - name (str): - Required. The name of the Route - resource to get. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1alpha1.types.Route: - The Route resource is the child of - the PrivateConnection resource. It used - to define a route for a - PrivateConnection setup. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.GetRouteRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.GetRouteRequest): - request = datastream.GetRouteRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_route] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_routes(self, - request: Optional[Union[datastream.ListRoutesRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListRoutesPager: - r"""Use this method to list routes created for a private - connectivity in a project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - def sample_list_routes(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.ListRoutesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_routes(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.datastream_v1alpha1.types.ListRoutesRequest, dict]): - The request object. route list request - parent (str): - Required. The parent that owns the - collection of Routess. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.datastream_v1alpha1.services.datastream.pagers.ListRoutesPager: - route list response - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.ListRoutesRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.ListRoutesRequest): - request = datastream.ListRoutesRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_routes] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - 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, - ) - - # Done; return the response. - return response - - def delete_route(self, - request: Optional[Union[datastream.DeleteRouteRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Use this method to delete a route. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import datastream_v1alpha1 - - def sample_delete_route(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.DeleteRouteRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_route(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.datastream_v1alpha1.types.DeleteRouteRequest, dict]): - The request object. route deletion request - name (str): - Required. The name of the Route - resource to delete. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a datastream.DeleteRouteRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, datastream.DeleteRouteRequest): - request = datastream.DeleteRouteRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_route] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - empty_pb2.Empty, - metadata_type=datastream.OperationMetadata, - ) - - # Done; return the response. - return response - - def __enter__(self) -> "DatastreamClient": - return self - - def __exit__(self, type, value, traceback): - """Releases underlying transport's resources. - - .. warning:: - ONLY use as a context manager if the transport is NOT shared - with other clients! Exiting the with block will CLOSE the transport - and may cause errors in other clients! - """ - self.transport.close() - - - - - - - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) - - -__all__ = ( - "DatastreamClient", -) diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/pagers.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/pagers.py deleted file mode 100644 index d74be17..0000000 --- a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/pagers.py +++ /dev/null @@ -1,624 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from typing import Any, AsyncIterator, Awaitable, Callable, Sequence, Tuple, Optional, Iterator - -from google.cloud.datastream_v1alpha1.types import datastream -from google.cloud.datastream_v1alpha1.types import datastream_resources - - -class ListConnectionProfilesPager: - """A pager for iterating through ``list_connection_profiles`` requests. - - This class thinly wraps an initial - :class:`google.cloud.datastream_v1alpha1.types.ListConnectionProfilesResponse` object, and - provides an ``__iter__`` method to iterate through its - ``connection_profiles`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListConnectionProfiles`` requests and continue to iterate - through the ``connection_profiles`` field on the - corresponding responses. - - All the usual :class:`google.cloud.datastream_v1alpha1.types.ListConnectionProfilesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., datastream.ListConnectionProfilesResponse], - request: datastream.ListConnectionProfilesRequest, - response: datastream.ListConnectionProfilesResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.datastream_v1alpha1.types.ListConnectionProfilesRequest): - The initial request object. - response (google.cloud.datastream_v1alpha1.types.ListConnectionProfilesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = datastream.ListConnectionProfilesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[datastream.ListConnectionProfilesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[datastream_resources.ConnectionProfile]: - for page in self.pages: - yield from page.connection_profiles - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListConnectionProfilesAsyncPager: - """A pager for iterating through ``list_connection_profiles`` requests. - - This class thinly wraps an initial - :class:`google.cloud.datastream_v1alpha1.types.ListConnectionProfilesResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``connection_profiles`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListConnectionProfiles`` requests and continue to iterate - through the ``connection_profiles`` field on the - corresponding responses. - - All the usual :class:`google.cloud.datastream_v1alpha1.types.ListConnectionProfilesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[datastream.ListConnectionProfilesResponse]], - request: datastream.ListConnectionProfilesRequest, - response: datastream.ListConnectionProfilesResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.datastream_v1alpha1.types.ListConnectionProfilesRequest): - The initial request object. - response (google.cloud.datastream_v1alpha1.types.ListConnectionProfilesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = datastream.ListConnectionProfilesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[datastream.ListConnectionProfilesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[datastream_resources.ConnectionProfile]: - async def async_generator(): - async for page in self.pages: - for response in page.connection_profiles: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListStreamsPager: - """A pager for iterating through ``list_streams`` requests. - - This class thinly wraps an initial - :class:`google.cloud.datastream_v1alpha1.types.ListStreamsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``streams`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListStreams`` requests and continue to iterate - through the ``streams`` field on the - corresponding responses. - - All the usual :class:`google.cloud.datastream_v1alpha1.types.ListStreamsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., datastream.ListStreamsResponse], - request: datastream.ListStreamsRequest, - response: datastream.ListStreamsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.datastream_v1alpha1.types.ListStreamsRequest): - The initial request object. - response (google.cloud.datastream_v1alpha1.types.ListStreamsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = datastream.ListStreamsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[datastream.ListStreamsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[datastream_resources.Stream]: - for page in self.pages: - yield from page.streams - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListStreamsAsyncPager: - """A pager for iterating through ``list_streams`` requests. - - This class thinly wraps an initial - :class:`google.cloud.datastream_v1alpha1.types.ListStreamsResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``streams`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListStreams`` requests and continue to iterate - through the ``streams`` field on the - corresponding responses. - - All the usual :class:`google.cloud.datastream_v1alpha1.types.ListStreamsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[datastream.ListStreamsResponse]], - request: datastream.ListStreamsRequest, - response: datastream.ListStreamsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.datastream_v1alpha1.types.ListStreamsRequest): - The initial request object. - response (google.cloud.datastream_v1alpha1.types.ListStreamsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = datastream.ListStreamsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[datastream.ListStreamsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[datastream_resources.Stream]: - async def async_generator(): - async for page in self.pages: - for response in page.streams: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class FetchStaticIpsPager: - """A pager for iterating through ``fetch_static_ips`` requests. - - This class thinly wraps an initial - :class:`google.cloud.datastream_v1alpha1.types.FetchStaticIpsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``static_ips`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``FetchStaticIps`` requests and continue to iterate - through the ``static_ips`` field on the - corresponding responses. - - All the usual :class:`google.cloud.datastream_v1alpha1.types.FetchStaticIpsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., datastream.FetchStaticIpsResponse], - request: datastream.FetchStaticIpsRequest, - response: datastream.FetchStaticIpsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.datastream_v1alpha1.types.FetchStaticIpsRequest): - The initial request object. - response (google.cloud.datastream_v1alpha1.types.FetchStaticIpsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = datastream.FetchStaticIpsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[datastream.FetchStaticIpsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[str]: - for page in self.pages: - yield from page.static_ips - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class FetchStaticIpsAsyncPager: - """A pager for iterating through ``fetch_static_ips`` requests. - - This class thinly wraps an initial - :class:`google.cloud.datastream_v1alpha1.types.FetchStaticIpsResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``static_ips`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``FetchStaticIps`` requests and continue to iterate - through the ``static_ips`` field on the - corresponding responses. - - All the usual :class:`google.cloud.datastream_v1alpha1.types.FetchStaticIpsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[datastream.FetchStaticIpsResponse]], - request: datastream.FetchStaticIpsRequest, - response: datastream.FetchStaticIpsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.datastream_v1alpha1.types.FetchStaticIpsRequest): - The initial request object. - response (google.cloud.datastream_v1alpha1.types.FetchStaticIpsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = datastream.FetchStaticIpsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[datastream.FetchStaticIpsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[str]: - async def async_generator(): - async for page in self.pages: - for response in page.static_ips: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListPrivateConnectionsPager: - """A pager for iterating through ``list_private_connections`` requests. - - This class thinly wraps an initial - :class:`google.cloud.datastream_v1alpha1.types.ListPrivateConnectionsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``private_connections`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListPrivateConnections`` requests and continue to iterate - through the ``private_connections`` field on the - corresponding responses. - - All the usual :class:`google.cloud.datastream_v1alpha1.types.ListPrivateConnectionsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., datastream.ListPrivateConnectionsResponse], - request: datastream.ListPrivateConnectionsRequest, - response: datastream.ListPrivateConnectionsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.datastream_v1alpha1.types.ListPrivateConnectionsRequest): - The initial request object. - response (google.cloud.datastream_v1alpha1.types.ListPrivateConnectionsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = datastream.ListPrivateConnectionsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[datastream.ListPrivateConnectionsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[datastream_resources.PrivateConnection]: - for page in self.pages: - yield from page.private_connections - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListPrivateConnectionsAsyncPager: - """A pager for iterating through ``list_private_connections`` requests. - - This class thinly wraps an initial - :class:`google.cloud.datastream_v1alpha1.types.ListPrivateConnectionsResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``private_connections`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListPrivateConnections`` requests and continue to iterate - through the ``private_connections`` field on the - corresponding responses. - - All the usual :class:`google.cloud.datastream_v1alpha1.types.ListPrivateConnectionsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[datastream.ListPrivateConnectionsResponse]], - request: datastream.ListPrivateConnectionsRequest, - response: datastream.ListPrivateConnectionsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.datastream_v1alpha1.types.ListPrivateConnectionsRequest): - The initial request object. - response (google.cloud.datastream_v1alpha1.types.ListPrivateConnectionsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = datastream.ListPrivateConnectionsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[datastream.ListPrivateConnectionsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[datastream_resources.PrivateConnection]: - async def async_generator(): - async for page in self.pages: - for response in page.private_connections: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListRoutesPager: - """A pager for iterating through ``list_routes`` requests. - - This class thinly wraps an initial - :class:`google.cloud.datastream_v1alpha1.types.ListRoutesResponse` object, and - provides an ``__iter__`` method to iterate through its - ``routes`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListRoutes`` requests and continue to iterate - through the ``routes`` field on the - corresponding responses. - - All the usual :class:`google.cloud.datastream_v1alpha1.types.ListRoutesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., datastream.ListRoutesResponse], - request: datastream.ListRoutesRequest, - response: datastream.ListRoutesResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.datastream_v1alpha1.types.ListRoutesRequest): - The initial request object. - response (google.cloud.datastream_v1alpha1.types.ListRoutesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = datastream.ListRoutesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[datastream.ListRoutesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[datastream_resources.Route]: - for page in self.pages: - yield from page.routes - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListRoutesAsyncPager: - """A pager for iterating through ``list_routes`` requests. - - This class thinly wraps an initial - :class:`google.cloud.datastream_v1alpha1.types.ListRoutesResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``routes`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListRoutes`` requests and continue to iterate - through the ``routes`` field on the - corresponding responses. - - All the usual :class:`google.cloud.datastream_v1alpha1.types.ListRoutesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[datastream.ListRoutesResponse]], - request: datastream.ListRoutesRequest, - response: datastream.ListRoutesResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.datastream_v1alpha1.types.ListRoutesRequest): - The initial request object. - response (google.cloud.datastream_v1alpha1.types.ListRoutesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = datastream.ListRoutesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[datastream.ListRoutesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[datastream_resources.Route]: - async def async_generator(): - async for page in self.pages: - for response in page.routes: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/__init__.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/__init__.py deleted file mode 100644 index 02599a2..0000000 --- a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from collections import OrderedDict -from typing import Dict, Type - -from .base import DatastreamTransport -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 -_transport_registry['grpc_asyncio'] = DatastreamGrpcAsyncIOTransport - -__all__ = ( - 'DatastreamTransport', - 'DatastreamGrpcTransport', - 'DatastreamGrpcAsyncIOTransport', -) diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/base.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/base.py deleted file mode 100644 index 3f42c0e..0000000 --- a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/base.py +++ /dev/null @@ -1,436 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import abc -from typing import Awaitable, Callable, Dict, Optional, Sequence, Union - -from google.cloud.datastream_v1alpha1 import gapic_version as package_version - -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 retry as retries -from google.api_core import operations_v1 -from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # 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 - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) - - -class DatastreamTransport(abc.ABC): - """Abstract transport class for Datastream.""" - - AUTH_SCOPES = ( - 'https://www.googleapis.com/auth/cloud-platform', - ) - - DEFAULT_HOST: str = 'datastream.googleapis.com' - def __init__( - self, *, - host: str = DEFAULT_HOST, - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - **kwargs, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is mutually exclusive with credentials. - scopes (Optional[Sequence[str]]): A list of scopes. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - """ - - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} - - # Save the scopes. - self._scopes = scopes - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials and credentials_file: - raise core_exceptions.DuplicateCredentialArgs("'credentials_file' and 'credentials' are mutually exclusive") - - if credentials_file is not None: - credentials, _ = google.auth.load_credentials_from_file( - credentials_file, - **scopes_kwargs, - quota_project_id=quota_project_id - ) - elif credentials is None: - credentials, _ = google.auth.default(**scopes_kwargs, quota_project_id=quota_project_id) - # Don't apply audience if the credentials file passed from user. - if hasattr(credentials, "with_gdch_audience"): - credentials = credentials.with_gdch_audience(api_audience if api_audience else host) - - # If the credentials are service account credentials, then always try to use self signed JWT. - if always_use_jwt_access and isinstance(credentials, service_account.Credentials) and hasattr(service_account.Credentials, "with_always_use_jwt_access"): - credentials = credentials.with_always_use_jwt_access(True) - - # Save the credentials. - self._credentials = credentials - - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ':' not in host: - host += ':443' - self._host = host - - def _prep_wrapped_messages(self, client_info): - # Precompute the wrapped methods. - self._wrapped_methods = { - self.list_connection_profiles: gapic_v1.method.wrap_method( - self.list_connection_profiles, - default_timeout=None, - client_info=client_info, - ), - self.get_connection_profile: gapic_v1.method.wrap_method( - self.get_connection_profile, - default_timeout=None, - client_info=client_info, - ), - self.create_connection_profile: gapic_v1.method.wrap_method( - self.create_connection_profile, - default_timeout=60.0, - client_info=client_info, - ), - self.update_connection_profile: gapic_v1.method.wrap_method( - self.update_connection_profile, - default_timeout=60.0, - client_info=client_info, - ), - self.delete_connection_profile: gapic_v1.method.wrap_method( - self.delete_connection_profile, - default_timeout=60.0, - client_info=client_info, - ), - self.discover_connection_profile: gapic_v1.method.wrap_method( - self.discover_connection_profile, - default_timeout=None, - client_info=client_info, - ), - self.list_streams: gapic_v1.method.wrap_method( - 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.create_stream: gapic_v1.method.wrap_method( - 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.delete_stream: gapic_v1.method.wrap_method( - 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_static_ips: gapic_v1.method.wrap_method( - self.fetch_static_ips, - default_timeout=None, - client_info=client_info, - ), - self.create_private_connection: gapic_v1.method.wrap_method( - self.create_private_connection, - default_timeout=60.0, - client_info=client_info, - ), - self.get_private_connection: gapic_v1.method.wrap_method( - self.get_private_connection, - default_timeout=None, - client_info=client_info, - ), - self.list_private_connections: gapic_v1.method.wrap_method( - self.list_private_connections, - default_timeout=None, - client_info=client_info, - ), - self.delete_private_connection: gapic_v1.method.wrap_method( - self.delete_private_connection, - default_timeout=60.0, - client_info=client_info, - ), - self.create_route: gapic_v1.method.wrap_method( - 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.list_routes: gapic_v1.method.wrap_method( - 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, - ), - } - - 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! - """ - raise NotImplementedError() - - @property - def operations_client(self): - """Return the client designed to process long-running operations.""" - raise NotImplementedError() - - @property - def list_connection_profiles(self) -> Callable[ - [datastream.ListConnectionProfilesRequest], - Union[ - datastream.ListConnectionProfilesResponse, - Awaitable[datastream.ListConnectionProfilesResponse] - ]]: - raise NotImplementedError() - - @property - def get_connection_profile(self) -> Callable[ - [datastream.GetConnectionProfileRequest], - Union[ - datastream_resources.ConnectionProfile, - Awaitable[datastream_resources.ConnectionProfile] - ]]: - raise NotImplementedError() - - @property - def create_connection_profile(self) -> Callable[ - [datastream.CreateConnectionProfileRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def update_connection_profile(self) -> Callable[ - [datastream.UpdateConnectionProfileRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def delete_connection_profile(self) -> Callable[ - [datastream.DeleteConnectionProfileRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def discover_connection_profile(self) -> Callable[ - [datastream.DiscoverConnectionProfileRequest], - Union[ - datastream.DiscoverConnectionProfileResponse, - Awaitable[datastream.DiscoverConnectionProfileResponse] - ]]: - raise NotImplementedError() - - @property - def list_streams(self) -> Callable[ - [datastream.ListStreamsRequest], - Union[ - datastream.ListStreamsResponse, - Awaitable[datastream.ListStreamsResponse] - ]]: - raise NotImplementedError() - - @property - def get_stream(self) -> Callable[ - [datastream.GetStreamRequest], - Union[ - datastream_resources.Stream, - Awaitable[datastream_resources.Stream] - ]]: - raise NotImplementedError() - - @property - def create_stream(self) -> Callable[ - [datastream.CreateStreamRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def update_stream(self) -> Callable[ - [datastream.UpdateStreamRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def delete_stream(self) -> Callable[ - [datastream.DeleteStreamRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def fetch_errors(self) -> Callable[ - [datastream.FetchErrorsRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def fetch_static_ips(self) -> Callable[ - [datastream.FetchStaticIpsRequest], - Union[ - datastream.FetchStaticIpsResponse, - Awaitable[datastream.FetchStaticIpsResponse] - ]]: - raise NotImplementedError() - - @property - def create_private_connection(self) -> Callable[ - [datastream.CreatePrivateConnectionRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def get_private_connection(self) -> Callable[ - [datastream.GetPrivateConnectionRequest], - Union[ - datastream_resources.PrivateConnection, - Awaitable[datastream_resources.PrivateConnection] - ]]: - raise NotImplementedError() - - @property - def list_private_connections(self) -> Callable[ - [datastream.ListPrivateConnectionsRequest], - Union[ - datastream.ListPrivateConnectionsResponse, - Awaitable[datastream.ListPrivateConnectionsResponse] - ]]: - raise NotImplementedError() - - @property - def delete_private_connection(self) -> Callable[ - [datastream.DeletePrivateConnectionRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def create_route(self) -> Callable[ - [datastream.CreateRouteRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def get_route(self) -> Callable[ - [datastream.GetRouteRequest], - Union[ - datastream_resources.Route, - Awaitable[datastream_resources.Route] - ]]: - raise NotImplementedError() - - @property - def list_routes(self) -> Callable[ - [datastream.ListRoutesRequest], - Union[ - datastream.ListRoutesResponse, - Awaitable[datastream.ListRoutesResponse] - ]]: - raise NotImplementedError() - - @property - def delete_route(self) -> Callable[ - [datastream.DeleteRouteRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def kind(self) -> str: - raise NotImplementedError() - - -__all__ = ( - 'DatastreamTransport', -) diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/grpc.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/grpc.py deleted file mode 100644 index 8214220..0000000 --- a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/grpc.py +++ /dev/null @@ -1,824 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple, Union - -from google.api_core import grpc_helpers -from google.api_core import operations_v1 -from google.api_core import gapic_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 - -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 - - -class DatastreamGrpcTransport(DatastreamTransport): - """gRPC backend transport for Datastream. - - Datastream service - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - _stubs: Dict[str, Callable] - - def __init__(self, *, - host: str = 'datastream.googleapis.com', - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[grpc.Channel] = None, - api_mtls_endpoint: Optional[str] = None, - client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the grpc channel. It is ignored if ``channel`` is provided. - client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): - A callback to provide client certificate bytes and private key bytes, - both in PEM format. It is used to configure a mutual TLS channel. It is - ignored if ``channel`` or ``ssl_channel_credentials`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - self._grpc_channel = None - self._ssl_channel_credentials = ssl_channel_credentials - self._stubs: Dict[str, Callable] = {} - self._operations_client: Optional[operations_v1.OperationsClient] = None - - if api_mtls_endpoint: - warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) - if client_cert_source: - warnings.warn("client_cert_source is deprecated", DeprecationWarning) - - if channel: - # Ignore credentials if a channel was passed. - credentials = False - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - - else: - if api_mtls_endpoint: - host = api_mtls_endpoint - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - self._ssl_channel_credentials = SslCredentials().ssl_credentials - - else: - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - - # The base transport sets the host, credentials and scopes - super().__init__( - host=host, - credentials=credentials, - credentials_file=credentials_file, - scopes=scopes, - quota_project_id=quota_project_id, - client_info=client_info, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @classmethod - def create_channel(cls, - host: str = 'datastream.googleapis.com', - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - host (Optional[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is mutually exclusive with credentials. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - - Raises: - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - - return grpc_helpers.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Quick check: Only create a new client if we do not already have one. - if self._operations_client is None: - self._operations_client = operations_v1.OperationsClient( - self.grpc_channel - ) - - # Return the client from cache. - return self._operations_client - - @property - def list_connection_profiles(self) -> Callable[ - [datastream.ListConnectionProfilesRequest], - datastream.ListConnectionProfilesResponse]: - r"""Return a callable for the list connection profiles method over gRPC. - - Use this method to list connection profiles created - in a project and location. - - Returns: - Callable[[~.ListConnectionProfilesRequest], - ~.ListConnectionProfilesResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_connection_profiles' not in self._stubs: - self._stubs['list_connection_profiles'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/ListConnectionProfiles', - request_serializer=datastream.ListConnectionProfilesRequest.serialize, - response_deserializer=datastream.ListConnectionProfilesResponse.deserialize, - ) - return self._stubs['list_connection_profiles'] - - @property - def get_connection_profile(self) -> Callable[ - [datastream.GetConnectionProfileRequest], - datastream_resources.ConnectionProfile]: - r"""Return a callable for the get connection profile method over gRPC. - - Use this method to get details about a connection - profile. - - Returns: - Callable[[~.GetConnectionProfileRequest], - ~.ConnectionProfile]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_connection_profile' not in self._stubs: - self._stubs['get_connection_profile'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/GetConnectionProfile', - request_serializer=datastream.GetConnectionProfileRequest.serialize, - response_deserializer=datastream_resources.ConnectionProfile.deserialize, - ) - return self._stubs['get_connection_profile'] - - @property - def create_connection_profile(self) -> Callable[ - [datastream.CreateConnectionProfileRequest], - operations_pb2.Operation]: - r"""Return a callable for the create connection profile method over gRPC. - - Use this method to create a connection profile in a - project and location. - - Returns: - Callable[[~.CreateConnectionProfileRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_connection_profile' not in self._stubs: - self._stubs['create_connection_profile'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/CreateConnectionProfile', - request_serializer=datastream.CreateConnectionProfileRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_connection_profile'] - - @property - def update_connection_profile(self) -> Callable[ - [datastream.UpdateConnectionProfileRequest], - operations_pb2.Operation]: - r"""Return a callable for the update connection profile method over gRPC. - - Use this method to update the parameters of a - connection profile. - - Returns: - Callable[[~.UpdateConnectionProfileRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_connection_profile' not in self._stubs: - self._stubs['update_connection_profile'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/UpdateConnectionProfile', - request_serializer=datastream.UpdateConnectionProfileRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['update_connection_profile'] - - @property - def delete_connection_profile(self) -> Callable[ - [datastream.DeleteConnectionProfileRequest], - operations_pb2.Operation]: - r"""Return a callable for the delete connection profile method over gRPC. - - Use this method to delete a connection profile.. - - Returns: - Callable[[~.DeleteConnectionProfileRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_connection_profile' not in self._stubs: - self._stubs['delete_connection_profile'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/DeleteConnectionProfile', - request_serializer=datastream.DeleteConnectionProfileRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['delete_connection_profile'] - - @property - def discover_connection_profile(self) -> Callable[ - [datastream.DiscoverConnectionProfileRequest], - datastream.DiscoverConnectionProfileResponse]: - r"""Return a callable for the discover connection profile method over gRPC. - - Use this method to discover a connection profile. - The discover API call exposes the data objects and - metadata belonging to the profile. Typically, a request - returns children data objects under a parent data object - that's optionally supplied in the request. - - Returns: - Callable[[~.DiscoverConnectionProfileRequest], - ~.DiscoverConnectionProfileResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'discover_connection_profile' not in self._stubs: - self._stubs['discover_connection_profile'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/DiscoverConnectionProfile', - request_serializer=datastream.DiscoverConnectionProfileRequest.serialize, - response_deserializer=datastream.DiscoverConnectionProfileResponse.deserialize, - ) - return self._stubs['discover_connection_profile'] - - @property - def list_streams(self) -> Callable[ - [datastream.ListStreamsRequest], - datastream.ListStreamsResponse]: - r"""Return a callable for the list streams method over gRPC. - - Use this method to list streams in a project and - location. - - Returns: - Callable[[~.ListStreamsRequest], - ~.ListStreamsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_streams' not in self._stubs: - self._stubs['list_streams'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/ListStreams', - request_serializer=datastream.ListStreamsRequest.serialize, - response_deserializer=datastream.ListStreamsResponse.deserialize, - ) - return self._stubs['list_streams'] - - @property - def get_stream(self) -> Callable[ - [datastream.GetStreamRequest], - datastream_resources.Stream]: - r"""Return a callable for the get stream method over gRPC. - - Use this method to get details about a stream. - - Returns: - Callable[[~.GetStreamRequest], - ~.Stream]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_stream' not in self._stubs: - self._stubs['get_stream'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/GetStream', - request_serializer=datastream.GetStreamRequest.serialize, - response_deserializer=datastream_resources.Stream.deserialize, - ) - return self._stubs['get_stream'] - - @property - def create_stream(self) -> Callable[ - [datastream.CreateStreamRequest], - operations_pb2.Operation]: - r"""Return a callable for the create stream method over gRPC. - - Use this method to create a stream. - - Returns: - Callable[[~.CreateStreamRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_stream' not in self._stubs: - self._stubs['create_stream'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/CreateStream', - request_serializer=datastream.CreateStreamRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_stream'] - - @property - def update_stream(self) -> Callable[ - [datastream.UpdateStreamRequest], - operations_pb2.Operation]: - r"""Return a callable for the update stream method over gRPC. - - Use this method to update the configuration of a - stream. - - Returns: - Callable[[~.UpdateStreamRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_stream' not in self._stubs: - self._stubs['update_stream'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/UpdateStream', - request_serializer=datastream.UpdateStreamRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['update_stream'] - - @property - def delete_stream(self) -> Callable[ - [datastream.DeleteStreamRequest], - operations_pb2.Operation]: - r"""Return a callable for the delete stream method over gRPC. - - Use this method to delete a stream. - - Returns: - Callable[[~.DeleteStreamRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_stream' not in self._stubs: - self._stubs['delete_stream'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/DeleteStream', - request_serializer=datastream.DeleteStreamRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['delete_stream'] - - @property - def fetch_errors(self) -> Callable[ - [datastream.FetchErrorsRequest], - operations_pb2.Operation]: - r"""Return a callable for the fetch errors method over gRPC. - - Use this method to fetch any errors associated with a - stream. - - Returns: - Callable[[~.FetchErrorsRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'fetch_errors' not in self._stubs: - self._stubs['fetch_errors'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/FetchErrors', - request_serializer=datastream.FetchErrorsRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['fetch_errors'] - - @property - def fetch_static_ips(self) -> Callable[ - [datastream.FetchStaticIpsRequest], - datastream.FetchStaticIpsResponse]: - r"""Return a callable for the fetch static ips method over gRPC. - - The FetchStaticIps API call exposes the static ips - used by Datastream. Typically, a request returns - children data objects under a parent data object that's - optionally supplied in the request. - - Returns: - Callable[[~.FetchStaticIpsRequest], - ~.FetchStaticIpsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'fetch_static_ips' not in self._stubs: - self._stubs['fetch_static_ips'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/FetchStaticIps', - request_serializer=datastream.FetchStaticIpsRequest.serialize, - response_deserializer=datastream.FetchStaticIpsResponse.deserialize, - ) - return self._stubs['fetch_static_ips'] - - @property - def create_private_connection(self) -> Callable[ - [datastream.CreatePrivateConnectionRequest], - operations_pb2.Operation]: - r"""Return a callable for the create private connection method over gRPC. - - Use this method to create a private connectivity - configuration. - - Returns: - Callable[[~.CreatePrivateConnectionRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_private_connection' not in self._stubs: - self._stubs['create_private_connection'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/CreatePrivateConnection', - request_serializer=datastream.CreatePrivateConnectionRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_private_connection'] - - @property - def get_private_connection(self) -> Callable[ - [datastream.GetPrivateConnectionRequest], - datastream_resources.PrivateConnection]: - r"""Return a callable for the get private connection method over gRPC. - - Use this method to get details about a private - connectivity configuration. - - Returns: - Callable[[~.GetPrivateConnectionRequest], - ~.PrivateConnection]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_private_connection' not in self._stubs: - self._stubs['get_private_connection'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/GetPrivateConnection', - request_serializer=datastream.GetPrivateConnectionRequest.serialize, - response_deserializer=datastream_resources.PrivateConnection.deserialize, - ) - return self._stubs['get_private_connection'] - - @property - def list_private_connections(self) -> Callable[ - [datastream.ListPrivateConnectionsRequest], - datastream.ListPrivateConnectionsResponse]: - r"""Return a callable for the list private connections method over gRPC. - - Use this method to list private connectivity - configurations in a project and location. - - Returns: - Callable[[~.ListPrivateConnectionsRequest], - ~.ListPrivateConnectionsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_private_connections' not in self._stubs: - self._stubs['list_private_connections'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/ListPrivateConnections', - request_serializer=datastream.ListPrivateConnectionsRequest.serialize, - response_deserializer=datastream.ListPrivateConnectionsResponse.deserialize, - ) - return self._stubs['list_private_connections'] - - @property - def delete_private_connection(self) -> Callable[ - [datastream.DeletePrivateConnectionRequest], - operations_pb2.Operation]: - r"""Return a callable for the delete private connection method over gRPC. - - Use this method to delete a private connectivity - configuration. - - Returns: - Callable[[~.DeletePrivateConnectionRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_private_connection' not in self._stubs: - self._stubs['delete_private_connection'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/DeletePrivateConnection', - request_serializer=datastream.DeletePrivateConnectionRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['delete_private_connection'] - - @property - def create_route(self) -> Callable[ - [datastream.CreateRouteRequest], - operations_pb2.Operation]: - r"""Return a callable for the create route method over gRPC. - - Use this method to create a route for a private - connectivity in a project and location. - - Returns: - Callable[[~.CreateRouteRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_route' not in self._stubs: - self._stubs['create_route'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/CreateRoute', - request_serializer=datastream.CreateRouteRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_route'] - - @property - def get_route(self) -> Callable[ - [datastream.GetRouteRequest], - datastream_resources.Route]: - r"""Return a callable for the get route method over gRPC. - - Use this method to get details about a route. - - Returns: - Callable[[~.GetRouteRequest], - ~.Route]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_route' not in self._stubs: - self._stubs['get_route'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/GetRoute', - request_serializer=datastream.GetRouteRequest.serialize, - response_deserializer=datastream_resources.Route.deserialize, - ) - return self._stubs['get_route'] - - @property - def list_routes(self) -> Callable[ - [datastream.ListRoutesRequest], - datastream.ListRoutesResponse]: - r"""Return a callable for the list routes method over gRPC. - - Use this method to list routes created for a private - connectivity in a project and location. - - Returns: - Callable[[~.ListRoutesRequest], - ~.ListRoutesResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_routes' not in self._stubs: - self._stubs['list_routes'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/ListRoutes', - request_serializer=datastream.ListRoutesRequest.serialize, - response_deserializer=datastream.ListRoutesResponse.deserialize, - ) - return self._stubs['list_routes'] - - @property - def delete_route(self) -> Callable[ - [datastream.DeleteRouteRequest], - operations_pb2.Operation]: - r"""Return a callable for the delete route method over gRPC. - - Use this method to delete a route. - - Returns: - Callable[[~.DeleteRouteRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_route' not in self._stubs: - self._stubs['delete_route'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/DeleteRoute', - request_serializer=datastream.DeleteRouteRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['delete_route'] - - def close(self): - self.grpc_channel.close() - - @property - def kind(self) -> str: - return "grpc" - - -__all__ = ( - 'DatastreamGrpcTransport', -) diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/grpc_asyncio.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/grpc_asyncio.py deleted file mode 100644 index 3f6eea2..0000000 --- a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/services/datastream/transports/grpc_asyncio.py +++ /dev/null @@ -1,823 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import warnings -from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union - -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async -from google.api_core import operations_v1 -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # 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 .grpc import DatastreamGrpcTransport - - -class DatastreamGrpcAsyncIOTransport(DatastreamTransport): - """gRPC AsyncIO backend transport for Datastream. - - Datastream service - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - _grpc_channel: aio.Channel - _stubs: Dict[str, Callable] = {} - - @classmethod - def create_channel(cls, - host: str = 'datastream.googleapis.com', - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs) -> aio.Channel: - """Create and return a gRPC AsyncIO channel object. - Args: - host (Optional[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - aio.Channel: A gRPC AsyncIO channel object. - """ - - return grpc_helpers_async.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs - ) - - def __init__(self, *, - host: str = 'datastream.googleapis.com', - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[aio.Channel] = None, - api_mtls_endpoint: Optional[str] = None, - client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - channel (Optional[aio.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the grpc channel. It is ignored if ``channel`` is provided. - client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): - A callback to provide client certificate bytes and private key bytes, - both in PEM format. It is used to configure a mutual TLS channel. It is - ignored if ``channel`` or ``ssl_channel_credentials`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - self._grpc_channel = None - self._ssl_channel_credentials = ssl_channel_credentials - self._stubs: Dict[str, Callable] = {} - self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None - - if api_mtls_endpoint: - warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) - if client_cert_source: - warnings.warn("client_cert_source is deprecated", DeprecationWarning) - - if channel: - # Ignore credentials if a channel was passed. - credentials = False - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - else: - if api_mtls_endpoint: - host = api_mtls_endpoint - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - self._ssl_channel_credentials = SslCredentials().ssl_credentials - - else: - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - - # The base transport sets the host, credentials and scopes - super().__init__( - host=host, - credentials=credentials, - credentials_file=credentials_file, - scopes=scopes, - quota_project_id=quota_project_id, - client_info=client_info, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @property - def grpc_channel(self) -> aio.Channel: - """Create the channel designed to connect to this service. - - This property caches on the instance; repeated calls return - the same channel. - """ - # Return the channel from cache. - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsAsyncClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Quick check: Only create a new client if we do not already have one. - if self._operations_client is None: - self._operations_client = operations_v1.OperationsAsyncClient( - self.grpc_channel - ) - - # Return the client from cache. - return self._operations_client - - @property - def list_connection_profiles(self) -> Callable[ - [datastream.ListConnectionProfilesRequest], - Awaitable[datastream.ListConnectionProfilesResponse]]: - r"""Return a callable for the list connection profiles method over gRPC. - - Use this method to list connection profiles created - in a project and location. - - Returns: - Callable[[~.ListConnectionProfilesRequest], - Awaitable[~.ListConnectionProfilesResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_connection_profiles' not in self._stubs: - self._stubs['list_connection_profiles'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/ListConnectionProfiles', - request_serializer=datastream.ListConnectionProfilesRequest.serialize, - response_deserializer=datastream.ListConnectionProfilesResponse.deserialize, - ) - return self._stubs['list_connection_profiles'] - - @property - def get_connection_profile(self) -> Callable[ - [datastream.GetConnectionProfileRequest], - Awaitable[datastream_resources.ConnectionProfile]]: - r"""Return a callable for the get connection profile method over gRPC. - - Use this method to get details about a connection - profile. - - Returns: - Callable[[~.GetConnectionProfileRequest], - Awaitable[~.ConnectionProfile]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_connection_profile' not in self._stubs: - self._stubs['get_connection_profile'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/GetConnectionProfile', - request_serializer=datastream.GetConnectionProfileRequest.serialize, - response_deserializer=datastream_resources.ConnectionProfile.deserialize, - ) - return self._stubs['get_connection_profile'] - - @property - def create_connection_profile(self) -> Callable[ - [datastream.CreateConnectionProfileRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the create connection profile method over gRPC. - - Use this method to create a connection profile in a - project and location. - - Returns: - Callable[[~.CreateConnectionProfileRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_connection_profile' not in self._stubs: - self._stubs['create_connection_profile'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/CreateConnectionProfile', - request_serializer=datastream.CreateConnectionProfileRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_connection_profile'] - - @property - def update_connection_profile(self) -> Callable[ - [datastream.UpdateConnectionProfileRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the update connection profile method over gRPC. - - Use this method to update the parameters of a - connection profile. - - Returns: - Callable[[~.UpdateConnectionProfileRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_connection_profile' not in self._stubs: - self._stubs['update_connection_profile'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/UpdateConnectionProfile', - request_serializer=datastream.UpdateConnectionProfileRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['update_connection_profile'] - - @property - def delete_connection_profile(self) -> Callable[ - [datastream.DeleteConnectionProfileRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the delete connection profile method over gRPC. - - Use this method to delete a connection profile.. - - Returns: - Callable[[~.DeleteConnectionProfileRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_connection_profile' not in self._stubs: - self._stubs['delete_connection_profile'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/DeleteConnectionProfile', - request_serializer=datastream.DeleteConnectionProfileRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['delete_connection_profile'] - - @property - def discover_connection_profile(self) -> Callable[ - [datastream.DiscoverConnectionProfileRequest], - Awaitable[datastream.DiscoverConnectionProfileResponse]]: - r"""Return a callable for the discover connection profile method over gRPC. - - Use this method to discover a connection profile. - The discover API call exposes the data objects and - metadata belonging to the profile. Typically, a request - returns children data objects under a parent data object - that's optionally supplied in the request. - - Returns: - Callable[[~.DiscoverConnectionProfileRequest], - Awaitable[~.DiscoverConnectionProfileResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'discover_connection_profile' not in self._stubs: - self._stubs['discover_connection_profile'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/DiscoverConnectionProfile', - request_serializer=datastream.DiscoverConnectionProfileRequest.serialize, - response_deserializer=datastream.DiscoverConnectionProfileResponse.deserialize, - ) - return self._stubs['discover_connection_profile'] - - @property - def list_streams(self) -> Callable[ - [datastream.ListStreamsRequest], - Awaitable[datastream.ListStreamsResponse]]: - r"""Return a callable for the list streams method over gRPC. - - Use this method to list streams in a project and - location. - - Returns: - Callable[[~.ListStreamsRequest], - Awaitable[~.ListStreamsResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_streams' not in self._stubs: - self._stubs['list_streams'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/ListStreams', - request_serializer=datastream.ListStreamsRequest.serialize, - response_deserializer=datastream.ListStreamsResponse.deserialize, - ) - return self._stubs['list_streams'] - - @property - def get_stream(self) -> Callable[ - [datastream.GetStreamRequest], - Awaitable[datastream_resources.Stream]]: - r"""Return a callable for the get stream method over gRPC. - - Use this method to get details about a stream. - - Returns: - Callable[[~.GetStreamRequest], - Awaitable[~.Stream]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_stream' not in self._stubs: - self._stubs['get_stream'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/GetStream', - request_serializer=datastream.GetStreamRequest.serialize, - response_deserializer=datastream_resources.Stream.deserialize, - ) - return self._stubs['get_stream'] - - @property - def create_stream(self) -> Callable[ - [datastream.CreateStreamRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the create stream method over gRPC. - - Use this method to create a stream. - - Returns: - Callable[[~.CreateStreamRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_stream' not in self._stubs: - self._stubs['create_stream'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/CreateStream', - request_serializer=datastream.CreateStreamRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_stream'] - - @property - def update_stream(self) -> Callable[ - [datastream.UpdateStreamRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the update stream method over gRPC. - - Use this method to update the configuration of a - stream. - - Returns: - Callable[[~.UpdateStreamRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_stream' not in self._stubs: - self._stubs['update_stream'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/UpdateStream', - request_serializer=datastream.UpdateStreamRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['update_stream'] - - @property - def delete_stream(self) -> Callable[ - [datastream.DeleteStreamRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the delete stream method over gRPC. - - Use this method to delete a stream. - - Returns: - Callable[[~.DeleteStreamRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_stream' not in self._stubs: - self._stubs['delete_stream'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/DeleteStream', - request_serializer=datastream.DeleteStreamRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['delete_stream'] - - @property - def fetch_errors(self) -> Callable[ - [datastream.FetchErrorsRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the fetch errors method over gRPC. - - Use this method to fetch any errors associated with a - stream. - - Returns: - Callable[[~.FetchErrorsRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'fetch_errors' not in self._stubs: - self._stubs['fetch_errors'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/FetchErrors', - request_serializer=datastream.FetchErrorsRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['fetch_errors'] - - @property - def fetch_static_ips(self) -> Callable[ - [datastream.FetchStaticIpsRequest], - Awaitable[datastream.FetchStaticIpsResponse]]: - r"""Return a callable for the fetch static ips method over gRPC. - - The FetchStaticIps API call exposes the static ips - used by Datastream. Typically, a request returns - children data objects under a parent data object that's - optionally supplied in the request. - - Returns: - Callable[[~.FetchStaticIpsRequest], - Awaitable[~.FetchStaticIpsResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'fetch_static_ips' not in self._stubs: - self._stubs['fetch_static_ips'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/FetchStaticIps', - request_serializer=datastream.FetchStaticIpsRequest.serialize, - response_deserializer=datastream.FetchStaticIpsResponse.deserialize, - ) - return self._stubs['fetch_static_ips'] - - @property - def create_private_connection(self) -> Callable[ - [datastream.CreatePrivateConnectionRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the create private connection method over gRPC. - - Use this method to create a private connectivity - configuration. - - Returns: - Callable[[~.CreatePrivateConnectionRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_private_connection' not in self._stubs: - self._stubs['create_private_connection'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/CreatePrivateConnection', - request_serializer=datastream.CreatePrivateConnectionRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_private_connection'] - - @property - def get_private_connection(self) -> Callable[ - [datastream.GetPrivateConnectionRequest], - Awaitable[datastream_resources.PrivateConnection]]: - r"""Return a callable for the get private connection method over gRPC. - - Use this method to get details about a private - connectivity configuration. - - Returns: - Callable[[~.GetPrivateConnectionRequest], - Awaitable[~.PrivateConnection]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_private_connection' not in self._stubs: - self._stubs['get_private_connection'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/GetPrivateConnection', - request_serializer=datastream.GetPrivateConnectionRequest.serialize, - response_deserializer=datastream_resources.PrivateConnection.deserialize, - ) - return self._stubs['get_private_connection'] - - @property - def list_private_connections(self) -> Callable[ - [datastream.ListPrivateConnectionsRequest], - Awaitable[datastream.ListPrivateConnectionsResponse]]: - r"""Return a callable for the list private connections method over gRPC. - - Use this method to list private connectivity - configurations in a project and location. - - Returns: - Callable[[~.ListPrivateConnectionsRequest], - Awaitable[~.ListPrivateConnectionsResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_private_connections' not in self._stubs: - self._stubs['list_private_connections'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/ListPrivateConnections', - request_serializer=datastream.ListPrivateConnectionsRequest.serialize, - response_deserializer=datastream.ListPrivateConnectionsResponse.deserialize, - ) - return self._stubs['list_private_connections'] - - @property - def delete_private_connection(self) -> Callable[ - [datastream.DeletePrivateConnectionRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the delete private connection method over gRPC. - - Use this method to delete a private connectivity - configuration. - - Returns: - Callable[[~.DeletePrivateConnectionRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_private_connection' not in self._stubs: - self._stubs['delete_private_connection'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/DeletePrivateConnection', - request_serializer=datastream.DeletePrivateConnectionRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['delete_private_connection'] - - @property - def create_route(self) -> Callable[ - [datastream.CreateRouteRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the create route method over gRPC. - - Use this method to create a route for a private - connectivity in a project and location. - - Returns: - Callable[[~.CreateRouteRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_route' not in self._stubs: - self._stubs['create_route'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/CreateRoute', - request_serializer=datastream.CreateRouteRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_route'] - - @property - def get_route(self) -> Callable[ - [datastream.GetRouteRequest], - Awaitable[datastream_resources.Route]]: - r"""Return a callable for the get route method over gRPC. - - Use this method to get details about a route. - - Returns: - Callable[[~.GetRouteRequest], - Awaitable[~.Route]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_route' not in self._stubs: - self._stubs['get_route'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/GetRoute', - request_serializer=datastream.GetRouteRequest.serialize, - response_deserializer=datastream_resources.Route.deserialize, - ) - return self._stubs['get_route'] - - @property - def list_routes(self) -> Callable[ - [datastream.ListRoutesRequest], - Awaitable[datastream.ListRoutesResponse]]: - r"""Return a callable for the list routes method over gRPC. - - Use this method to list routes created for a private - connectivity in a project and location. - - Returns: - Callable[[~.ListRoutesRequest], - Awaitable[~.ListRoutesResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_routes' not in self._stubs: - self._stubs['list_routes'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/ListRoutes', - request_serializer=datastream.ListRoutesRequest.serialize, - response_deserializer=datastream.ListRoutesResponse.deserialize, - ) - return self._stubs['list_routes'] - - @property - def delete_route(self) -> Callable[ - [datastream.DeleteRouteRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the delete route method over gRPC. - - Use this method to delete a route. - - Returns: - Callable[[~.DeleteRouteRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_route' not in self._stubs: - self._stubs['delete_route'] = self.grpc_channel.unary_unary( - '/google.cloud.datastream.v1alpha1.Datastream/DeleteRoute', - request_serializer=datastream.DeleteRouteRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['delete_route'] - - def close(self): - return self.grpc_channel.close() - - -__all__ = ( - 'DatastreamGrpcAsyncIOTransport', -) diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/types/__init__.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/types/__init__.py deleted file mode 100644 index 06aee29..0000000 --- a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/types/__init__.py +++ /dev/null @@ -1,148 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from .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 .datastream_resources import ( - AvroFileFormat, - ConnectionProfile, - DestinationConfig, - Error, - ForwardSshTunnelConnectivity, - GcsDestinationConfig, - GcsProfile, - JsonFileFormat, - MysqlColumn, - MysqlDatabase, - MysqlProfile, - MysqlRdbms, - MysqlSourceConfig, - MysqlSslConfig, - MysqlTable, - NoConnectivitySettings, - OracleColumn, - OracleProfile, - OracleRdbms, - OracleSchema, - OracleSourceConfig, - OracleTable, - PrivateConnection, - PrivateConnectivity, - Route, - SourceConfig, - StaticServiceIpConnectivity, - Stream, - Validation, - ValidationMessage, - ValidationResult, - VpcPeeringConfig, - GcsFileFormat, - SchemaFileFormat, -) - -__all__ = ( - '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', - 'AvroFileFormat', - 'ConnectionProfile', - 'DestinationConfig', - 'Error', - 'ForwardSshTunnelConnectivity', - 'GcsDestinationConfig', - 'GcsProfile', - 'JsonFileFormat', - 'MysqlColumn', - 'MysqlDatabase', - 'MysqlProfile', - 'MysqlRdbms', - 'MysqlSourceConfig', - 'MysqlSslConfig', - 'MysqlTable', - 'NoConnectivitySettings', - 'OracleColumn', - 'OracleProfile', - 'OracleRdbms', - 'OracleSchema', - 'OracleSourceConfig', - 'OracleTable', - 'PrivateConnection', - 'PrivateConnectivity', - 'Route', - 'SourceConfig', - 'StaticServiceIpConnectivity', - 'Stream', - 'Validation', - 'ValidationMessage', - 'ValidationResult', - 'VpcPeeringConfig', - 'GcsFileFormat', - 'SchemaFileFormat', -) diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/types/datastream.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/types/datastream.py deleted file mode 100644 index 826f807..0000000 --- a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/types/datastream.py +++ /dev/null @@ -1,1205 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from typing import MutableMapping, MutableSequence - -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 - - -__protobuf__ = proto.module( - package='google.cloud.datastream.v1alpha1', - manifest={ - 'DiscoverConnectionProfileRequest', - 'DiscoverConnectionProfileResponse', - 'FetchStaticIpsRequest', - 'FetchStaticIpsResponse', - 'FetchErrorsRequest', - 'FetchErrorsResponse', - 'ListConnectionProfilesRequest', - 'ListConnectionProfilesResponse', - 'GetConnectionProfileRequest', - 'CreateConnectionProfileRequest', - 'UpdateConnectionProfileRequest', - 'DeleteConnectionProfileRequest', - 'ListStreamsRequest', - 'ListStreamsResponse', - 'GetStreamRequest', - 'CreateStreamRequest', - 'UpdateStreamRequest', - 'DeleteStreamRequest', - 'OperationMetadata', - 'CreatePrivateConnectionRequest', - 'ListPrivateConnectionsRequest', - 'ListPrivateConnectionsResponse', - 'DeletePrivateConnectionRequest', - 'GetPrivateConnectionRequest', - 'CreateRouteRequest', - 'ListRoutesRequest', - 'ListRoutesResponse', - 'DeleteRouteRequest', - 'GetRouteRequest', - }, -) - - -class DiscoverConnectionProfileRequest(proto.Message): - r"""Request message for 'discover' ConnectionProfile request. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - parent (str): - Required. The parent resource of the ConnectionProfile type. - Must be in the format ``projects/*/locations/*``. - connection_profile (google.cloud.datastream_v1alpha1.types.ConnectionProfile): - An ad-hoc ConnectionProfile configuration. - - This field is a member of `oneof`_ ``target``. - connection_profile_name (str): - A reference to an existing ConnectionProfile. - - This field is a member of `oneof`_ ``target``. - recursive (bool): - Whether to retrieve the full hierarchy of - data objects (TRUE) or only the current level - (FALSE). - - This field is a member of `oneof`_ ``depth``. - recursion_depth (int): - The number of hierarchy levels below the - current level to be retrieved. - - This field is a member of `oneof`_ ``depth``. - oracle_rdbms (google.cloud.datastream_v1alpha1.types.OracleRdbms): - Oracle RDBMS to enrich with child data - objects and metadata. - - This field is a member of `oneof`_ ``data_object``. - mysql_rdbms (google.cloud.datastream_v1alpha1.types.MysqlRdbms): - MySQL RDBMS to enrich with child data objects - and metadata. - - This field is a member of `oneof`_ ``data_object``. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - connection_profile: datastream_resources.ConnectionProfile = proto.Field( - proto.MESSAGE, - number=200, - oneof='target', - message=datastream_resources.ConnectionProfile, - ) - connection_profile_name: str = proto.Field( - proto.STRING, - number=201, - oneof='target', - ) - recursive: bool = proto.Field( - proto.BOOL, - number=3, - oneof='depth', - ) - recursion_depth: int = proto.Field( - proto.INT32, - number=4, - oneof='depth', - ) - oracle_rdbms: datastream_resources.OracleRdbms = proto.Field( - proto.MESSAGE, - number=100, - oneof='data_object', - message=datastream_resources.OracleRdbms, - ) - mysql_rdbms: datastream_resources.MysqlRdbms = proto.Field( - proto.MESSAGE, - number=101, - oneof='data_object', - message=datastream_resources.MysqlRdbms, - ) - - -class DiscoverConnectionProfileResponse(proto.Message): - r""" - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - oracle_rdbms (google.cloud.datastream_v1alpha1.types.OracleRdbms): - Enriched Oracle RDBMS object. - - This field is a member of `oneof`_ ``data_object``. - mysql_rdbms (google.cloud.datastream_v1alpha1.types.MysqlRdbms): - Enriched MySQL RDBMS object. - - This field is a member of `oneof`_ ``data_object``. - """ - - oracle_rdbms: datastream_resources.OracleRdbms = proto.Field( - proto.MESSAGE, - number=100, - oneof='data_object', - message=datastream_resources.OracleRdbms, - ) - mysql_rdbms: datastream_resources.MysqlRdbms = proto.Field( - proto.MESSAGE, - number=101, - oneof='data_object', - message=datastream_resources.MysqlRdbms, - ) - - -class FetchStaticIpsRequest(proto.Message): - r"""Request message for 'FetchStaticIps' request. - - Attributes: - name (str): - Required. The name resource of the Response type. Must be in - the format ``projects/*/locations/*``. - page_size (int): - Maximum number of Ips to return, will likely - not be specified. - page_token (str): - A page token, received from a previous ``ListStaticIps`` - call. will likely not be specified. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - - -class FetchStaticIpsResponse(proto.Message): - r"""Response message for a 'FetchStaticIps' response. - - Attributes: - static_ips (MutableSequence[str]): - list of static ips by account - next_page_token (str): - A token that can be sent as ``page_token`` to retrieve the - next page. If this field is omitted, there are no subsequent - pages. - """ - - @property - def raw_page(self): - return self - - static_ips: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=1, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - - -class FetchErrorsRequest(proto.Message): - r"""Request message for 'FetchErrors' request. - - Attributes: - stream (str): - Name of the Stream resource for which to - fetch any errors. - """ - - stream: str = proto.Field( - proto.STRING, - number=1, - ) - - -class FetchErrorsResponse(proto.Message): - r"""Response message for a 'FetchErrors' response. - - Attributes: - errors (MutableSequence[google.cloud.datastream_v1alpha1.types.Error]): - The list of errors on the Stream. - """ - - errors: MutableSequence[datastream_resources.Error] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=datastream_resources.Error, - ) - - -class ListConnectionProfilesRequest(proto.Message): - r""" - - Attributes: - parent (str): - Required. The parent that owns the collection - of connection profiles. - page_size (int): - Maximum number of connection profiles to - return. If unspecified, at most 50 connection - profiles will be returned. The maximum value is - 1000; values above 1000 will be coerced to 1000. - page_token (str): - Page token received from a previous - ``ListConnectionProfiles`` call. Provide this to retrieve - the subsequent page. - - When paginating, all other parameters provided to - ``ListConnectionProfiles`` must match the call that provided - the page token. - filter (str): - Filter request. - order_by (str): - Order by fields for the result. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - filter: str = proto.Field( - proto.STRING, - number=4, - ) - order_by: str = proto.Field( - proto.STRING, - number=5, - ) - - -class ListConnectionProfilesResponse(proto.Message): - r""" - - Attributes: - connection_profiles (MutableSequence[google.cloud.datastream_v1alpha1.types.ConnectionProfile]): - List of connection profiles. - next_page_token (str): - A token, which can be sent as ``page_token`` to retrieve the - next page. If this field is omitted, there are no subsequent - pages. - unreachable (MutableSequence[str]): - Locations that could not be reached. - """ - - @property - def raw_page(self): - return self - - connection_profiles: MutableSequence[datastream_resources.ConnectionProfile] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=datastream_resources.ConnectionProfile, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - unreachable: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - - -class GetConnectionProfileRequest(proto.Message): - r""" - - Attributes: - name (str): - Required. The name of the connection profile - resource to get. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class CreateConnectionProfileRequest(proto.Message): - r""" - - Attributes: - parent (str): - Required. The parent that owns the collection - of ConnectionProfiles. - connection_profile_id (str): - Required. The connection profile identifier. - connection_profile (google.cloud.datastream_v1alpha1.types.ConnectionProfile): - Required. The connection profile resource to - create. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes since the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - connection_profile_id: str = proto.Field( - proto.STRING, - number=2, - ) - connection_profile: datastream_resources.ConnectionProfile = proto.Field( - proto.MESSAGE, - number=3, - message=datastream_resources.ConnectionProfile, - ) - request_id: str = proto.Field( - proto.STRING, - number=4, - ) - - -class UpdateConnectionProfileRequest(proto.Message): - r""" - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Optional. Field mask is used to specify the fields to be - overwritten in the ConnectionProfile resource by the update. - The fields specified in the update_mask are relative to the - resource, not the full request. A field will be overwritten - if it is in the mask. If the user does not provide a mask - then all fields will be overwritten. - connection_profile (google.cloud.datastream_v1alpha1.types.ConnectionProfile): - Required. The ConnectionProfile to update. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes since the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - update_mask: field_mask_pb2.FieldMask = proto.Field( - proto.MESSAGE, - number=1, - message=field_mask_pb2.FieldMask, - ) - connection_profile: datastream_resources.ConnectionProfile = proto.Field( - proto.MESSAGE, - number=2, - message=datastream_resources.ConnectionProfile, - ) - request_id: str = proto.Field( - proto.STRING, - number=3, - ) - - -class DeleteConnectionProfileRequest(proto.Message): - r""" - - Attributes: - name (str): - Required. The name of the connection profile - resource to delete. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes after the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - request_id: str = proto.Field( - proto.STRING, - number=2, - ) - - -class ListStreamsRequest(proto.Message): - r""" - - Attributes: - parent (str): - Required. The parent that owns the collection - of streams. - page_size (int): - Maximum number of streams to return. - If unspecified, at most 50 streams will be - returned. The maximum value is 1000; values - above 1000 will be coerced to 1000. - page_token (str): - Page token received from a previous ``ListStreams`` call. - Provide this to retrieve the subsequent page. - - When paginating, all other parameters provided to - ``ListStreams`` must match the call that provided the page - token. - filter (str): - Filter request. - order_by (str): - Order by fields for the result. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - filter: str = proto.Field( - proto.STRING, - number=4, - ) - order_by: str = proto.Field( - proto.STRING, - number=5, - ) - - -class ListStreamsResponse(proto.Message): - r""" - - Attributes: - streams (MutableSequence[google.cloud.datastream_v1alpha1.types.Stream]): - List of streams - next_page_token (str): - A token, which can be sent as ``page_token`` to retrieve the - next page. If this field is omitted, there are no subsequent - pages. - unreachable (MutableSequence[str]): - Locations that could not be reached. - """ - - @property - def raw_page(self): - return self - - streams: MutableSequence[datastream_resources.Stream] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=datastream_resources.Stream, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - unreachable: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - - -class GetStreamRequest(proto.Message): - r""" - - Attributes: - name (str): - Required. The name of the stream resource to - get. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class CreateStreamRequest(proto.Message): - r""" - - Attributes: - parent (str): - Required. The parent that owns the collection - of streams. - stream_id (str): - Required. The stream identifier. - stream (google.cloud.datastream_v1alpha1.types.Stream): - Required. The stream resource to create. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes since the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - validate_only (bool): - Optional. Only validate the stream, but do - not create any resources. The default is false. - force (bool): - Optional. Create the stream without - validating it. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - stream_id: str = proto.Field( - proto.STRING, - number=2, - ) - stream: datastream_resources.Stream = proto.Field( - proto.MESSAGE, - number=3, - message=datastream_resources.Stream, - ) - request_id: str = proto.Field( - proto.STRING, - number=4, - ) - validate_only: bool = proto.Field( - proto.BOOL, - number=5, - ) - force: bool = proto.Field( - proto.BOOL, - number=6, - ) - - -class UpdateStreamRequest(proto.Message): - r""" - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Optional. Field mask is used to specify the fields to be - overwritten in the stream resource by the update. The fields - specified in the update_mask are relative to the resource, - not the full request. A field will be overwritten if it is - in the mask. If the user does not provide a mask then all - fields will be overwritten. - stream (google.cloud.datastream_v1alpha1.types.Stream): - Required. The stream resource to update. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes since the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - validate_only (bool): - Optional. Only validate the stream with the - changes, without actually updating it. The - default is false. - force (bool): - Optional. Execute the update without - validating it. - """ - - update_mask: field_mask_pb2.FieldMask = proto.Field( - proto.MESSAGE, - number=1, - message=field_mask_pb2.FieldMask, - ) - stream: datastream_resources.Stream = proto.Field( - proto.MESSAGE, - number=2, - message=datastream_resources.Stream, - ) - request_id: str = proto.Field( - proto.STRING, - number=3, - ) - validate_only: bool = proto.Field( - proto.BOOL, - number=4, - ) - force: bool = proto.Field( - proto.BOOL, - number=5, - ) - - -class DeleteStreamRequest(proto.Message): - r""" - - Attributes: - name (str): - Required. The name of the stream resource to - delete. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes after the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - request_id: str = proto.Field( - proto.STRING, - number=2, - ) - - -class OperationMetadata(proto.Message): - r"""Represents the metadata of the long-running operation. - - Attributes: - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time the operation was - created. - end_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time the operation finished - running. - target (str): - Output only. Server-defined resource path for - the target of the operation. - verb (str): - Output only. Name of the verb executed by the - operation. - status_message (str): - Output only. Human-readable status of the - operation, if any. - requested_cancellation (bool): - Output only. Identifies whether the user has requested - cancellation of the operation. Operations that have - successfully been cancelled have [Operation.error][] value - with a [google.rpc.Status.code][google.rpc.Status.code] of - 1, corresponding to ``Code.CANCELLED``. - api_version (str): - Output only. API version used to start the - operation. - validation_result (google.cloud.datastream_v1alpha1.types.ValidationResult): - Output only. Results of executed validations - if there are any. - """ - - create_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=1, - message=timestamp_pb2.Timestamp, - ) - end_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=2, - message=timestamp_pb2.Timestamp, - ) - target: str = proto.Field( - proto.STRING, - number=3, - ) - verb: str = proto.Field( - proto.STRING, - number=4, - ) - status_message: str = proto.Field( - proto.STRING, - number=5, - ) - requested_cancellation: bool = proto.Field( - proto.BOOL, - number=6, - ) - api_version: str = proto.Field( - proto.STRING, - number=7, - ) - validation_result: datastream_resources.ValidationResult = proto.Field( - proto.MESSAGE, - number=8, - message=datastream_resources.ValidationResult, - ) - - -class CreatePrivateConnectionRequest(proto.Message): - r""" - - Attributes: - parent (str): - Required. The parent that owns the collection - of PrivateConnections. - private_connection_id (str): - Required. The private connectivity - identifier. - private_connection (google.cloud.datastream_v1alpha1.types.PrivateConnection): - Required. The Private Connectivity resource - to create. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes since the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - private_connection_id: str = proto.Field( - proto.STRING, - number=2, - ) - private_connection: datastream_resources.PrivateConnection = proto.Field( - proto.MESSAGE, - number=3, - message=datastream_resources.PrivateConnection, - ) - request_id: str = proto.Field( - proto.STRING, - number=4, - ) - - -class ListPrivateConnectionsRequest(proto.Message): - r""" - - Attributes: - parent (str): - Required. The parent that owns the collection - of private connectivity configurations. - page_size (int): - Maximum number of private connectivity - configurations to return. If unspecified, at - most 50 private connectivity configurations that - will be returned. The maximum value is 1000; - values above 1000 will be coerced to 1000. - page_token (str): - Page token received from a previous - ``ListPrivateConnections`` call. Provide this to retrieve - the subsequent page. - - When paginating, all other parameters provided to - ``ListPrivateConnections`` must match the call that provided - the page token. - filter (str): - Filter request. - order_by (str): - Order by fields for the result. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - filter: str = proto.Field( - proto.STRING, - number=4, - ) - order_by: str = proto.Field( - proto.STRING, - number=5, - ) - - -class ListPrivateConnectionsResponse(proto.Message): - r""" - - Attributes: - private_connections (MutableSequence[google.cloud.datastream_v1alpha1.types.PrivateConnection]): - List of private connectivity configurations. - next_page_token (str): - A token, which can be sent as ``page_token`` to retrieve the - next page. If this field is omitted, there are no subsequent - pages. - unreachable (MutableSequence[str]): - Locations that could not be reached. - """ - - @property - def raw_page(self): - return self - - private_connections: MutableSequence[datastream_resources.PrivateConnection] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=datastream_resources.PrivateConnection, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - unreachable: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - - -class DeletePrivateConnectionRequest(proto.Message): - r""" - - Attributes: - name (str): - Required. The name of the private - connectivity configuration to delete. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes after the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - force (bool): - Optional. If set to true, any child routes - that belong to this PrivateConnection will also - be deleted. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - request_id: str = proto.Field( - proto.STRING, - number=2, - ) - force: bool = proto.Field( - proto.BOOL, - number=3, - ) - - -class GetPrivateConnectionRequest(proto.Message): - r""" - - Attributes: - name (str): - Required. The name of the private - connectivity configuration to get. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class CreateRouteRequest(proto.Message): - r"""route creation request - - Attributes: - parent (str): - Required. The parent that owns the collection - of Routes. - route_id (str): - Required. The Route identifier. - route (google.cloud.datastream_v1alpha1.types.Route): - Required. The Route resource to create. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes since the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - route_id: str = proto.Field( - proto.STRING, - number=2, - ) - route: datastream_resources.Route = proto.Field( - proto.MESSAGE, - number=3, - message=datastream_resources.Route, - ) - request_id: str = proto.Field( - proto.STRING, - number=4, - ) - - -class ListRoutesRequest(proto.Message): - r"""route list request - - Attributes: - parent (str): - Required. The parent that owns the collection - of Routess. - page_size (int): - Maximum number of Routes to return. The - service may return fewer than this value. If - unspecified, at most 50 Routes will be returned. - The maximum value is 1000; values above 1000 - will be coerced to 1000. - page_token (str): - Page token received from a previous ``ListRoutes`` call. - Provide this to retrieve the subsequent page. - - When paginating, all other parameters provided to - ``ListRoutes`` must match the call that provided the page - token. - filter (str): - Filter request. - order_by (str): - Order by fields for the result. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - filter: str = proto.Field( - proto.STRING, - number=4, - ) - order_by: str = proto.Field( - proto.STRING, - number=5, - ) - - -class ListRoutesResponse(proto.Message): - r"""route list response - - Attributes: - routes (MutableSequence[google.cloud.datastream_v1alpha1.types.Route]): - List of Routes. - next_page_token (str): - A token, which can be sent as ``page_token`` to retrieve the - next page. If this field is omitted, there are no subsequent - pages. - unreachable (MutableSequence[str]): - Locations that could not be reached. - """ - - @property - def raw_page(self): - return self - - routes: MutableSequence[datastream_resources.Route] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=datastream_resources.Route, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - unreachable: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - - -class DeleteRouteRequest(proto.Message): - r"""route deletion request - - Attributes: - name (str): - Required. The name of the Route resource to - delete. - request_id (str): - Optional. A request ID to identify requests. - Specify a unique request ID so that if you must - retry your request, the server will know to - ignore the request if it has already been - completed. The server will guarantee that for at - least 60 minutes after the first request. - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - request_id: str = proto.Field( - proto.STRING, - number=2, - ) - - -class GetRouteRequest(proto.Message): - r"""route get request - - Attributes: - name (str): - Required. The name of the Route resource to - get. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/types/datastream_resources.py b/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/types/datastream_resources.py deleted file mode 100644 index 0c6e29b..0000000 --- a/owl-bot-staging/v1alpha1/google/cloud/datastream_v1alpha1/types/datastream_resources.py +++ /dev/null @@ -1,1413 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from typing import MutableMapping, MutableSequence - -import proto # type: ignore - -from google.protobuf import duration_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore - - -__protobuf__ = proto.module( - package='google.cloud.datastream.v1alpha1', - manifest={ - 'GcsFileFormat', - 'SchemaFileFormat', - 'OracleProfile', - 'MysqlProfile', - 'GcsProfile', - 'NoConnectivitySettings', - 'StaticServiceIpConnectivity', - 'ForwardSshTunnelConnectivity', - 'VpcPeeringConfig', - 'PrivateConnection', - 'PrivateConnectivity', - 'Route', - 'MysqlSslConfig', - 'ConnectionProfile', - 'OracleColumn', - 'OracleTable', - 'OracleSchema', - 'OracleRdbms', - 'OracleSourceConfig', - 'MysqlColumn', - 'MysqlTable', - 'MysqlDatabase', - 'MysqlRdbms', - 'MysqlSourceConfig', - 'SourceConfig', - 'AvroFileFormat', - 'JsonFileFormat', - 'GcsDestinationConfig', - 'DestinationConfig', - 'Stream', - 'Error', - 'ValidationResult', - 'Validation', - 'ValidationMessage', - }, -) - - -class GcsFileFormat(proto.Enum): - r"""File format in Cloud Storage. - - Values: - GCS_FILE_FORMAT_UNSPECIFIED (0): - Unspecified Cloud Storage file format. - AVRO (1): - Avro file format - """ - _pb_options = {'deprecated': True} - GCS_FILE_FORMAT_UNSPECIFIED = 0 - AVRO = 1 - - -class SchemaFileFormat(proto.Enum): - r"""Schema file format. - - Values: - SCHEMA_FILE_FORMAT_UNSPECIFIED (0): - Unspecified schema file format. - NO_SCHEMA_FILE (1): - Do not attach schema file. - AVRO_SCHEMA_FILE (2): - Avro schema format. - """ - SCHEMA_FILE_FORMAT_UNSPECIFIED = 0 - NO_SCHEMA_FILE = 1 - AVRO_SCHEMA_FILE = 2 - - -class OracleProfile(proto.Message): - r"""Oracle database profile. - - Attributes: - hostname (str): - Required. Hostname for the Oracle connection. - port (int): - Port for the Oracle connection, default value - is 1521. - username (str): - Required. Username for the Oracle connection. - password (str): - Required. Password for the Oracle connection. - database_service (str): - Required. Database for the Oracle connection. - connection_attributes (MutableMapping[str, str]): - Connection string attributes - """ - - hostname: str = proto.Field( - proto.STRING, - number=1, - ) - port: int = proto.Field( - proto.INT32, - number=2, - ) - username: str = proto.Field( - proto.STRING, - number=3, - ) - password: str = proto.Field( - proto.STRING, - number=4, - ) - database_service: str = proto.Field( - proto.STRING, - number=5, - ) - connection_attributes: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=6, - ) - - -class MysqlProfile(proto.Message): - r"""MySQL database profile. - - Attributes: - hostname (str): - Required. Hostname for the MySQL connection. - port (int): - Port for the MySQL connection, default value - is 3306. - username (str): - Required. Username for the MySQL connection. - password (str): - Required. Input only. Password for the MySQL - connection. - ssl_config (google.cloud.datastream_v1alpha1.types.MysqlSslConfig): - SSL configuration for the MySQL connection. - """ - - hostname: str = proto.Field( - proto.STRING, - number=1, - ) - port: int = proto.Field( - proto.INT32, - number=2, - ) - username: str = proto.Field( - proto.STRING, - number=3, - ) - password: str = proto.Field( - proto.STRING, - number=4, - ) - ssl_config: 'MysqlSslConfig' = proto.Field( - proto.MESSAGE, - number=5, - message='MysqlSslConfig', - ) - - -class GcsProfile(proto.Message): - r"""Cloud Storage bucket profile. - - Attributes: - bucket_name (str): - Required. The full project and resource path - for Cloud Storage bucket including the name. - root_path (str): - The root path inside the Cloud Storage - bucket. - """ - - bucket_name: str = proto.Field( - proto.STRING, - number=1, - ) - root_path: str = proto.Field( - proto.STRING, - number=2, - ) - - -class NoConnectivitySettings(proto.Message): - r"""No connectivity settings. - """ - - -class StaticServiceIpConnectivity(proto.Message): - r"""Static IP address connectivity. - """ - - -class ForwardSshTunnelConnectivity(proto.Message): - r"""Forward SSH Tunnel connectivity. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - hostname (str): - Required. Hostname for the SSH tunnel. - username (str): - Required. Username for the SSH tunnel. - port (int): - Port for the SSH tunnel, default value is 22. - password (str): - Input only. SSH password. - - This field is a member of `oneof`_ ``authentication_method``. - private_key (str): - Input only. SSH private key. - - This field is a member of `oneof`_ ``authentication_method``. - """ - - hostname: str = proto.Field( - proto.STRING, - number=1, - ) - username: str = proto.Field( - proto.STRING, - number=2, - ) - port: int = proto.Field( - proto.INT32, - number=3, - ) - password: str = proto.Field( - proto.STRING, - number=100, - oneof='authentication_method', - ) - private_key: str = proto.Field( - proto.STRING, - number=101, - oneof='authentication_method', - ) - - -class VpcPeeringConfig(proto.Message): - r"""The VPC Peering configuration is used to create VPC peering - between Datastream and the consumer's VPC. - - Attributes: - vpc_name (str): - Required. fully qualified name of the VPC - Datastream will peer to. - subnet (str): - Required. A free subnet for peering. (CIDR of - /29) - """ - - vpc_name: str = proto.Field( - proto.STRING, - number=1, - ) - subnet: str = proto.Field( - proto.STRING, - number=2, - ) - - -class PrivateConnection(proto.Message): - r"""The PrivateConnection resource is used to establish private - connectivity between Datastream and a customer's network. - - Attributes: - name (str): - Output only. The resource's name. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The create time of the resource. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The update time of the resource. - labels (MutableMapping[str, str]): - Labels. - display_name (str): - Required. Display name. - state (google.cloud.datastream_v1alpha1.types.PrivateConnection.State): - Output only. The state of the Private - Connection. - error (google.cloud.datastream_v1alpha1.types.Error): - Output only. In case of error, the details of - the error in a user-friendly format. - vpc_peering_config (google.cloud.datastream_v1alpha1.types.VpcPeeringConfig): - VPC Peering Config - """ - class State(proto.Enum): - r"""Private Connection state. - - Values: - STATE_UNSPECIFIED (0): - No description available. - CREATING (1): - The private connection is in creation state - - creating resources. - CREATED (2): - The private connection has been created with - all of it's resources. - FAILED (3): - The private connection creation has failed. - """ - STATE_UNSPECIFIED = 0 - CREATING = 1 - CREATED = 2 - FAILED = 3 - - name: str = proto.Field( - proto.STRING, - number=1, - ) - create_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=2, - message=timestamp_pb2.Timestamp, - ) - update_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=3, - message=timestamp_pb2.Timestamp, - ) - labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=4, - ) - display_name: str = proto.Field( - proto.STRING, - number=5, - ) - state: State = proto.Field( - proto.ENUM, - number=6, - enum=State, - ) - error: 'Error' = proto.Field( - proto.MESSAGE, - number=7, - message='Error', - ) - vpc_peering_config: 'VpcPeeringConfig' = proto.Field( - proto.MESSAGE, - number=100, - message='VpcPeeringConfig', - ) - - -class PrivateConnectivity(proto.Message): - r"""Private Connectivity - - Attributes: - private_connection_name (str): - - """ - - private_connection_name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class Route(proto.Message): - r"""The Route resource is the child of the PrivateConnection - resource. It used to define a route for a PrivateConnection - setup. - - Attributes: - name (str): - Output only. The resource's name. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The create time of the resource. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The update time of the resource. - labels (MutableMapping[str, str]): - Labels. - display_name (str): - Required. Display name. - destination_address (str): - Required. Destination address for connection - destination_port (int): - Destination port for connection - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - create_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=2, - message=timestamp_pb2.Timestamp, - ) - update_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=3, - message=timestamp_pb2.Timestamp, - ) - labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=4, - ) - display_name: str = proto.Field( - proto.STRING, - number=5, - ) - destination_address: str = proto.Field( - proto.STRING, - number=6, - ) - destination_port: int = proto.Field( - proto.INT32, - number=7, - ) - - -class MysqlSslConfig(proto.Message): - r"""MySQL SSL configuration information. - - Attributes: - client_key (str): - Input only. PEM-encoded private key associated with the - Client Certificate. If this field is used then the - 'client_certificate' and the 'ca_certificate' fields are - mandatory. - client_key_set (bool): - Output only. Indicates whether the client_key field is set. - client_certificate (str): - Input only. PEM-encoded certificate that will be used by the - replica to authenticate against the source database server. - If this field is used then the 'client_key' and the - 'ca_certificate' fields are mandatory. - client_certificate_set (bool): - Output only. Indicates whether the client_certificate field - is set. - ca_certificate (str): - Input only. PEM-encoded certificate of the CA - that signed the source database server's - certificate. - ca_certificate_set (bool): - Output only. Indicates whether the ca_certificate field is - set. - """ - - client_key: str = proto.Field( - proto.STRING, - number=11, - ) - client_key_set: bool = proto.Field( - proto.BOOL, - number=12, - ) - client_certificate: str = proto.Field( - proto.STRING, - number=13, - ) - client_certificate_set: bool = proto.Field( - proto.BOOL, - number=14, - ) - ca_certificate: str = proto.Field( - proto.STRING, - number=15, - ) - ca_certificate_set: bool = proto.Field( - proto.BOOL, - number=16, - ) - - -class ConnectionProfile(proto.Message): - r""" - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - name (str): - Output only. The resource's name. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The create time of the resource. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The update time of the resource. - labels (MutableMapping[str, str]): - Labels. - display_name (str): - Required. Display name. - oracle_profile (google.cloud.datastream_v1alpha1.types.OracleProfile): - Oracle ConnectionProfile configuration. - - This field is a member of `oneof`_ ``profile``. - gcs_profile (google.cloud.datastream_v1alpha1.types.GcsProfile): - Cloud Storage ConnectionProfile - configuration. - - This field is a member of `oneof`_ ``profile``. - mysql_profile (google.cloud.datastream_v1alpha1.types.MysqlProfile): - MySQL ConnectionProfile configuration. - - This field is a member of `oneof`_ ``profile``. - no_connectivity (google.cloud.datastream_v1alpha1.types.NoConnectivitySettings): - No connectivity option chosen. - - This field is a member of `oneof`_ ``connectivity``. - static_service_ip_connectivity (google.cloud.datastream_v1alpha1.types.StaticServiceIpConnectivity): - Static Service IP connectivity. - - This field is a member of `oneof`_ ``connectivity``. - forward_ssh_connectivity (google.cloud.datastream_v1alpha1.types.ForwardSshTunnelConnectivity): - Forward SSH tunnel connectivity. - - This field is a member of `oneof`_ ``connectivity``. - private_connectivity (google.cloud.datastream_v1alpha1.types.PrivateConnectivity): - Private connectivity. - - This field is a member of `oneof`_ ``connectivity``. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - create_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=2, - message=timestamp_pb2.Timestamp, - ) - update_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=3, - message=timestamp_pb2.Timestamp, - ) - labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=4, - ) - display_name: str = proto.Field( - proto.STRING, - number=5, - ) - oracle_profile: 'OracleProfile' = proto.Field( - proto.MESSAGE, - number=100, - oneof='profile', - message='OracleProfile', - ) - gcs_profile: 'GcsProfile' = proto.Field( - proto.MESSAGE, - number=101, - oneof='profile', - message='GcsProfile', - ) - mysql_profile: 'MysqlProfile' = proto.Field( - proto.MESSAGE, - number=102, - oneof='profile', - message='MysqlProfile', - ) - no_connectivity: 'NoConnectivitySettings' = proto.Field( - proto.MESSAGE, - number=200, - oneof='connectivity', - message='NoConnectivitySettings', - ) - static_service_ip_connectivity: 'StaticServiceIpConnectivity' = proto.Field( - proto.MESSAGE, - number=201, - oneof='connectivity', - message='StaticServiceIpConnectivity', - ) - forward_ssh_connectivity: 'ForwardSshTunnelConnectivity' = proto.Field( - proto.MESSAGE, - number=202, - oneof='connectivity', - message='ForwardSshTunnelConnectivity', - ) - private_connectivity: 'PrivateConnectivity' = proto.Field( - proto.MESSAGE, - number=203, - oneof='connectivity', - message='PrivateConnectivity', - ) - - -class OracleColumn(proto.Message): - r"""Oracle Column. - - Attributes: - column_name (str): - Column name. - data_type (str): - The Oracle data type. - length (int): - Column length. - precision (int): - Column precision. - scale (int): - Column scale. - encoding (str): - Column encoding. - primary_key (bool): - Whether or not the column represents a - primary key. - nullable (bool): - Whether or not the column can accept a null - value. - ordinal_position (int): - The ordinal position of the column in the - table. - """ - - column_name: str = proto.Field( - proto.STRING, - number=1, - ) - data_type: str = proto.Field( - proto.STRING, - number=2, - ) - length: int = proto.Field( - proto.INT32, - number=3, - ) - precision: int = proto.Field( - proto.INT32, - number=4, - ) - scale: int = proto.Field( - proto.INT32, - number=5, - ) - encoding: str = proto.Field( - proto.STRING, - number=6, - ) - primary_key: bool = proto.Field( - proto.BOOL, - number=7, - ) - nullable: bool = proto.Field( - proto.BOOL, - number=8, - ) - ordinal_position: int = proto.Field( - proto.INT32, - number=9, - ) - - -class OracleTable(proto.Message): - r"""Oracle table. - - Attributes: - table_name (str): - Table name. - oracle_columns (MutableSequence[google.cloud.datastream_v1alpha1.types.OracleColumn]): - Oracle columns in the schema. - When unspecified as part of inclue/exclude - lists, includes/excludes everything. - """ - - table_name: str = proto.Field( - proto.STRING, - number=1, - ) - oracle_columns: MutableSequence['OracleColumn'] = proto.RepeatedField( - proto.MESSAGE, - number=2, - message='OracleColumn', - ) - - -class OracleSchema(proto.Message): - r"""Oracle schema. - - Attributes: - schema_name (str): - Schema name. - oracle_tables (MutableSequence[google.cloud.datastream_v1alpha1.types.OracleTable]): - Tables in the schema. - """ - - schema_name: str = proto.Field( - proto.STRING, - number=1, - ) - oracle_tables: MutableSequence['OracleTable'] = proto.RepeatedField( - proto.MESSAGE, - number=2, - message='OracleTable', - ) - - -class OracleRdbms(proto.Message): - r"""Oracle database structure. - - Attributes: - oracle_schemas (MutableSequence[google.cloud.datastream_v1alpha1.types.OracleSchema]): - Oracle schemas/databases in the database - server. - """ - - oracle_schemas: MutableSequence['OracleSchema'] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='OracleSchema', - ) - - -class OracleSourceConfig(proto.Message): - r"""Oracle data source configuration - - Attributes: - allowlist (google.cloud.datastream_v1alpha1.types.OracleRdbms): - Oracle objects to include in the stream. - rejectlist (google.cloud.datastream_v1alpha1.types.OracleRdbms): - Oracle objects to exclude from the stream. - """ - - allowlist: 'OracleRdbms' = proto.Field( - proto.MESSAGE, - number=1, - message='OracleRdbms', - ) - rejectlist: 'OracleRdbms' = proto.Field( - proto.MESSAGE, - number=2, - message='OracleRdbms', - ) - - -class MysqlColumn(proto.Message): - r"""MySQL Column. - - Attributes: - column_name (str): - Column name. - data_type (str): - The MySQL data type. Full data types list can - be found here: - https://dev.mysql.com/doc/refman/8.0/en/data-types.html - length (int): - Column length. - collation (str): - Column collation. - primary_key (bool): - Whether or not the column represents a - primary key. - nullable (bool): - Whether or not the column can accept a null - value. - ordinal_position (int): - The ordinal position of the column in the - table. - """ - - column_name: str = proto.Field( - proto.STRING, - number=1, - ) - data_type: str = proto.Field( - proto.STRING, - number=2, - ) - length: int = proto.Field( - proto.INT32, - number=3, - ) - collation: str = proto.Field( - proto.STRING, - number=4, - ) - primary_key: bool = proto.Field( - proto.BOOL, - number=5, - ) - nullable: bool = proto.Field( - proto.BOOL, - number=6, - ) - ordinal_position: int = proto.Field( - proto.INT32, - number=7, - ) - - -class MysqlTable(proto.Message): - r"""MySQL table. - - Attributes: - table_name (str): - Table name. - mysql_columns (MutableSequence[google.cloud.datastream_v1alpha1.types.MysqlColumn]): - MySQL columns in the database. - When unspecified as part of include/exclude - lists, includes/excludes everything. - """ - - table_name: str = proto.Field( - proto.STRING, - number=1, - ) - mysql_columns: MutableSequence['MysqlColumn'] = proto.RepeatedField( - proto.MESSAGE, - number=2, - message='MysqlColumn', - ) - - -class MysqlDatabase(proto.Message): - r"""MySQL database. - - Attributes: - database_name (str): - Database name. - mysql_tables (MutableSequence[google.cloud.datastream_v1alpha1.types.MysqlTable]): - Tables in the database. - """ - - database_name: str = proto.Field( - proto.STRING, - number=1, - ) - mysql_tables: MutableSequence['MysqlTable'] = proto.RepeatedField( - proto.MESSAGE, - number=2, - message='MysqlTable', - ) - - -class MysqlRdbms(proto.Message): - r"""MySQL database structure - - Attributes: - mysql_databases (MutableSequence[google.cloud.datastream_v1alpha1.types.MysqlDatabase]): - Mysql databases on the server - """ - - mysql_databases: MutableSequence['MysqlDatabase'] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='MysqlDatabase', - ) - - -class MysqlSourceConfig(proto.Message): - r"""MySQL source configuration - - Attributes: - allowlist (google.cloud.datastream_v1alpha1.types.MysqlRdbms): - MySQL objects to retrieve from the source. - rejectlist (google.cloud.datastream_v1alpha1.types.MysqlRdbms): - MySQL objects to exclude from the stream. - """ - - allowlist: 'MysqlRdbms' = proto.Field( - proto.MESSAGE, - number=1, - message='MysqlRdbms', - ) - rejectlist: 'MysqlRdbms' = proto.Field( - proto.MESSAGE, - number=2, - message='MysqlRdbms', - ) - - -class SourceConfig(proto.Message): - r"""The configuration of the stream source. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - source_connection_profile_name (str): - Required. Source connection profile - identifier. - oracle_source_config (google.cloud.datastream_v1alpha1.types.OracleSourceConfig): - Oracle data source configuration - - This field is a member of `oneof`_ ``source_stream_config``. - mysql_source_config (google.cloud.datastream_v1alpha1.types.MysqlSourceConfig): - MySQL data source configuration - - This field is a member of `oneof`_ ``source_stream_config``. - """ - - source_connection_profile_name: str = proto.Field( - proto.STRING, - number=1, - ) - oracle_source_config: 'OracleSourceConfig' = proto.Field( - proto.MESSAGE, - number=100, - oneof='source_stream_config', - message='OracleSourceConfig', - ) - mysql_source_config: 'MysqlSourceConfig' = proto.Field( - proto.MESSAGE, - number=101, - oneof='source_stream_config', - message='MysqlSourceConfig', - ) - - -class AvroFileFormat(proto.Message): - r"""AVRO file format configuration. - """ - - -class JsonFileFormat(proto.Message): - r"""JSON file format configuration. - - Attributes: - schema_file_format (google.cloud.datastream_v1alpha1.types.SchemaFileFormat): - The schema file format along JSON data files. - compression (google.cloud.datastream_v1alpha1.types.JsonFileFormat.JsonCompression): - Compression of the loaded JSON file. - """ - class JsonCompression(proto.Enum): - r"""Json file compression. - - Values: - JSON_COMPRESSION_UNSPECIFIED (0): - Unspecified json file compression. - NO_COMPRESSION (1): - Do not compress JSON file. - GZIP (2): - Gzip compression. - """ - JSON_COMPRESSION_UNSPECIFIED = 0 - NO_COMPRESSION = 1 - GZIP = 2 - - schema_file_format: 'SchemaFileFormat' = proto.Field( - proto.ENUM, - number=1, - enum='SchemaFileFormat', - ) - compression: JsonCompression = proto.Field( - proto.ENUM, - number=2, - enum=JsonCompression, - ) - - -class GcsDestinationConfig(proto.Message): - r"""Google Cloud Storage destination configuration - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - path (str): - Path inside the Cloud Storage bucket to write - data to. - gcs_file_format (google.cloud.datastream_v1alpha1.types.GcsFileFormat): - File format that data should be written in. Deprecated field - - use file_format instead. - file_rotation_mb (int): - The maximum file size to be saved in the - bucket. - file_rotation_interval (google.protobuf.duration_pb2.Duration): - The maximum duration for which new events are - added before a file is closed and a new file is - created. - avro_file_format (google.cloud.datastream_v1alpha1.types.AvroFileFormat): - AVRO file format configuration. - - This field is a member of `oneof`_ ``file_format``. - json_file_format (google.cloud.datastream_v1alpha1.types.JsonFileFormat): - JSON file format configuration. - - This field is a member of `oneof`_ ``file_format``. - """ - - path: str = proto.Field( - proto.STRING, - number=1, - ) - gcs_file_format: 'GcsFileFormat' = proto.Field( - proto.ENUM, - number=2, - enum='GcsFileFormat', - ) - file_rotation_mb: int = proto.Field( - proto.INT32, - number=3, - ) - file_rotation_interval: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=4, - message=duration_pb2.Duration, - ) - avro_file_format: 'AvroFileFormat' = proto.Field( - proto.MESSAGE, - number=100, - oneof='file_format', - message='AvroFileFormat', - ) - json_file_format: 'JsonFileFormat' = proto.Field( - proto.MESSAGE, - number=101, - oneof='file_format', - message='JsonFileFormat', - ) - - -class DestinationConfig(proto.Message): - r"""The configuration of the stream destination. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - destination_connection_profile_name (str): - Required. Destination connection profile - identifier. - gcs_destination_config (google.cloud.datastream_v1alpha1.types.GcsDestinationConfig): - - This field is a member of `oneof`_ ``destination_stream_config``. - """ - - destination_connection_profile_name: str = proto.Field( - proto.STRING, - number=1, - ) - gcs_destination_config: 'GcsDestinationConfig' = proto.Field( - proto.MESSAGE, - number=100, - oneof='destination_stream_config', - message='GcsDestinationConfig', - ) - - -class Stream(proto.Message): - r""" - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - name (str): - Output only. The stream's name. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The creation time of the stream. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The last update time of the - stream. - labels (MutableMapping[str, str]): - Labels. - display_name (str): - Required. Display name. - source_config (google.cloud.datastream_v1alpha1.types.SourceConfig): - Required. Source connection profile - configuration. - destination_config (google.cloud.datastream_v1alpha1.types.DestinationConfig): - Required. Destination connection profile - configuration. - state (google.cloud.datastream_v1alpha1.types.Stream.State): - The state of the stream. - backfill_all (google.cloud.datastream_v1alpha1.types.Stream.BackfillAllStrategy): - Automatically backfill objects included in - the stream source configuration. Specific - objects can be excluded. - - This field is a member of `oneof`_ ``backfill_strategy``. - backfill_none (google.cloud.datastream_v1alpha1.types.Stream.BackfillNoneStrategy): - Do not automatically backfill any objects. - - This field is a member of `oneof`_ ``backfill_strategy``. - errors (MutableSequence[google.cloud.datastream_v1alpha1.types.Error]): - Output only. Errors on the Stream. - """ - class State(proto.Enum): - r"""Stream state. - - Values: - STATE_UNSPECIFIED (0): - Unspecified stream state. - CREATED (1): - The stream has been created. - RUNNING (2): - The stream is running. - PAUSED (3): - The stream is paused. - MAINTENANCE (4): - The stream is in maintenance mode. - Updates are rejected on the resource in this - state. - FAILED (5): - The stream is experiencing an error that is - preventing data from being streamed. - FAILED_PERMANENTLY (6): - The stream has experienced a terminal - failure. - STARTING (7): - The stream is starting, but not yet running. - DRAINING (8): - The Stream is no longer reading new events, - but still writing events in the buffer. - """ - STATE_UNSPECIFIED = 0 - CREATED = 1 - RUNNING = 2 - PAUSED = 3 - MAINTENANCE = 4 - FAILED = 5 - FAILED_PERMANENTLY = 6 - STARTING = 7 - DRAINING = 8 - - class BackfillAllStrategy(proto.Message): - r"""Backfill strategy to automatically backfill the Stream's - objects. Specific objects can be excluded. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - oracle_excluded_objects (google.cloud.datastream_v1alpha1.types.OracleRdbms): - Oracle data source objects to avoid - backfilling. - - This field is a member of `oneof`_ ``excluded_objects``. - mysql_excluded_objects (google.cloud.datastream_v1alpha1.types.MysqlRdbms): - MySQL data source objects to avoid - backfilling. - - This field is a member of `oneof`_ ``excluded_objects``. - """ - - oracle_excluded_objects: 'OracleRdbms' = proto.Field( - proto.MESSAGE, - number=1, - oneof='excluded_objects', - message='OracleRdbms', - ) - mysql_excluded_objects: 'MysqlRdbms' = proto.Field( - proto.MESSAGE, - number=2, - oneof='excluded_objects', - message='MysqlRdbms', - ) - - class BackfillNoneStrategy(proto.Message): - r"""Backfill strategy to disable automatic backfill for the - Stream's objects. - - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - create_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=2, - message=timestamp_pb2.Timestamp, - ) - update_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=3, - message=timestamp_pb2.Timestamp, - ) - labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=4, - ) - display_name: str = proto.Field( - proto.STRING, - number=5, - ) - source_config: 'SourceConfig' = proto.Field( - proto.MESSAGE, - number=6, - message='SourceConfig', - ) - destination_config: 'DestinationConfig' = proto.Field( - proto.MESSAGE, - number=7, - message='DestinationConfig', - ) - state: State = proto.Field( - proto.ENUM, - number=8, - enum=State, - ) - backfill_all: BackfillAllStrategy = proto.Field( - proto.MESSAGE, - number=101, - oneof='backfill_strategy', - message=BackfillAllStrategy, - ) - backfill_none: BackfillNoneStrategy = proto.Field( - proto.MESSAGE, - number=102, - oneof='backfill_strategy', - message=BackfillNoneStrategy, - ) - errors: MutableSequence['Error'] = proto.RepeatedField( - proto.MESSAGE, - number=9, - message='Error', - ) - - -class Error(proto.Message): - r"""Represent a user-facing Error. - - Attributes: - reason (str): - A title that explains the reason for the - error. - error_uuid (str): - A unique identifier for this specific error, - allowing it to be traced throughout the system - in logs and API responses. - message (str): - A message containing more information about - the error that occurred. - error_time (google.protobuf.timestamp_pb2.Timestamp): - The time when the error occurred. - details (MutableMapping[str, str]): - Additional information about the error. - """ - - reason: str = proto.Field( - proto.STRING, - number=1, - ) - error_uuid: str = proto.Field( - proto.STRING, - number=2, - ) - message: str = proto.Field( - proto.STRING, - number=3, - ) - error_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=4, - message=timestamp_pb2.Timestamp, - ) - details: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=5, - ) - - -class ValidationResult(proto.Message): - r"""Contains the current validation results. - - Attributes: - validations (MutableSequence[google.cloud.datastream_v1alpha1.types.Validation]): - A list of validations (includes both executed - as well as not executed validations). - """ - - validations: MutableSequence['Validation'] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='Validation', - ) - - -class Validation(proto.Message): - r""" - - Attributes: - description (str): - A short description of the validation. - status (google.cloud.datastream_v1alpha1.types.Validation.Status): - Validation execution status. - message (MutableSequence[google.cloud.datastream_v1alpha1.types.ValidationMessage]): - Messages reflecting the validation results. - code (str): - A custom code identifying this validation. - """ - class Status(proto.Enum): - r"""Validation execution status. - - Values: - STATUS_UNSPECIFIED (0): - Unspecified status. - NOT_EXECUTED (1): - Validation did not execute. - FAILED (2): - Validation failed. - PASSED (3): - Validation passed. - """ - STATUS_UNSPECIFIED = 0 - NOT_EXECUTED = 1 - FAILED = 2 - PASSED = 3 - - description: str = proto.Field( - proto.STRING, - number=1, - ) - status: Status = proto.Field( - proto.ENUM, - number=2, - enum=Status, - ) - message: MutableSequence['ValidationMessage'] = proto.RepeatedField( - proto.MESSAGE, - number=3, - message='ValidationMessage', - ) - code: str = proto.Field( - proto.STRING, - number=4, - ) - - -class ValidationMessage(proto.Message): - r"""Represent user-facing validation result message. - - Attributes: - message (str): - The result of the validation. - level (google.cloud.datastream_v1alpha1.types.ValidationMessage.Level): - Message severity level (warning or error). - metadata (MutableMapping[str, str]): - Additional metadata related to the result. - code (str): - A custom code identifying this specific - message. - """ - class Level(proto.Enum): - r"""Validation message level. - - Values: - LEVEL_UNSPECIFIED (0): - Unspecified level. - WARNING (1): - Potentially cause issues with the Stream. - ERROR (2): - Definitely cause issues with the Stream. - """ - LEVEL_UNSPECIFIED = 0 - WARNING = 1 - ERROR = 2 - - message: str = proto.Field( - proto.STRING, - number=1, - ) - level: Level = proto.Field( - proto.ENUM, - number=2, - enum=Level, - ) - metadata: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=3, - ) - code: str = proto.Field( - proto.STRING, - number=4, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1alpha1/mypy.ini b/owl-bot-staging/v1alpha1/mypy.ini deleted file mode 100644 index 574c5ae..0000000 --- a/owl-bot-staging/v1alpha1/mypy.ini +++ /dev/null @@ -1,3 +0,0 @@ -[mypy] -python_version = 3.7 -namespace_packages = True diff --git a/owl-bot-staging/v1alpha1/noxfile.py b/owl-bot-staging/v1alpha1/noxfile.py deleted file mode 100644 index a812ff8..0000000 --- a/owl-bot-staging/v1alpha1/noxfile.py +++ /dev/null @@ -1,184 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os -import pathlib -import shutil -import subprocess -import sys - - -import nox # type: ignore - -ALL_PYTHON = [ - "3.7", - "3.8", - "3.9", - "3.10", - "3.11", -] - -CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() - -LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" -PACKAGE_NAME = subprocess.check_output([sys.executable, "setup.py", "--name"], encoding="utf-8") - -BLACK_VERSION = "black==22.3.0" -BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"] -DEFAULT_PYTHON_VERSION = "3.11" - -nox.sessions = [ - "unit", - "cover", - "mypy", - "check_lower_bounds" - # exclude update_lower_bounds from default - "docs", - "blacken", - "lint", - "lint_setup_py", -] - -@nox.session(python=ALL_PYTHON) -def unit(session): - """Run the unit test suite.""" - - session.install('coverage', 'pytest', 'pytest-cov', 'pytest-asyncio', 'asyncmock; python_version < "3.8"') - session.install('-e', '.') - - session.run( - 'py.test', - '--quiet', - '--cov=google/cloud/datastream_v1alpha1/', - '--cov=tests/', - '--cov-config=.coveragerc', - '--cov-report=term', - '--cov-report=html', - os.path.join('tests', 'unit', ''.join(session.posargs)) - ) - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def cover(session): - """Run the final coverage report. - This outputs the coverage report aggregating coverage from the unit - test runs (not system test runs), and then erases coverage data. - """ - session.install("coverage", "pytest-cov") - session.run("coverage", "report", "--show-missing", "--fail-under=100") - - session.run("coverage", "erase") - - -@nox.session(python=ALL_PYTHON) -def mypy(session): - """Run the type checker.""" - session.install( - 'mypy', - 'types-requests', - 'types-protobuf' - ) - session.install('.') - session.run( - 'mypy', - '--explicit-package-bases', - 'google', - ) - - -@nox.session -def update_lower_bounds(session): - """Update lower bounds in constraints.txt to match setup.py""" - session.install('google-cloud-testutils') - session.install('.') - - session.run( - 'lower-bound-checker', - 'update', - '--package-name', - PACKAGE_NAME, - '--constraints-file', - str(LOWER_BOUND_CONSTRAINTS_FILE), - ) - - -@nox.session -def check_lower_bounds(session): - """Check lower bounds in setup.py are reflected in constraints file""" - session.install('google-cloud-testutils') - session.install('.') - - session.run( - 'lower-bound-checker', - 'check', - '--package-name', - PACKAGE_NAME, - '--constraints-file', - str(LOWER_BOUND_CONSTRAINTS_FILE), - ) - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def docs(session): - """Build the docs for this library.""" - - session.install("-e", ".") - session.install("sphinx==4.0.1", "alabaster", "recommonmark") - - shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) - session.run( - "sphinx-build", - "-W", # warnings as errors - "-T", # show full traceback on exception - "-N", # no colors - "-b", - "html", - "-d", - os.path.join("docs", "_build", "doctrees", ""), - os.path.join("docs", ""), - os.path.join("docs", "_build", "html", ""), - ) - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def lint(session): - """Run linters. - - Returns a failure if the linters find linting errors or sufficiently - serious code quality issues. - """ - session.install("flake8", BLACK_VERSION) - session.run( - "black", - "--check", - *BLACK_PATHS, - ) - session.run("flake8", "google", "tests", "samples") - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def blacken(session): - """Run black. Format code to uniform standard.""" - session.install(BLACK_VERSION) - session.run( - "black", - *BLACK_PATHS, - ) - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def lint_setup_py(session): - """Verify that setup.py is valid (including RST check).""" - session.install("docutils", "pygments") - session.run("python", "setup.py", "check", "--restructuredtext", "--strict") diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_connection_profile_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_connection_profile_async.py deleted file mode 100644 index cb89c2c..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_connection_profile_async.py +++ /dev/null @@ -1,65 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateConnectionProfile -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_CreateConnectionProfile_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -async def sample_create_connection_profile(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - connection_profile = datastream_v1alpha1.ConnectionProfile() - connection_profile.oracle_profile.hostname = "hostname_value" - connection_profile.oracle_profile.username = "username_value" - connection_profile.oracle_profile.password = "password_value" - connection_profile.oracle_profile.database_service = "database_service_value" - connection_profile.display_name = "display_name_value" - - request = datastream_v1alpha1.CreateConnectionProfileRequest( - parent="parent_value", - connection_profile_id="connection_profile_id_value", - connection_profile=connection_profile, - ) - - # Make the request - operation = client.create_connection_profile(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_CreateConnectionProfile_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_connection_profile_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_connection_profile_sync.py deleted file mode 100644 index 8f1c8df..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_connection_profile_sync.py +++ /dev/null @@ -1,65 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateConnectionProfile -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_CreateConnectionProfile_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -def sample_create_connection_profile(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - connection_profile = datastream_v1alpha1.ConnectionProfile() - connection_profile.oracle_profile.hostname = "hostname_value" - connection_profile.oracle_profile.username = "username_value" - connection_profile.oracle_profile.password = "password_value" - connection_profile.oracle_profile.database_service = "database_service_value" - connection_profile.display_name = "display_name_value" - - request = datastream_v1alpha1.CreateConnectionProfileRequest( - parent="parent_value", - connection_profile_id="connection_profile_id_value", - connection_profile=connection_profile, - ) - - # Make the request - operation = client.create_connection_profile(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_CreateConnectionProfile_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_private_connection_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_private_connection_async.py deleted file mode 100644 index b907d14..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_private_connection_async.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreatePrivateConnection -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_CreatePrivateConnection_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -async def sample_create_private_connection(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - private_connection = datastream_v1alpha1.PrivateConnection() - private_connection.display_name = "display_name_value" - - request = datastream_v1alpha1.CreatePrivateConnectionRequest( - parent="parent_value", - private_connection_id="private_connection_id_value", - private_connection=private_connection, - ) - - # Make the request - operation = client.create_private_connection(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_CreatePrivateConnection_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_private_connection_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_private_connection_sync.py deleted file mode 100644 index 78ba491..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_private_connection_sync.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreatePrivateConnection -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_CreatePrivateConnection_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -def sample_create_private_connection(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - private_connection = datastream_v1alpha1.PrivateConnection() - private_connection.display_name = "display_name_value" - - request = datastream_v1alpha1.CreatePrivateConnectionRequest( - parent="parent_value", - private_connection_id="private_connection_id_value", - private_connection=private_connection, - ) - - # Make the request - operation = client.create_private_connection(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_CreatePrivateConnection_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_route_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_route_async.py deleted file mode 100644 index befa784..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_route_async.py +++ /dev/null @@ -1,62 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateRoute -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_CreateRoute_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -async def sample_create_route(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - route = datastream_v1alpha1.Route() - route.display_name = "display_name_value" - route.destination_address = "destination_address_value" - - request = datastream_v1alpha1.CreateRouteRequest( - parent="parent_value", - route_id="route_id_value", - route=route, - ) - - # Make the request - operation = client.create_route(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_CreateRoute_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_route_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_route_sync.py deleted file mode 100644 index ff204d7..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_route_sync.py +++ /dev/null @@ -1,62 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateRoute -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_CreateRoute_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -def sample_create_route(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - route = datastream_v1alpha1.Route() - route.display_name = "display_name_value" - route.destination_address = "destination_address_value" - - request = datastream_v1alpha1.CreateRouteRequest( - parent="parent_value", - route_id="route_id_value", - route=route, - ) - - # Make the request - operation = client.create_route(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_CreateRoute_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_stream_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_stream_async.py deleted file mode 100644 index 6dee5e8..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_stream_async.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateStream -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_CreateStream_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -async def sample_create_stream(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - stream = datastream_v1alpha1.Stream() - stream.display_name = "display_name_value" - stream.source_config.source_connection_profile_name = "source_connection_profile_name_value" - stream.destination_config.destination_connection_profile_name = "destination_connection_profile_name_value" - - request = datastream_v1alpha1.CreateStreamRequest( - parent="parent_value", - stream_id="stream_id_value", - stream=stream, - ) - - # Make the request - operation = client.create_stream(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_CreateStream_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_stream_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_stream_sync.py deleted file mode 100644 index 0c4db6b..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_create_stream_sync.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateStream -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_CreateStream_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -def sample_create_stream(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - stream = datastream_v1alpha1.Stream() - stream.display_name = "display_name_value" - stream.source_config.source_connection_profile_name = "source_connection_profile_name_value" - stream.destination_config.destination_connection_profile_name = "destination_connection_profile_name_value" - - request = datastream_v1alpha1.CreateStreamRequest( - parent="parent_value", - stream_id="stream_id_value", - stream=stream, - ) - - # Make the request - operation = client.create_stream(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_CreateStream_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_connection_profile_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_connection_profile_async.py deleted file mode 100644 index 77394fb..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_connection_profile_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteConnectionProfile -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_DeleteConnectionProfile_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -async def sample_delete_connection_profile(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.DeleteConnectionProfileRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_connection_profile(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_DeleteConnectionProfile_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_connection_profile_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_connection_profile_sync.py deleted file mode 100644 index 4d71597..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_connection_profile_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteConnectionProfile -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_DeleteConnectionProfile_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -def sample_delete_connection_profile(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.DeleteConnectionProfileRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_connection_profile(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_DeleteConnectionProfile_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_private_connection_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_private_connection_async.py deleted file mode 100644 index 228fd3a..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_private_connection_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeletePrivateConnection -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_DeletePrivateConnection_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -async def sample_delete_private_connection(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.DeletePrivateConnectionRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_private_connection(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_DeletePrivateConnection_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_private_connection_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_private_connection_sync.py deleted file mode 100644 index 46eeb51..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_private_connection_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeletePrivateConnection -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_DeletePrivateConnection_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -def sample_delete_private_connection(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.DeletePrivateConnectionRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_private_connection(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_DeletePrivateConnection_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_route_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_route_async.py deleted file mode 100644 index 6c899da..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_route_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteRoute -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_DeleteRoute_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -async def sample_delete_route(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.DeleteRouteRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_route(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_DeleteRoute_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_route_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_route_sync.py deleted file mode 100644 index 005ffed..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_route_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteRoute -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_DeleteRoute_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -def sample_delete_route(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.DeleteRouteRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_route(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_DeleteRoute_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_stream_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_stream_async.py deleted file mode 100644 index 59a6e6e..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_stream_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteStream -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_DeleteStream_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -async def sample_delete_stream(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.DeleteStreamRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_stream(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_DeleteStream_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_stream_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_stream_sync.py deleted file mode 100644 index c8bd332..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_stream_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteStream -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_DeleteStream_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -def sample_delete_stream(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.DeleteStreamRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_stream(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_DeleteStream_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_discover_connection_profile_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_discover_connection_profile_async.py deleted file mode 100644 index b463e03..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_discover_connection_profile_async.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DiscoverConnectionProfile -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_DiscoverConnectionProfile_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -async def sample_discover_connection_profile(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - connection_profile = datastream_v1alpha1.ConnectionProfile() - connection_profile.oracle_profile.hostname = "hostname_value" - connection_profile.oracle_profile.username = "username_value" - connection_profile.oracle_profile.password = "password_value" - connection_profile.oracle_profile.database_service = "database_service_value" - connection_profile.display_name = "display_name_value" - - request = datastream_v1alpha1.DiscoverConnectionProfileRequest( - connection_profile=connection_profile, - recursive=True, - parent="parent_value", - ) - - # Make the request - response = await client.discover_connection_profile(request=request) - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_DiscoverConnectionProfile_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_discover_connection_profile_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_discover_connection_profile_sync.py deleted file mode 100644 index 449f11e..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_discover_connection_profile_sync.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DiscoverConnectionProfile -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_DiscoverConnectionProfile_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -def sample_discover_connection_profile(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - connection_profile = datastream_v1alpha1.ConnectionProfile() - connection_profile.oracle_profile.hostname = "hostname_value" - connection_profile.oracle_profile.username = "username_value" - connection_profile.oracle_profile.password = "password_value" - connection_profile.oracle_profile.database_service = "database_service_value" - connection_profile.display_name = "display_name_value" - - request = datastream_v1alpha1.DiscoverConnectionProfileRequest( - connection_profile=connection_profile, - recursive=True, - parent="parent_value", - ) - - # Make the request - response = client.discover_connection_profile(request=request) - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_DiscoverConnectionProfile_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_errors_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_errors_async.py deleted file mode 100644 index 6677448..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_errors_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for FetchErrors -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_FetchErrors_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -async def sample_fetch_errors(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.FetchErrorsRequest( - ) - - # Make the request - operation = client.fetch_errors(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_FetchErrors_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_errors_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_errors_sync.py deleted file mode 100644 index 8550d43..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_errors_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for FetchErrors -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_FetchErrors_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -def sample_fetch_errors(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.FetchErrorsRequest( - ) - - # Make the request - operation = client.fetch_errors(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_FetchErrors_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_static_ips_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_static_ips_async.py deleted file mode 100644 index e66262d..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_static_ips_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for FetchStaticIps -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_FetchStaticIps_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -async def sample_fetch_static_ips(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.FetchStaticIpsRequest( - name="name_value", - ) - - # Make the request - page_result = client.fetch_static_ips(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END datastream_v1alpha1_generated_Datastream_FetchStaticIps_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_static_ips_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_static_ips_sync.py deleted file mode 100644 index d6591be..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_fetch_static_ips_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for FetchStaticIps -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_FetchStaticIps_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -def sample_fetch_static_ips(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.FetchStaticIpsRequest( - name="name_value", - ) - - # Make the request - page_result = client.fetch_static_ips(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END datastream_v1alpha1_generated_Datastream_FetchStaticIps_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_connection_profile_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_connection_profile_async.py deleted file mode 100644 index a0bc412..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_connection_profile_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetConnectionProfile -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_GetConnectionProfile_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -async def sample_get_connection_profile(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.GetConnectionProfileRequest( - name="name_value", - ) - - # Make the request - response = await client.get_connection_profile(request=request) - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_GetConnectionProfile_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_connection_profile_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_connection_profile_sync.py deleted file mode 100644 index 00f1b9b..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_connection_profile_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetConnectionProfile -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_GetConnectionProfile_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -def sample_get_connection_profile(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.GetConnectionProfileRequest( - name="name_value", - ) - - # Make the request - response = client.get_connection_profile(request=request) - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_GetConnectionProfile_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_private_connection_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_private_connection_async.py deleted file mode 100644 index fb242ce..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_private_connection_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetPrivateConnection -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_GetPrivateConnection_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -async def sample_get_private_connection(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.GetPrivateConnectionRequest( - name="name_value", - ) - - # Make the request - response = await client.get_private_connection(request=request) - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_GetPrivateConnection_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_private_connection_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_private_connection_sync.py deleted file mode 100644 index 46f2e57..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_private_connection_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetPrivateConnection -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_GetPrivateConnection_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -def sample_get_private_connection(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.GetPrivateConnectionRequest( - name="name_value", - ) - - # Make the request - response = client.get_private_connection(request=request) - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_GetPrivateConnection_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_route_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_route_async.py deleted file mode 100644 index 663e74a..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_route_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetRoute -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_GetRoute_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -async def sample_get_route(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.GetRouteRequest( - name="name_value", - ) - - # Make the request - response = await client.get_route(request=request) - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_GetRoute_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_route_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_route_sync.py deleted file mode 100644 index 3176bae..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_route_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetRoute -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_GetRoute_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -def sample_get_route(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.GetRouteRequest( - name="name_value", - ) - - # Make the request - response = client.get_route(request=request) - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_GetRoute_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_stream_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_stream_async.py deleted file mode 100644 index b1c1572..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_stream_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetStream -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_GetStream_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -async def sample_get_stream(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.GetStreamRequest( - name="name_value", - ) - - # Make the request - response = await client.get_stream(request=request) - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_GetStream_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_stream_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_stream_sync.py deleted file mode 100644 index 4610194..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_get_stream_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetStream -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_GetStream_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -def sample_get_stream(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.GetStreamRequest( - name="name_value", - ) - - # Make the request - response = client.get_stream(request=request) - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_GetStream_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_connection_profiles_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_connection_profiles_async.py deleted file mode 100644 index 6a2bf11..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_connection_profiles_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListConnectionProfiles -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_ListConnectionProfiles_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -async def sample_list_connection_profiles(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.ListConnectionProfilesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_connection_profiles(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END datastream_v1alpha1_generated_Datastream_ListConnectionProfiles_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_connection_profiles_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_connection_profiles_sync.py deleted file mode 100644 index 07ae1d8..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_connection_profiles_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListConnectionProfiles -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_ListConnectionProfiles_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -def sample_list_connection_profiles(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.ListConnectionProfilesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_connection_profiles(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END datastream_v1alpha1_generated_Datastream_ListConnectionProfiles_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_private_connections_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_private_connections_async.py deleted file mode 100644 index 0cd574b..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_private_connections_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListPrivateConnections -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_ListPrivateConnections_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -async def sample_list_private_connections(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.ListPrivateConnectionsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_private_connections(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END datastream_v1alpha1_generated_Datastream_ListPrivateConnections_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_private_connections_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_private_connections_sync.py deleted file mode 100644 index b8d2ef4..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_private_connections_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListPrivateConnections -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_ListPrivateConnections_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -def sample_list_private_connections(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.ListPrivateConnectionsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_private_connections(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END datastream_v1alpha1_generated_Datastream_ListPrivateConnections_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_routes_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_routes_async.py deleted file mode 100644 index 4013559..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_routes_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListRoutes -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_ListRoutes_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -async def sample_list_routes(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.ListRoutesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_routes(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END datastream_v1alpha1_generated_Datastream_ListRoutes_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_routes_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_routes_sync.py deleted file mode 100644 index fdb0da2..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_routes_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListRoutes -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_ListRoutes_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -def sample_list_routes(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.ListRoutesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_routes(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END datastream_v1alpha1_generated_Datastream_ListRoutes_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_streams_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_streams_async.py deleted file mode 100644 index eb4d921..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_streams_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListStreams -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_ListStreams_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -async def sample_list_streams(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.ListStreamsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_streams(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END datastream_v1alpha1_generated_Datastream_ListStreams_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_streams_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_streams_sync.py deleted file mode 100644 index c661d4c..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_list_streams_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListStreams -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_ListStreams_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -def sample_list_streams(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - request = datastream_v1alpha1.ListStreamsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_streams(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END datastream_v1alpha1_generated_Datastream_ListStreams_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_connection_profile_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_connection_profile_async.py deleted file mode 100644 index d1eb5ff..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_connection_profile_async.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateConnectionProfile -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_UpdateConnectionProfile_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -async def sample_update_connection_profile(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - connection_profile = datastream_v1alpha1.ConnectionProfile() - connection_profile.oracle_profile.hostname = "hostname_value" - connection_profile.oracle_profile.username = "username_value" - connection_profile.oracle_profile.password = "password_value" - connection_profile.oracle_profile.database_service = "database_service_value" - connection_profile.display_name = "display_name_value" - - request = datastream_v1alpha1.UpdateConnectionProfileRequest( - connection_profile=connection_profile, - ) - - # Make the request - operation = client.update_connection_profile(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_UpdateConnectionProfile_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_connection_profile_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_connection_profile_sync.py deleted file mode 100644 index f2a14a1..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_connection_profile_sync.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateConnectionProfile -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_UpdateConnectionProfile_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -def sample_update_connection_profile(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - connection_profile = datastream_v1alpha1.ConnectionProfile() - connection_profile.oracle_profile.hostname = "hostname_value" - connection_profile.oracle_profile.username = "username_value" - connection_profile.oracle_profile.password = "password_value" - connection_profile.oracle_profile.database_service = "database_service_value" - connection_profile.display_name = "display_name_value" - - request = datastream_v1alpha1.UpdateConnectionProfileRequest( - connection_profile=connection_profile, - ) - - # Make the request - operation = client.update_connection_profile(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_UpdateConnectionProfile_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_stream_async.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_stream_async.py deleted file mode 100644 index 63ceab0..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_stream_async.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateStream -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_UpdateStream_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -async def sample_update_stream(): - # Create a client - client = datastream_v1alpha1.DatastreamAsyncClient() - - # Initialize request argument(s) - stream = datastream_v1alpha1.Stream() - stream.display_name = "display_name_value" - stream.source_config.source_connection_profile_name = "source_connection_profile_name_value" - stream.destination_config.destination_connection_profile_name = "destination_connection_profile_name_value" - - request = datastream_v1alpha1.UpdateStreamRequest( - stream=stream, - ) - - # Make the request - operation = client.update_stream(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_UpdateStream_async] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_stream_sync.py b/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_stream_sync.py deleted file mode 100644 index 46e0350..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/datastream_v1alpha1_generated_datastream_update_stream_sync.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateStream -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-datastream - - -# [START datastream_v1alpha1_generated_Datastream_UpdateStream_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import datastream_v1alpha1 - - -def sample_update_stream(): - # Create a client - client = datastream_v1alpha1.DatastreamClient() - - # Initialize request argument(s) - stream = datastream_v1alpha1.Stream() - stream.display_name = "display_name_value" - stream.source_config.source_connection_profile_name = "source_connection_profile_name_value" - stream.destination_config.destination_connection_profile_name = "destination_connection_profile_name_value" - - request = datastream_v1alpha1.UpdateStreamRequest( - stream=stream, - ) - - # Make the request - operation = client.update_stream(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END datastream_v1alpha1_generated_Datastream_UpdateStream_sync] diff --git a/owl-bot-staging/v1alpha1/samples/generated_samples/snippet_metadata_google.cloud.datastream.v1alpha1.json b/owl-bot-staging/v1alpha1/samples/generated_samples/snippet_metadata_google.cloud.datastream.v1alpha1.json deleted file mode 100644 index 09dea00..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated_samples/snippet_metadata_google.cloud.datastream.v1alpha1.json +++ /dev/null @@ -1,3460 +0,0 @@ -{ - "clientLibrary": { - "apis": [ - { - "id": "google.cloud.datastream.v1alpha1", - "version": "v1alpha1" - } - ], - "language": "PYTHON", - "name": "google-cloud-datastream", - "version": "0.1.0" - }, - "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": [ - { - "end": 64, - "start": 27, - "type": "FULL" - }, - { - "end": 64, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 54, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 61, - "start": 55, - "type": "REQUEST_EXECUTION" - }, - { - "end": 65, - "start": 62, - "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": [ - { - "end": 64, - "start": 27, - "type": "FULL" - }, - { - "end": 64, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 54, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 61, - "start": 55, - "type": "REQUEST_EXECUTION" - }, - { - "end": 65, - "start": 62, - "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": [ - { - "end": 60, - "start": 27, - "type": "FULL" - }, - { - "end": 60, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 57, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 61, - "start": 58, - "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": [ - { - "end": 60, - "start": 27, - "type": "FULL" - }, - { - "end": 60, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 57, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 61, - "start": 58, - "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": [ - { - "end": 61, - "start": 27, - "type": "FULL" - }, - { - "end": 61, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 51, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 58, - "start": 52, - "type": "REQUEST_EXECUTION" - }, - { - "end": 62, - "start": 59, - "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": [ - { - "end": 61, - "start": 27, - "type": "FULL" - }, - { - "end": 61, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 51, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 58, - "start": 52, - "type": "REQUEST_EXECUTION" - }, - { - "end": 62, - "start": 59, - "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": [ - { - "end": 62, - "start": 27, - "type": "FULL" - }, - { - "end": 62, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 52, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 59, - "start": 53, - "type": "REQUEST_EXECUTION" - }, - { - "end": 63, - "start": 60, - "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": [ - { - "end": 62, - "start": 27, - "type": "FULL" - }, - { - "end": 62, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 52, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 59, - "start": 53, - "type": "REQUEST_EXECUTION" - }, - { - "end": 63, - "start": 60, - "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": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "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": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "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": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "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": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "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": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "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": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "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": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "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": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "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": [ - { - "end": 60, - "start": 27, - "type": "FULL" - }, - { - "end": 60, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 54, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 57, - "start": 55, - "type": "REQUEST_EXECUTION" - }, - { - "end": 61, - "start": 58, - "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": [ - { - "end": 60, - "start": 27, - "type": "FULL" - }, - { - "end": 60, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 54, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 57, - "start": 55, - "type": "REQUEST_EXECUTION" - }, - { - "end": 61, - "start": 58, - "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": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "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": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "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": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "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": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "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": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "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": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "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": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "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": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "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": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "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": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "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": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "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": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "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": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "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": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "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": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "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": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "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": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "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": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "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": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "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": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "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": [ - { - "end": 62, - "start": 27, - "type": "FULL" - }, - { - "end": 62, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 52, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 59, - "start": 53, - "type": "REQUEST_EXECUTION" - }, - { - "end": 63, - "start": 60, - "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": [ - { - "end": 62, - "start": 27, - "type": "FULL" - }, - { - "end": 62, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 52, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 59, - "start": 53, - "type": "REQUEST_EXECUTION" - }, - { - "end": 63, - "start": 60, - "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": [ - { - "end": 60, - "start": 27, - "type": "FULL" - }, - { - "end": 60, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 57, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 61, - "start": 58, - "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": [ - { - "end": 60, - "start": 27, - "type": "FULL" - }, - { - "end": 60, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 57, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 61, - "start": 58, - "type": "RESPONSE_HANDLING" - } - ], - "title": "datastream_v1alpha1_generated_datastream_update_stream_sync.py" - } - ] -} diff --git a/owl-bot-staging/v1alpha1/scripts/fixup_datastream_v1alpha1_keywords.py b/owl-bot-staging/v1alpha1/scripts/fixup_datastream_v1alpha1_keywords.py deleted file mode 100644 index 74accfd..0000000 --- a/owl-bot-staging/v1alpha1/scripts/fixup_datastream_v1alpha1_keywords.py +++ /dev/null @@ -1,196 +0,0 @@ -#! /usr/bin/env python3 -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import argparse -import os -import libcst as cst -import pathlib -import sys -from typing import (Any, Callable, Dict, List, Sequence, Tuple) - - -def partition( - predicate: Callable[[Any], bool], - iterator: Sequence[Any] -) -> Tuple[List[Any], List[Any]]: - """A stable, out-of-place partition.""" - results = ([], []) - - for i in iterator: - results[int(predicate(i))].append(i) - - # Returns trueList, falseList - return results[1], results[0] - - -class datastreamCallTransformer(cst.CSTTransformer): - CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') - METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { - 'create_connection_profile': ('parent', 'connection_profile_id', 'connection_profile', 'request_id', ), - 'create_private_connection': ('parent', 'private_connection_id', 'private_connection', 'request_id', ), - 'create_route': ('parent', 'route_id', 'route', 'request_id', ), - 'create_stream': ('parent', 'stream_id', 'stream', 'request_id', 'validate_only', 'force', ), - 'delete_connection_profile': ('name', 'request_id', ), - 'delete_private_connection': ('name', 'request_id', 'force', ), - 'delete_route': ('name', 'request_id', ), - 'delete_stream': ('name', 'request_id', ), - 'discover_connection_profile': ('parent', 'connection_profile', 'connection_profile_name', 'recursive', 'recursion_depth', 'oracle_rdbms', 'mysql_rdbms', ), - 'fetch_errors': ('stream', ), - 'fetch_static_ips': ('name', 'page_size', 'page_token', ), - 'get_connection_profile': ('name', ), - 'get_private_connection': ('name', ), - 'get_route': ('name', ), - 'get_stream': ('name', ), - 'list_connection_profiles': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), - 'list_private_connections': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), - 'list_routes': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), - 'list_streams': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), - 'update_connection_profile': ('connection_profile', 'update_mask', 'request_id', ), - 'update_stream': ('stream', 'update_mask', 'request_id', 'validate_only', 'force', ), - } - - def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: - try: - key = original.func.attr.value - kword_params = self.METHOD_TO_PARAMS[key] - except (AttributeError, KeyError): - # Either not a method from the API or too convoluted to be sure. - return updated - - # If the existing code is valid, keyword args come after positional args. - # Therefore, all positional args must map to the first parameters. - args, kwargs = partition(lambda a: not bool(a.keyword), updated.args) - if any(k.keyword.value == "request" for k in kwargs): - # We've already fixed this file, don't fix it again. - return updated - - kwargs, ctrl_kwargs = partition( - lambda a: a.keyword.value not in self.CTRL_PARAMS, - kwargs - ) - - args, ctrl_args = args[:len(kword_params)], args[len(kword_params):] - ctrl_kwargs.extend(cst.Arg(value=a.value, keyword=cst.Name(value=ctrl)) - for a, ctrl in zip(ctrl_args, self.CTRL_PARAMS)) - - request_arg = cst.Arg( - value=cst.Dict([ - cst.DictElement( - cst.SimpleString("'{}'".format(name)), -cst.Element(value=arg.value) - ) - # Note: the args + kwargs looks silly, but keep in mind that - # the control parameters had to be stripped out, and that - # those could have been passed positionally or by keyword. - for name, arg in zip(kword_params, args + kwargs)]), - keyword=cst.Name("request") - ) - - return updated.with_changes( - args=[request_arg] + ctrl_kwargs - ) - - -def fix_files( - in_dir: pathlib.Path, - out_dir: pathlib.Path, - *, - transformer=datastreamCallTransformer(), -): - """Duplicate the input dir to the output dir, fixing file method calls. - - Preconditions: - * in_dir is a real directory - * out_dir is a real, empty directory - """ - pyfile_gen = ( - pathlib.Path(os.path.join(root, f)) - for root, _, files in os.walk(in_dir) - for f in files if os.path.splitext(f)[1] == ".py" - ) - - for fpath in pyfile_gen: - with open(fpath, 'r') as f: - src = f.read() - - # Parse the code and insert method call fixes. - tree = cst.parse_module(src) - updated = tree.visit(transformer) - - # Create the path and directory structure for the new file. - updated_path = out_dir.joinpath(fpath.relative_to(in_dir)) - updated_path.parent.mkdir(parents=True, exist_ok=True) - - # Generate the updated source file at the corresponding path. - with open(updated_path, 'w') as f: - f.write(updated.code) - - -if __name__ == '__main__': - parser = argparse.ArgumentParser( - description="""Fix up source that uses the datastream client library. - -The existing sources are NOT overwritten but are copied to output_dir with changes made. - -Note: This tool operates at a best-effort level at converting positional - parameters in client method calls to keyword based parameters. - Cases where it WILL FAIL include - A) * or ** expansion in a method call. - B) Calls via function or method alias (includes free function calls) - C) Indirect or dispatched calls (e.g. the method is looked up dynamically) - - These all constitute false negatives. The tool will also detect false - positives when an API method shares a name with another method. -""") - parser.add_argument( - '-d', - '--input-directory', - required=True, - dest='input_dir', - help='the input directory to walk for python files to fix up', - ) - parser.add_argument( - '-o', - '--output-directory', - required=True, - dest='output_dir', - help='the directory to output files fixed via un-flattening', - ) - args = parser.parse_args() - input_dir = pathlib.Path(args.input_dir) - output_dir = pathlib.Path(args.output_dir) - if not input_dir.is_dir(): - print( - f"input directory '{input_dir}' does not exist or is not a directory", - file=sys.stderr, - ) - sys.exit(-1) - - if not output_dir.is_dir(): - print( - f"output directory '{output_dir}' does not exist or is not a directory", - file=sys.stderr, - ) - sys.exit(-1) - - if os.listdir(output_dir): - print( - f"output directory '{output_dir}' is not empty", - file=sys.stderr, - ) - sys.exit(-1) - - fix_files(input_dir, output_dir) diff --git a/owl-bot-staging/v1alpha1/setup.py b/owl-bot-staging/v1alpha1/setup.py deleted file mode 100644 index 1ca4c70..0000000 --- a/owl-bot-staging/v1alpha1/setup.py +++ /dev/null @@ -1,90 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import io -import os - -import setuptools # type: ignore - -package_root = os.path.abspath(os.path.dirname(__file__)) - -name = 'google-cloud-datastream' - - -description = "Google Cloud Datastream API client library" - -version = {} -with open(os.path.join(package_root, 'google/cloud/datastream/gapic_version.py')) as fp: - exec(fp.read(), version) -version = version["__version__"] - -if version[0] == "0": - release_status = "Development Status :: 4 - Beta" -else: - release_status = "Development Status :: 5 - Production/Stable" - -dependencies = [ - "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", - "proto-plus >= 1.22.0, <2.0.0dev", - "proto-plus >= 1.22.2, <2.0.0dev; python_version>='3.11'", - "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", -] -url = "https://github.com/googleapis/python-datastream" - -package_root = os.path.abspath(os.path.dirname(__file__)) - -readme_filename = os.path.join(package_root, "README.rst") -with io.open(readme_filename, encoding="utf-8") as readme_file: - readme = readme_file.read() - -packages = [ - package - for package in setuptools.PEP420PackageFinder.find() - if package.startswith("google") -] - -namespaces = ["google", "google.cloud"] - -setuptools.setup( - name=name, - version=version, - description=description, - long_description=readme, - author="Google LLC", - author_email="googleapis-packages@google.com", - license="Apache 2.0", - url=url, - classifiers=[ - release_status, - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Operating System :: OS Independent", - "Topic :: Internet", - ], - platforms="Posix; MacOS X; Windows", - packages=packages, - python_requires=">=3.7", - namespace_packages=namespaces, - install_requires=dependencies, - include_package_data=True, - zip_safe=False, -) diff --git a/owl-bot-staging/v1alpha1/testing/constraints-3.10.txt b/owl-bot-staging/v1alpha1/testing/constraints-3.10.txt deleted file mode 100644 index ed7f9ae..0000000 --- a/owl-bot-staging/v1alpha1/testing/constraints-3.10.txt +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf diff --git a/owl-bot-staging/v1alpha1/testing/constraints-3.11.txt b/owl-bot-staging/v1alpha1/testing/constraints-3.11.txt deleted file mode 100644 index ed7f9ae..0000000 --- a/owl-bot-staging/v1alpha1/testing/constraints-3.11.txt +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf diff --git a/owl-bot-staging/v1alpha1/testing/constraints-3.12.txt b/owl-bot-staging/v1alpha1/testing/constraints-3.12.txt deleted file mode 100644 index ed7f9ae..0000000 --- a/owl-bot-staging/v1alpha1/testing/constraints-3.12.txt +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf diff --git a/owl-bot-staging/v1alpha1/testing/constraints-3.7.txt b/owl-bot-staging/v1alpha1/testing/constraints-3.7.txt deleted file mode 100644 index 6c44adf..0000000 --- a/owl-bot-staging/v1alpha1/testing/constraints-3.7.txt +++ /dev/null @@ -1,9 +0,0 @@ -# This constraints file is used to check that lower bounds -# are correct in setup.py -# List all library dependencies and extras in this file. -# Pin the version to the lower bound. -# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", -# Then this file should have google-cloud-foo==1.14.0 -google-api-core==1.34.0 -proto-plus==1.22.0 -protobuf==3.19.5 diff --git a/owl-bot-staging/v1alpha1/testing/constraints-3.8.txt b/owl-bot-staging/v1alpha1/testing/constraints-3.8.txt deleted file mode 100644 index ed7f9ae..0000000 --- a/owl-bot-staging/v1alpha1/testing/constraints-3.8.txt +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf diff --git a/owl-bot-staging/v1alpha1/testing/constraints-3.9.txt b/owl-bot-staging/v1alpha1/testing/constraints-3.9.txt deleted file mode 100644 index ed7f9ae..0000000 --- a/owl-bot-staging/v1alpha1/testing/constraints-3.9.txt +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf diff --git a/owl-bot-staging/v1alpha1/tests/__init__.py b/owl-bot-staging/v1alpha1/tests/__init__.py deleted file mode 100644 index 231bc12..0000000 --- a/owl-bot-staging/v1alpha1/tests/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1alpha1/tests/unit/__init__.py b/owl-bot-staging/v1alpha1/tests/unit/__init__.py deleted file mode 100644 index 231bc12..0000000 --- a/owl-bot-staging/v1alpha1/tests/unit/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1alpha1/tests/unit/gapic/__init__.py b/owl-bot-staging/v1alpha1/tests/unit/gapic/__init__.py deleted file mode 100644 index 231bc12..0000000 --- a/owl-bot-staging/v1alpha1/tests/unit/gapic/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1alpha1/tests/unit/gapic/datastream_v1alpha1/__init__.py b/owl-bot-staging/v1alpha1/tests/unit/gapic/datastream_v1alpha1/__init__.py deleted file mode 100644 index 231bc12..0000000 --- a/owl-bot-staging/v1alpha1/tests/unit/gapic/datastream_v1alpha1/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1alpha1/tests/unit/gapic/datastream_v1alpha1/test_datastream.py b/owl-bot-staging/v1alpha1/tests/unit/gapic/datastream_v1alpha1/test_datastream.py deleted file mode 100644 index 5716ba5..0000000 --- a/owl-bot-staging/v1alpha1/tests/unit/gapic/datastream_v1alpha1/test_datastream.py +++ /dev/null @@ -1,7069 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os -# try/except added for compatibility with python < 3.8 -try: - from unittest import mock - from unittest.mock import AsyncMock # pragma: NO COVER -except ImportError: # pragma: NO COVER - import mock - -import grpc -from grpc.experimental import aio -import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers - -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 -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 empty_pb2 # type: ignore -from google.protobuf import field_mask_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore -import google.auth - - -def client_cert_source_callback(): - return b"cert bytes", b"key bytes" - - -# If default endpoint is localhost, then default mtls endpoint will be the same. -# This method modifies the default endpoint so the client can produce a different -# mtls endpoint for endpoint testing purposes. -def modify_default_endpoint(client): - return "foo.googleapis.com" if ("localhost" in client.DEFAULT_ENDPOINT) else client.DEFAULT_ENDPOINT - - -def test__get_default_mtls_endpoint(): - api_endpoint = "example.googleapis.com" - api_mtls_endpoint = "example.mtls.googleapis.com" - sandbox_endpoint = "example.sandbox.googleapis.com" - sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" - non_googleapi = "api.example.com" - - assert DatastreamClient._get_default_mtls_endpoint(None) is None - assert DatastreamClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint - assert DatastreamClient._get_default_mtls_endpoint(api_mtls_endpoint) == api_mtls_endpoint - assert DatastreamClient._get_default_mtls_endpoint(sandbox_endpoint) == sandbox_mtls_endpoint - assert DatastreamClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) == sandbox_mtls_endpoint - assert DatastreamClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi - - -@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, transport=transport_name) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - 'datastream.googleapis.com:443' - ) - - -@pytest.mark.parametrize("transport_class,transport_name", [ - (transports.DatastreamGrpcTransport, "grpc"), - (transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio"), -]) -def test_datastream_client_service_account_always_use_jwt(transport_class, transport_name): - with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=True) - use_jwt.assert_called_once_with(True) - - with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=False) - use_jwt.assert_not_called() - - -@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", transport=transport_name) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - 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' - ) - - -def test_datastream_client_get_transport_class(): - transport = DatastreamClient.get_transport_class() - available_transports = [ - transports.DatastreamGrpcTransport, - ] - assert transport in available_transports - - transport = DatastreamClient.get_transport_class("grpc") - assert transport == transports.DatastreamGrpcTransport - - -@pytest.mark.parametrize("client_class,transport_class,transport_name", [ - (DatastreamClient, transports.DatastreamGrpcTransport, "grpc"), - (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio"), -]) -@mock.patch.object(DatastreamClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DatastreamClient)) -@mock.patch.object(DatastreamAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DatastreamAsyncClient)) -def test_datastream_client_client_options(client_class, transport_class, transport_name): - # Check that if channel is provided we won't create a new one. - with mock.patch.object(DatastreamClient, 'get_transport_class') as gtc: - transport = transport_class( - credentials=ga_credentials.AnonymousCredentials() - ) - client = client_class(transport=transport) - gtc.assert_not_called() - - # Check that if channel is provided via str we will create a new one. - with mock.patch.object(DatastreamClient, 'get_transport_class') as gtc: - client = client_class(transport=transport_name) - gtc.assert_called() - - # Check the case api_endpoint is provided. - options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(transport=transport_name, client_options=options) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_MTLS_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has - # unsupported value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): - with pytest.raises(MutualTLSChannelError): - client = client_class(transport=transport_name) - - # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}): - with pytest.raises(ValueError): - client = client_class(transport=transport_name) - - # Check the case quota_project_id is provided - options = client_options.ClientOptions(quota_project_id="octopus") - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id="octopus", - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - # Check the case api_endpoint is provided - options = client_options.ClientOptions(api_audience="https://language.googleapis.com") - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience="https://language.googleapis.com" - ) - -@pytest.mark.parametrize("client_class,transport_class,transport_name,use_client_cert_env", [ - (DatastreamClient, transports.DatastreamGrpcTransport, "grpc", "true"), - (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio", "true"), - (DatastreamClient, transports.DatastreamGrpcTransport, "grpc", "false"), - (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio", "false"), -]) -@mock.patch.object(DatastreamClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DatastreamClient)) -@mock.patch.object(DatastreamAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DatastreamAsyncClient)) -@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) -def test_datastream_client_mtls_env_auto(client_class, transport_class, transport_name, use_client_cert_env): - # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default - # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. - - # Check the case client_cert_source is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): - options = client_options.ClientOptions(client_cert_source=client_cert_source_callback) - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - - if use_client_cert_env == "false": - expected_client_cert_source = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_client_cert_source = client_cert_source_callback - expected_host = client.DEFAULT_MTLS_ENDPOINT - - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - client_cert_source_for_mtls=expected_client_cert_source, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case ADC client cert is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): - with mock.patch.object(transport_class, '__init__') as patched: - with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): - with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=client_cert_source_callback): - if use_client_cert_env == "false": - expected_host = client.DEFAULT_ENDPOINT - expected_client_cert_source = None - else: - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_client_cert_source = client_cert_source_callback - - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - client_cert_source_for_mtls=expected_client_cert_source, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): - with mock.patch.object(transport_class, '__init__') as patched: - with mock.patch("google.auth.transport.mtls.has_default_client_cert_source", return_value=False): - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize("client_class", [ - DatastreamClient, DatastreamAsyncClient -]) -@mock.patch.object(DatastreamClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DatastreamClient)) -@mock.patch.object(DatastreamAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(DatastreamAsyncClient)) -def test_datastream_client_get_mtls_endpoint_and_cert_source(client_class): - mock_client_cert_source = mock.Mock() - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - mock_api_endpoint = "foo" - options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) - assert api_endpoint == mock_api_endpoint - assert cert_source == mock_client_cert_source - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): - mock_client_cert_source = mock.Mock() - mock_api_endpoint = "foo" - options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) - assert api_endpoint == mock_api_endpoint - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=False): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): - with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=mock_client_cert_source): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source == mock_client_cert_source - - -@pytest.mark.parametrize("client_class,transport_class,transport_name", [ - (DatastreamClient, transports.DatastreamGrpcTransport, "grpc"), - (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio"), -]) -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"], - ) - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=["1", "2"], - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - -@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ - (DatastreamClient, transports.DatastreamGrpcTransport, "grpc", grpc_helpers), - (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), -]) -def test_datastream_client_client_options_credentials_file(client_class, transport_class, transport_name, grpc_helpers): - # Check the case credentials file is provided. - options = client_options.ClientOptions( - credentials_file="credentials.json" - ) - - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - -def test_datastream_client_client_options_from_dict(): - with mock.patch('google.cloud.datastream_v1alpha1.services.datastream.transports.DatastreamGrpcTransport.__init__') as grpc_transport: - grpc_transport.return_value = None - client = DatastreamClient( - client_options={'api_endpoint': 'squid.clam.whelk'} - ) - grpc_transport.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ - (DatastreamClient, transports.DatastreamGrpcTransport, "grpc", grpc_helpers), - (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), -]) -def test_datastream_client_create_channel_credentials_file(client_class, transport_class, transport_name, grpc_helpers): - # Check the case credentials file is provided. - options = client_options.ClientOptions( - credentials_file="credentials.json" - ) - - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # test that the credentials from file are saved and used as the credentials. - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch.object( - google.auth, "default", autospec=True - ) as adc, mock.patch.object( - grpc_helpers, "create_channel" - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - file_creds = ga_credentials.AnonymousCredentials() - load_creds.return_value = (file_creds, None) - adc.return_value = (creds, None) - client = client_class(client_options=options, transport=transport_name) - create_channel.assert_called_with( - "datastream.googleapis.com:443", - credentials=file_creds, - credentials_file=None, - quota_project_id=None, - default_scopes=( - 'https://www.googleapis.com/auth/cloud-platform', -), - scopes=None, - default_host="datastream.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize("request_type", [ - datastream.ListConnectionProfilesRequest, - dict, -]) -def test_list_connection_profiles(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_connection_profiles), - '__call__') 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'], - ) - response = client.list_connection_profiles(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListConnectionProfilesRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListConnectionProfilesPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_connection_profiles), - '__call__') as call: - client.list_connection_profiles() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListConnectionProfilesRequest() - -@pytest.mark.asyncio -async def test_list_connection_profiles_async(transport: str = 'grpc_asyncio', request_type=datastream.ListConnectionProfilesRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_connection_profiles), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListConnectionProfilesResponse( - next_page_token='next_page_token_value', - unreachable=['unreachable_value'], - )) - response = await client.list_connection_profiles(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListConnectionProfilesRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListConnectionProfilesAsyncPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -@pytest.mark.asyncio -async def test_list_connection_profiles_async_from_dict(): - await test_list_connection_profiles_async(request_type=dict) - - -def test_list_connection_profiles_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_connection_profiles), - '__call__') as call: - call.return_value = datastream.ListConnectionProfilesResponse() - client.list_connection_profiles(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_connection_profiles), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListConnectionProfilesResponse()) - await client.list_connection_profiles(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_connection_profiles_flattened(): - 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_connection_profiles), - '__call__') as call: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_connection_profiles_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_list_connection_profiles_flattened_async(): - 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_connection_profiles), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream.ListConnectionProfilesResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListConnectionProfilesResponse()) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_connection_profiles_flattened_error_async(): - 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', - ) - - -def test_list_connection_profiles_pager(transport_name: str = "grpc"): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_connection_profiles), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListConnectionProfilesResponse( - connection_profiles=[ - datastream_resources.ConnectionProfile(), - datastream_resources.ConnectionProfile(), - datastream_resources.ConnectionProfile(), - ], - next_page_token='abc', - ), - datastream.ListConnectionProfilesResponse( - connection_profiles=[], - next_page_token='def', - ), - datastream.ListConnectionProfilesResponse( - connection_profiles=[ - datastream_resources.ConnectionProfile(), - ], - next_page_token='ghi', - ), - datastream.ListConnectionProfilesResponse( - connection_profiles=[ - datastream_resources.ConnectionProfile(), - datastream_resources.ConnectionProfile(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_connection_profiles(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, datastream_resources.ConnectionProfile) - for i in results) -def test_list_connection_profiles_pages(transport_name: str = "grpc"): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_connection_profiles), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListConnectionProfilesResponse( - connection_profiles=[ - datastream_resources.ConnectionProfile(), - datastream_resources.ConnectionProfile(), - datastream_resources.ConnectionProfile(), - ], - next_page_token='abc', - ), - datastream.ListConnectionProfilesResponse( - connection_profiles=[], - next_page_token='def', - ), - datastream.ListConnectionProfilesResponse( - connection_profiles=[ - datastream_resources.ConnectionProfile(), - ], - next_page_token='ghi', - ), - datastream.ListConnectionProfilesResponse( - connection_profiles=[ - datastream_resources.ConnectionProfile(), - datastream_resources.ConnectionProfile(), - ], - ), - RuntimeError, - ) - pages = list(client.list_connection_profiles(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_connection_profiles_async_pager(): - 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_connection_profiles), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListConnectionProfilesResponse( - connection_profiles=[ - datastream_resources.ConnectionProfile(), - datastream_resources.ConnectionProfile(), - datastream_resources.ConnectionProfile(), - ], - next_page_token='abc', - ), - datastream.ListConnectionProfilesResponse( - connection_profiles=[], - next_page_token='def', - ), - datastream.ListConnectionProfilesResponse( - connection_profiles=[ - datastream_resources.ConnectionProfile(), - ], - next_page_token='ghi', - ), - datastream.ListConnectionProfilesResponse( - connection_profiles=[ - datastream_resources.ConnectionProfile(), - datastream_resources.ConnectionProfile(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_connection_profiles(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, datastream_resources.ConnectionProfile) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_connection_profiles_async_pages(): - 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_connection_profiles), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListConnectionProfilesResponse( - connection_profiles=[ - datastream_resources.ConnectionProfile(), - datastream_resources.ConnectionProfile(), - datastream_resources.ConnectionProfile(), - ], - next_page_token='abc', - ), - datastream.ListConnectionProfilesResponse( - connection_profiles=[], - next_page_token='def', - ), - datastream.ListConnectionProfilesResponse( - connection_profiles=[ - datastream_resources.ConnectionProfile(), - ], - next_page_token='ghi', - ), - datastream.ListConnectionProfilesResponse( - connection_profiles=[ - datastream_resources.ConnectionProfile(), - datastream_resources.ConnectionProfile(), - ], - ), - RuntimeError, - ) - 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, -]) -def test_get_connection_profile(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream_resources.ConnectionProfile( - name='name_value', - display_name='display_name_value', - oracle_profile=datastream_resources.OracleProfile(hostname='hostname_value'), - no_connectivity=None, - ) - response = client.get_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetConnectionProfileRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream_resources.ConnectionProfile) - assert response.name == 'name_value' - assert response.display_name == 'display_name_value' - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_connection_profile), - '__call__') as call: - client.get_connection_profile() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetConnectionProfileRequest() - -@pytest.mark.asyncio -async def test_get_connection_profile_async(transport: str = 'grpc_asyncio', request_type=datastream.GetConnectionProfileRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_connection_profile), - '__call__') as call: - # 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', - )) - response = await client.get_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetConnectionProfileRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream_resources.ConnectionProfile) - assert response.name == 'name_value' - assert response.display_name == 'display_name_value' - - -@pytest.mark.asyncio -async def test_get_connection_profile_async_from_dict(): - await test_get_connection_profile_async(request_type=dict) - - -def test_get_connection_profile_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_connection_profile), - '__call__') as call: - call.return_value = datastream_resources.ConnectionProfile() - client.get_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_connection_profile), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.ConnectionProfile()) - await client.get_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_connection_profile_flattened(): - 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_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_connection_profile_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_get_connection_profile_flattened_async(): - 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_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream_resources.ConnectionProfile() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.ConnectionProfile()) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_connection_profile_flattened_error_async(): - 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', - ) - - -@pytest.mark.parametrize("request_type", [ - datastream.CreateConnectionProfileRequest, - dict, -]) -def test_create_connection_profile(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.create_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreateConnectionProfileRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_connection_profile), - '__call__') as call: - client.create_connection_profile() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreateConnectionProfileRequest() - -@pytest.mark.asyncio -async def test_create_connection_profile_async(transport: str = 'grpc_asyncio', request_type=datastream.CreateConnectionProfileRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.create_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreateConnectionProfileRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_create_connection_profile_async_from_dict(): - await test_create_connection_profile_async(request_type=dict) - - -def test_create_connection_profile_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_connection_profile), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.create_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_connection_profile), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.create_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_create_connection_profile_flattened(): - 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_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - 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.create_connection_profile( - parent='parent_value', - connection_profile=datastream_resources.ConnectionProfile(name='name_value'), - connection_profile_id='connection_profile_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].connection_profile - mock_val = datastream_resources.ConnectionProfile(name='name_value') - assert arg == mock_val - arg = args[0].connection_profile_id - mock_val = 'connection_profile_id_value' - assert arg == mock_val - - -def test_create_connection_profile_flattened_error(): - 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.create_connection_profile( - datastream.CreateConnectionProfileRequest(), - parent='parent_value', - connection_profile=datastream_resources.ConnectionProfile(name='name_value'), - connection_profile_id='connection_profile_id_value', - ) - -@pytest.mark.asyncio -async def test_create_connection_profile_flattened_async(): - 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_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_connection_profile( - parent='parent_value', - connection_profile=datastream_resources.ConnectionProfile(name='name_value'), - connection_profile_id='connection_profile_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].connection_profile - mock_val = datastream_resources.ConnectionProfile(name='name_value') - assert arg == mock_val - arg = args[0].connection_profile_id - mock_val = 'connection_profile_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_create_connection_profile_flattened_error_async(): - 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.create_connection_profile( - datastream.CreateConnectionProfileRequest(), - parent='parent_value', - connection_profile=datastream_resources.ConnectionProfile(name='name_value'), - connection_profile_id='connection_profile_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - datastream.UpdateConnectionProfileRequest, - dict, -]) -def test_update_connection_profile(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.update_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.UpdateConnectionProfileRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_connection_profile), - '__call__') as call: - client.update_connection_profile() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.UpdateConnectionProfileRequest() - -@pytest.mark.asyncio -async def test_update_connection_profile_async(transport: str = 'grpc_asyncio', request_type=datastream.UpdateConnectionProfileRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.update_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.UpdateConnectionProfileRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_update_connection_profile_async_from_dict(): - await test_update_connection_profile_async(request_type=dict) - - -def test_update_connection_profile_field_headers(): - 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 = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_connection_profile), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.update_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - '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(), - ) - - # 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 = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_connection_profile), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.update_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'connection_profile.name=name_value', - ) in kw['metadata'] - - -def test_update_connection_profile_flattened(): - 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_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - 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.update_connection_profile( - connection_profile=datastream_resources.ConnectionProfile(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].connection_profile - mock_val = datastream_resources.ConnectionProfile(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - - -def test_update_connection_profile_flattened_error(): - 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.update_connection_profile( - datastream.UpdateConnectionProfileRequest(), - connection_profile=datastream_resources.ConnectionProfile(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - -@pytest.mark.asyncio -async def test_update_connection_profile_flattened_async(): - 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_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_connection_profile( - connection_profile=datastream_resources.ConnectionProfile(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].connection_profile - mock_val = datastream_resources.ConnectionProfile(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - -@pytest.mark.asyncio -async def test_update_connection_profile_flattened_error_async(): - 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.update_connection_profile( - datastream.UpdateConnectionProfileRequest(), - connection_profile=datastream_resources.ConnectionProfile(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - -@pytest.mark.parametrize("request_type", [ - datastream.DeleteConnectionProfileRequest, - dict, -]) -def test_delete_connection_profile(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.delete_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeleteConnectionProfileRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_connection_profile), - '__call__') as call: - client.delete_connection_profile() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeleteConnectionProfileRequest() - -@pytest.mark.asyncio -async def test_delete_connection_profile_async(transport: str = 'grpc_asyncio', request_type=datastream.DeleteConnectionProfileRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.delete_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeleteConnectionProfileRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_delete_connection_profile_async_from_dict(): - await test_delete_connection_profile_async(request_type=dict) - - -def test_delete_connection_profile_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_connection_profile), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.delete_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_connection_profile), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.delete_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_delete_connection_profile_flattened(): - 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_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_delete_connection_profile_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_delete_connection_profile_flattened_async(): - 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_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_delete_connection_profile_flattened_error_async(): - 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', - ) - - -@pytest.mark.parametrize("request_type", [ - datastream.DiscoverConnectionProfileRequest, - dict, -]) -def test_discover_connection_profile(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.discover_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream.DiscoverConnectionProfileResponse( - oracle_rdbms=datastream_resources.OracleRdbms(oracle_schemas=[datastream_resources.OracleSchema(schema_name='schema_name_value')]), - ) - response = client.discover_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DiscoverConnectionProfileRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream.DiscoverConnectionProfileResponse) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.discover_connection_profile), - '__call__') as call: - client.discover_connection_profile() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DiscoverConnectionProfileRequest() - -@pytest.mark.asyncio -async def test_discover_connection_profile_async(transport: str = 'grpc_asyncio', request_type=datastream.DiscoverConnectionProfileRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.discover_connection_profile), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.DiscoverConnectionProfileResponse( - )) - response = await client.discover_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DiscoverConnectionProfileRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream.DiscoverConnectionProfileResponse) - - -@pytest.mark.asyncio -async def test_discover_connection_profile_async_from_dict(): - await test_discover_connection_profile_async(request_type=dict) - - -def test_discover_connection_profile_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.discover_connection_profile), - '__call__') as call: - call.return_value = datastream.DiscoverConnectionProfileResponse() - client.discover_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.discover_connection_profile), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.DiscoverConnectionProfileResponse()) - await client.discover_connection_profile(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@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, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - 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'], - ) - response = client.list_streams(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListStreamsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListStreamsPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_streams), - '__call__') as call: - client.list_streams() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListStreamsRequest() - -@pytest.mark.asyncio -async def test_list_streams_async(transport: str = 'grpc_asyncio', request_type=datastream.ListStreamsRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_streams), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListStreamsResponse( - next_page_token='next_page_token_value', - unreachable=['unreachable_value'], - )) - response = await client.list_streams(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListStreamsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListStreamsAsyncPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -@pytest.mark.asyncio -async def test_list_streams_async_from_dict(): - await test_list_streams_async(request_type=dict) - - -def test_list_streams_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_streams), - '__call__') as call: - call.return_value = datastream.ListStreamsResponse() - client.list_streams(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_streams), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListStreamsResponse()) - await client.list_streams(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_streams_flattened(): - 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: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_streams_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_list_streams_flattened_async(): - 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: - # Designate an appropriate return value for the call. - call.return_value = datastream.ListStreamsResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListStreamsResponse()) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_streams_flattened_error_async(): - 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', - ) - - -def test_list_streams_pager(transport_name: str = "grpc"): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_streams), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListStreamsResponse( - streams=[ - datastream_resources.Stream(), - datastream_resources.Stream(), - datastream_resources.Stream(), - ], - next_page_token='abc', - ), - datastream.ListStreamsResponse( - streams=[], - next_page_token='def', - ), - datastream.ListStreamsResponse( - streams=[ - datastream_resources.Stream(), - ], - next_page_token='ghi', - ), - datastream.ListStreamsResponse( - streams=[ - datastream_resources.Stream(), - datastream_resources.Stream(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_streams(request={}) - - assert pager._metadata == metadata - - 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, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_streams), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListStreamsResponse( - streams=[ - datastream_resources.Stream(), - datastream_resources.Stream(), - datastream_resources.Stream(), - ], - next_page_token='abc', - ), - datastream.ListStreamsResponse( - streams=[], - next_page_token='def', - ), - datastream.ListStreamsResponse( - streams=[ - datastream_resources.Stream(), - ], - next_page_token='ghi', - ), - datastream.ListStreamsResponse( - streams=[ - datastream_resources.Stream(), - datastream_resources.Stream(), - ], - ), - RuntimeError, - ) - pages = list(client.list_streams(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_streams_async_pager(): - 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__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListStreamsResponse( - streams=[ - datastream_resources.Stream(), - datastream_resources.Stream(), - datastream_resources.Stream(), - ], - next_page_token='abc', - ), - datastream.ListStreamsResponse( - streams=[], - next_page_token='def', - ), - datastream.ListStreamsResponse( - 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={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, datastream_resources.Stream) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_streams_async_pages(): - 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__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListStreamsResponse( - streams=[ - datastream_resources.Stream(), - datastream_resources.Stream(), - datastream_resources.Stream(), - ], - next_page_token='abc', - ), - datastream.ListStreamsResponse( - streams=[], - next_page_token='def', - ), - datastream.ListStreamsResponse( - 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: # 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, -]) -def test_get_stream(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_stream), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream_resources.Stream( - name='name_value', - display_name='display_name_value', - state=datastream_resources.Stream.State.CREATED, - backfill_all=datastream_resources.Stream.BackfillAllStrategy(oracle_excluded_objects=datastream_resources.OracleRdbms(oracle_schemas=[datastream_resources.OracleSchema(schema_name='schema_name_value')])), - ) - response = client.get_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetStreamRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream_resources.Stream) - assert response.name == 'name_value' - assert response.display_name == 'display_name_value' - assert response.state == datastream_resources.Stream.State.CREATED - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_stream), - '__call__') as call: - client.get_stream() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetStreamRequest() - -@pytest.mark.asyncio -async def test_get_stream_async(transport: str = 'grpc_asyncio', request_type=datastream.GetStreamRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_stream), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.Stream( - name='name_value', - display_name='display_name_value', - state=datastream_resources.Stream.State.CREATED, - )) - response = await client.get_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetStreamRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream_resources.Stream) - assert response.name == 'name_value' - assert response.display_name == 'display_name_value' - assert response.state == datastream_resources.Stream.State.CREATED - - -@pytest.mark.asyncio -async def test_get_stream_async_from_dict(): - await test_get_stream_async(request_type=dict) - - -def test_get_stream_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_stream), - '__call__') as call: - call.return_value = datastream_resources.Stream() - client.get_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_stream), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.Stream()) - await client.get_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_stream_flattened(): - 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: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_stream_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_get_stream_flattened_async(): - 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: - # Designate an appropriate return value for the call. - call.return_value = datastream_resources.Stream() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.Stream()) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_stream_flattened_error_async(): - 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', - ) - - -@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, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_stream), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.create_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreateStreamRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_stream), - '__call__') as call: - client.create_stream() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreateStreamRequest() - -@pytest.mark.asyncio -async def test_create_stream_async(transport: str = 'grpc_asyncio', request_type=datastream.CreateStreamRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_stream), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.create_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreateStreamRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_create_stream_async_from_dict(): - await test_create_stream_async(request_type=dict) - - -def test_create_stream_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_stream), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.create_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_stream), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.create_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_create_stream_flattened(): - 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: - # Designate an appropriate return value for the call. - 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.create_stream( - parent='parent_value', - stream=datastream_resources.Stream(name='name_value'), - stream_id='stream_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].stream - mock_val = datastream_resources.Stream(name='name_value') - assert arg == mock_val - arg = args[0].stream_id - mock_val = 'stream_id_value' - assert arg == mock_val - - -def test_create_stream_flattened_error(): - 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.create_stream( - datastream.CreateStreamRequest(), - parent='parent_value', - stream=datastream_resources.Stream(name='name_value'), - stream_id='stream_id_value', - ) - -@pytest.mark.asyncio -async def test_create_stream_flattened_async(): - 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: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_stream( - parent='parent_value', - stream=datastream_resources.Stream(name='name_value'), - stream_id='stream_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].stream - mock_val = datastream_resources.Stream(name='name_value') - assert arg == mock_val - arg = args[0].stream_id - mock_val = 'stream_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_create_stream_flattened_error_async(): - 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.create_stream( - datastream.CreateStreamRequest(), - parent='parent_value', - stream=datastream_resources.Stream(name='name_value'), - stream_id='stream_id_value', - ) - - -@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, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_stream), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.update_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.UpdateStreamRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_stream), - '__call__') as call: - client.update_stream() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.UpdateStreamRequest() - -@pytest.mark.asyncio -async def test_update_stream_async(transport: str = 'grpc_asyncio', request_type=datastream.UpdateStreamRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_stream), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.update_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.UpdateStreamRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_update_stream_async_from_dict(): - await test_update_stream_async(request_type=dict) - - -def test_update_stream_field_headers(): - 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 = '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: - call.return_value = operations_pb2.Operation(name='operations/op') - client.update_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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 = '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: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.update_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'stream.name=name_value', - ) in kw['metadata'] - - -def test_update_stream_flattened(): - 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: - # Designate an appropriate return value for the call. - 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.update_stream( - stream=datastream_resources.Stream(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].stream - mock_val = datastream_resources.Stream(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - - -def test_update_stream_flattened_error(): - 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.update_stream( - datastream.UpdateStreamRequest(), - stream=datastream_resources.Stream(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - -@pytest.mark.asyncio -async def test_update_stream_flattened_async(): - 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: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_stream( - stream=datastream_resources.Stream(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].stream - mock_val = datastream_resources.Stream(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - -@pytest.mark.asyncio -async def test_update_stream_flattened_error_async(): - 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.update_stream( - datastream.UpdateStreamRequest(), - stream=datastream_resources.Stream(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - -@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, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_stream), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.delete_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeleteStreamRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_stream), - '__call__') as call: - client.delete_stream() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeleteStreamRequest() - -@pytest.mark.asyncio -async def test_delete_stream_async(transport: str = 'grpc_asyncio', request_type=datastream.DeleteStreamRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_stream), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.delete_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeleteStreamRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_delete_stream_async_from_dict(): - await test_delete_stream_async(request_type=dict) - - -def test_delete_stream_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_stream), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.delete_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_stream), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.delete_stream(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_delete_stream_flattened(): - 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: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_delete_stream_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_delete_stream_flattened_async(): - 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: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_delete_stream_flattened_error_async(): - 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', - ) - - -@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, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.fetch_errors), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.fetch_errors(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.FetchErrorsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.fetch_errors), - '__call__') as call: - client.fetch_errors() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.FetchErrorsRequest() - -@pytest.mark.asyncio -async def test_fetch_errors_async(transport: str = 'grpc_asyncio', request_type=datastream.FetchErrorsRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.fetch_errors), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.fetch_errors(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.FetchErrorsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_fetch_errors_async_from_dict(): - await test_fetch_errors_async(request_type=dict) - - -def test_fetch_errors_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.fetch_errors), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.fetch_errors(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.fetch_errors), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.fetch_errors(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'stream=stream_value', - ) in kw['metadata'] - - -@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, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # 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: - # 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', - ) - response = client.fetch_static_ips(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.FetchStaticIpsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.FetchStaticIpsPager) - assert response.static_ips == ['static_ips_value'] - assert response.next_page_token == 'next_page_token_value' - - -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', - ) - - # 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: - client.fetch_static_ips() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.FetchStaticIpsRequest() - -@pytest.mark.asyncio -async def test_fetch_static_ips_async(transport: str = 'grpc_asyncio', request_type=datastream.FetchStaticIpsRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # 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: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.FetchStaticIpsResponse( - static_ips=['static_ips_value'], - next_page_token='next_page_token_value', - )) - response = await client.fetch_static_ips(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.FetchStaticIpsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.FetchStaticIpsAsyncPager) - assert response.static_ips == ['static_ips_value'] - assert response.next_page_token == 'next_page_token_value' - - -@pytest.mark.asyncio -async def test_fetch_static_ips_async_from_dict(): - await test_fetch_static_ips_async(request_type=dict) - - -def test_fetch_static_ips_field_headers(): - 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' - - # 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: - call.return_value = datastream.FetchStaticIpsResponse() - client.fetch_static_ips(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # 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: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.FetchStaticIpsResponse()) - await client.fetch_static_ips(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_fetch_static_ips_flattened(): - 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: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_fetch_static_ips_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_fetch_static_ips_flattened_async(): - 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: - # Designate an appropriate return value for the call. - call.return_value = datastream.FetchStaticIpsResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.FetchStaticIpsResponse()) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_fetch_static_ips_flattened_error_async(): - 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', - ) - - -def test_fetch_static_ips_pager(transport_name: str = "grpc"): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # 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: - # Set the response to a series of pages. - call.side_effect = ( - datastream.FetchStaticIpsResponse( - 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=[ - str(), - str(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('name', ''), - )), - ) - pager = client.fetch_static_ips(request={}) - - assert pager._metadata == metadata - - 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, - ) - - # 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: - # Set the response to a series of pages. - call.side_effect = ( - datastream.FetchStaticIpsResponse( - 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=[ - str(), - str(), - ], - ), - RuntimeError, - ) - pages = list(client.fetch_static_ips(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_fetch_static_ips_async_pager(): - 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__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.FetchStaticIpsResponse( - 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=[ - str(), - str(), - ], - ), - RuntimeError, - ) - async_pager = await client.fetch_static_ips(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, str) - for i in responses) - - -@pytest.mark.asyncio -async def test_fetch_static_ips_async_pages(): - 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__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.FetchStaticIpsResponse( - 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=[ - str(), - str(), - ], - ), - RuntimeError, - ) - 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, -]) -def test_create_private_connection(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_private_connection), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.create_private_connection(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreatePrivateConnectionRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_private_connection), - '__call__') as call: - client.create_private_connection() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreatePrivateConnectionRequest() - -@pytest.mark.asyncio -async def test_create_private_connection_async(transport: str = 'grpc_asyncio', request_type=datastream.CreatePrivateConnectionRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_private_connection), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.create_private_connection(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreatePrivateConnectionRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_create_private_connection_async_from_dict(): - await test_create_private_connection_async(request_type=dict) - - -def test_create_private_connection_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_private_connection), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.create_private_connection(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_private_connection), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.create_private_connection(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_create_private_connection_flattened(): - 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_private_connection), - '__call__') as call: - # Designate an appropriate return value for the call. - 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.create_private_connection( - parent='parent_value', - private_connection=datastream_resources.PrivateConnection(name='name_value'), - private_connection_id='private_connection_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].private_connection - mock_val = datastream_resources.PrivateConnection(name='name_value') - assert arg == mock_val - arg = args[0].private_connection_id - mock_val = 'private_connection_id_value' - assert arg == mock_val - - -def test_create_private_connection_flattened_error(): - 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.create_private_connection( - datastream.CreatePrivateConnectionRequest(), - parent='parent_value', - private_connection=datastream_resources.PrivateConnection(name='name_value'), - private_connection_id='private_connection_id_value', - ) - -@pytest.mark.asyncio -async def test_create_private_connection_flattened_async(): - 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_private_connection), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_private_connection( - parent='parent_value', - private_connection=datastream_resources.PrivateConnection(name='name_value'), - private_connection_id='private_connection_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].private_connection - mock_val = datastream_resources.PrivateConnection(name='name_value') - assert arg == mock_val - arg = args[0].private_connection_id - mock_val = 'private_connection_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_create_private_connection_flattened_error_async(): - 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.create_private_connection( - datastream.CreatePrivateConnectionRequest(), - parent='parent_value', - private_connection=datastream_resources.PrivateConnection(name='name_value'), - private_connection_id='private_connection_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - datastream.GetPrivateConnectionRequest, - dict, -]) -def test_get_private_connection(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_private_connection), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream_resources.PrivateConnection( - name='name_value', - display_name='display_name_value', - state=datastream_resources.PrivateConnection.State.CREATING, - ) - response = client.get_private_connection(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetPrivateConnectionRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream_resources.PrivateConnection) - assert response.name == 'name_value' - assert response.display_name == 'display_name_value' - assert response.state == datastream_resources.PrivateConnection.State.CREATING - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_private_connection), - '__call__') as call: - client.get_private_connection() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetPrivateConnectionRequest() - -@pytest.mark.asyncio -async def test_get_private_connection_async(transport: str = 'grpc_asyncio', request_type=datastream.GetPrivateConnectionRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_private_connection), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.PrivateConnection( - name='name_value', - display_name='display_name_value', - state=datastream_resources.PrivateConnection.State.CREATING, - )) - response = await client.get_private_connection(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetPrivateConnectionRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream_resources.PrivateConnection) - assert response.name == 'name_value' - assert response.display_name == 'display_name_value' - assert response.state == datastream_resources.PrivateConnection.State.CREATING - - -@pytest.mark.asyncio -async def test_get_private_connection_async_from_dict(): - await test_get_private_connection_async(request_type=dict) - - -def test_get_private_connection_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_private_connection), - '__call__') as call: - call.return_value = datastream_resources.PrivateConnection() - client.get_private_connection(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_private_connection), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.PrivateConnection()) - await client.get_private_connection(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_private_connection_flattened(): - 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_private_connection), - '__call__') as call: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_private_connection_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_get_private_connection_flattened_async(): - 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_private_connection), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream_resources.PrivateConnection() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.PrivateConnection()) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_private_connection_flattened_error_async(): - 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', - ) - - -@pytest.mark.parametrize("request_type", [ - datastream.ListPrivateConnectionsRequest, - dict, -]) -def test_list_private_connections(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_private_connections), - '__call__') 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'], - ) - response = client.list_private_connections(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListPrivateConnectionsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListPrivateConnectionsPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_private_connections), - '__call__') as call: - client.list_private_connections() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListPrivateConnectionsRequest() - -@pytest.mark.asyncio -async def test_list_private_connections_async(transport: str = 'grpc_asyncio', request_type=datastream.ListPrivateConnectionsRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_private_connections), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListPrivateConnectionsResponse( - next_page_token='next_page_token_value', - unreachable=['unreachable_value'], - )) - response = await client.list_private_connections(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListPrivateConnectionsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListPrivateConnectionsAsyncPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -@pytest.mark.asyncio -async def test_list_private_connections_async_from_dict(): - await test_list_private_connections_async(request_type=dict) - - -def test_list_private_connections_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_private_connections), - '__call__') as call: - call.return_value = datastream.ListPrivateConnectionsResponse() - client.list_private_connections(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_private_connections), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListPrivateConnectionsResponse()) - await client.list_private_connections(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_private_connections_flattened(): - 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_private_connections), - '__call__') as call: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_private_connections_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_list_private_connections_flattened_async(): - 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_private_connections), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream.ListPrivateConnectionsResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListPrivateConnectionsResponse()) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_private_connections_flattened_error_async(): - 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', - ) - - -def test_list_private_connections_pager(transport_name: str = "grpc"): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_private_connections), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListPrivateConnectionsResponse( - private_connections=[ - datastream_resources.PrivateConnection(), - datastream_resources.PrivateConnection(), - datastream_resources.PrivateConnection(), - ], - next_page_token='abc', - ), - datastream.ListPrivateConnectionsResponse( - private_connections=[], - next_page_token='def', - ), - datastream.ListPrivateConnectionsResponse( - private_connections=[ - datastream_resources.PrivateConnection(), - ], - next_page_token='ghi', - ), - datastream.ListPrivateConnectionsResponse( - private_connections=[ - datastream_resources.PrivateConnection(), - datastream_resources.PrivateConnection(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_private_connections(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, datastream_resources.PrivateConnection) - for i in results) -def test_list_private_connections_pages(transport_name: str = "grpc"): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_private_connections), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListPrivateConnectionsResponse( - private_connections=[ - datastream_resources.PrivateConnection(), - datastream_resources.PrivateConnection(), - datastream_resources.PrivateConnection(), - ], - next_page_token='abc', - ), - datastream.ListPrivateConnectionsResponse( - private_connections=[], - next_page_token='def', - ), - datastream.ListPrivateConnectionsResponse( - private_connections=[ - datastream_resources.PrivateConnection(), - ], - next_page_token='ghi', - ), - datastream.ListPrivateConnectionsResponse( - private_connections=[ - datastream_resources.PrivateConnection(), - datastream_resources.PrivateConnection(), - ], - ), - RuntimeError, - ) - pages = list(client.list_private_connections(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_private_connections_async_pager(): - 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_private_connections), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListPrivateConnectionsResponse( - private_connections=[ - datastream_resources.PrivateConnection(), - datastream_resources.PrivateConnection(), - datastream_resources.PrivateConnection(), - ], - next_page_token='abc', - ), - datastream.ListPrivateConnectionsResponse( - private_connections=[], - next_page_token='def', - ), - datastream.ListPrivateConnectionsResponse( - private_connections=[ - datastream_resources.PrivateConnection(), - ], - next_page_token='ghi', - ), - datastream.ListPrivateConnectionsResponse( - private_connections=[ - datastream_resources.PrivateConnection(), - datastream_resources.PrivateConnection(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_private_connections(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, datastream_resources.PrivateConnection) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_private_connections_async_pages(): - 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_private_connections), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListPrivateConnectionsResponse( - private_connections=[ - datastream_resources.PrivateConnection(), - datastream_resources.PrivateConnection(), - datastream_resources.PrivateConnection(), - ], - next_page_token='abc', - ), - datastream.ListPrivateConnectionsResponse( - private_connections=[], - next_page_token='def', - ), - datastream.ListPrivateConnectionsResponse( - private_connections=[ - datastream_resources.PrivateConnection(), - ], - next_page_token='ghi', - ), - datastream.ListPrivateConnectionsResponse( - private_connections=[ - datastream_resources.PrivateConnection(), - datastream_resources.PrivateConnection(), - ], - ), - RuntimeError, - ) - 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, -]) -def test_delete_private_connection(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_private_connection), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.delete_private_connection(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeletePrivateConnectionRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_private_connection), - '__call__') as call: - client.delete_private_connection() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeletePrivateConnectionRequest() - -@pytest.mark.asyncio -async def test_delete_private_connection_async(transport: str = 'grpc_asyncio', request_type=datastream.DeletePrivateConnectionRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_private_connection), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.delete_private_connection(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeletePrivateConnectionRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_delete_private_connection_async_from_dict(): - await test_delete_private_connection_async(request_type=dict) - - -def test_delete_private_connection_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_private_connection), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.delete_private_connection(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_private_connection), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.delete_private_connection(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_delete_private_connection_flattened(): - 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_private_connection), - '__call__') as call: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_delete_private_connection_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_delete_private_connection_flattened_async(): - 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_private_connection), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_delete_private_connection_flattened_error_async(): - 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', - ) - - -@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, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_route), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.create_route(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreateRouteRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_route), - '__call__') as call: - client.create_route() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreateRouteRequest() - -@pytest.mark.asyncio -async def test_create_route_async(transport: str = 'grpc_asyncio', request_type=datastream.CreateRouteRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_route), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.create_route(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreateRouteRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_create_route_async_from_dict(): - await test_create_route_async(request_type=dict) - - -def test_create_route_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_route), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.create_route(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_route), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.create_route(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_create_route_flattened(): - 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: - # Designate an appropriate return value for the call. - 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.create_route( - parent='parent_value', - route=datastream_resources.Route(name='name_value'), - route_id='route_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].route - mock_val = datastream_resources.Route(name='name_value') - assert arg == mock_val - arg = args[0].route_id - mock_val = 'route_id_value' - assert arg == mock_val - - -def test_create_route_flattened_error(): - 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.create_route( - datastream.CreateRouteRequest(), - parent='parent_value', - route=datastream_resources.Route(name='name_value'), - route_id='route_id_value', - ) - -@pytest.mark.asyncio -async def test_create_route_flattened_async(): - 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: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_route( - parent='parent_value', - route=datastream_resources.Route(name='name_value'), - route_id='route_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].route - mock_val = datastream_resources.Route(name='name_value') - assert arg == mock_val - arg = args[0].route_id - mock_val = 'route_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_create_route_flattened_error_async(): - 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.create_route( - datastream.CreateRouteRequest(), - parent='parent_value', - route=datastream_resources.Route(name='name_value'), - route_id='route_id_value', - ) - - -@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, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_route), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = datastream_resources.Route( - name='name_value', - display_name='display_name_value', - destination_address='destination_address_value', - destination_port=1734, - ) - response = client.get_route(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetRouteRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream_resources.Route) - assert response.name == 'name_value' - assert response.display_name == 'display_name_value' - assert response.destination_address == 'destination_address_value' - assert response.destination_port == 1734 - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_route), - '__call__') as call: - client.get_route() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetRouteRequest() - -@pytest.mark.asyncio -async def test_get_route_async(transport: str = 'grpc_asyncio', request_type=datastream.GetRouteRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_route), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.Route( - name='name_value', - display_name='display_name_value', - destination_address='destination_address_value', - destination_port=1734, - )) - response = await client.get_route(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetRouteRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, datastream_resources.Route) - assert response.name == 'name_value' - assert response.display_name == 'display_name_value' - assert response.destination_address == 'destination_address_value' - assert response.destination_port == 1734 - - -@pytest.mark.asyncio -async def test_get_route_async_from_dict(): - await test_get_route_async(request_type=dict) - - -def test_get_route_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_route), - '__call__') as call: - call.return_value = datastream_resources.Route() - client.get_route(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_route), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.Route()) - await client.get_route(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_route_flattened(): - 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: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_route_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_get_route_flattened_async(): - 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: - # Designate an appropriate return value for the call. - call.return_value = datastream_resources.Route() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream_resources.Route()) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_route_flattened_error_async(): - 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', - ) - - -@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, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - 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'], - ) - response = client.list_routes(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListRoutesRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListRoutesPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_routes), - '__call__') as call: - client.list_routes() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListRoutesRequest() - -@pytest.mark.asyncio -async def test_list_routes_async(transport: str = 'grpc_asyncio', request_type=datastream.ListRoutesRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_routes), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListRoutesResponse( - next_page_token='next_page_token_value', - unreachable=['unreachable_value'], - )) - response = await client.list_routes(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListRoutesRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListRoutesAsyncPager) - assert response.next_page_token == 'next_page_token_value' - assert response.unreachable == ['unreachable_value'] - - -@pytest.mark.asyncio -async def test_list_routes_async_from_dict(): - await test_list_routes_async(request_type=dict) - - -def test_list_routes_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_routes), - '__call__') as call: - call.return_value = datastream.ListRoutesResponse() - client.list_routes(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_routes), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListRoutesResponse()) - await client.list_routes(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_routes_flattened(): - 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: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_routes_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_list_routes_flattened_async(): - 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: - # Designate an appropriate return value for the call. - call.return_value = datastream.ListRoutesResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(datastream.ListRoutesResponse()) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_routes_flattened_error_async(): - 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', - ) - - -def test_list_routes_pager(transport_name: str = "grpc"): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_routes), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListRoutesResponse( - routes=[ - datastream_resources.Route(), - datastream_resources.Route(), - datastream_resources.Route(), - ], - next_page_token='abc', - ), - datastream.ListRoutesResponse( - routes=[], - next_page_token='def', - ), - datastream.ListRoutesResponse( - routes=[ - datastream_resources.Route(), - ], - next_page_token='ghi', - ), - datastream.ListRoutesResponse( - routes=[ - datastream_resources.Route(), - datastream_resources.Route(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_routes(request={}) - - assert pager._metadata == metadata - - 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, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_routes), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListRoutesResponse( - routes=[ - datastream_resources.Route(), - datastream_resources.Route(), - datastream_resources.Route(), - ], - next_page_token='abc', - ), - datastream.ListRoutesResponse( - routes=[], - next_page_token='def', - ), - datastream.ListRoutesResponse( - routes=[ - datastream_resources.Route(), - ], - next_page_token='ghi', - ), - datastream.ListRoutesResponse( - routes=[ - datastream_resources.Route(), - datastream_resources.Route(), - ], - ), - RuntimeError, - ) - pages = list(client.list_routes(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_routes_async_pager(): - 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__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListRoutesResponse( - routes=[ - datastream_resources.Route(), - datastream_resources.Route(), - datastream_resources.Route(), - ], - next_page_token='abc', - ), - datastream.ListRoutesResponse( - routes=[], - next_page_token='def', - ), - datastream.ListRoutesResponse( - routes=[ - datastream_resources.Route(), - ], - next_page_token='ghi', - ), - datastream.ListRoutesResponse( - routes=[ - datastream_resources.Route(), - datastream_resources.Route(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_routes(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, datastream_resources.Route) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_routes_async_pages(): - 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__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - datastream.ListRoutesResponse( - routes=[ - datastream_resources.Route(), - datastream_resources.Route(), - datastream_resources.Route(), - ], - next_page_token='abc', - ), - datastream.ListRoutesResponse( - routes=[], - next_page_token='def', - ), - datastream.ListRoutesResponse( - 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: # 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, -]) -def test_delete_route(request_type, transport: str = 'grpc'): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_route), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.delete_route(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeleteRouteRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -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', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_route), - '__call__') as call: - client.delete_route() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeleteRouteRequest() - -@pytest.mark.asyncio -async def test_delete_route_async(transport: str = 'grpc_asyncio', request_type=datastream.DeleteRouteRequest): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_route), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.delete_route(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeleteRouteRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_delete_route_async_from_dict(): - await test_delete_route_async(request_type=dict) - - -def test_delete_route_field_headers(): - 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_route), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.delete_route(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - 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(), - ) - - # 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' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_route), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.delete_route(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_delete_route_flattened(): - 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: - # Designate an appropriate return value for the call. - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_delete_route_flattened_error(): - 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', - ) - -@pytest.mark.asyncio -async def test_delete_route_flattened_async(): - 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: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_delete_route_flattened_error_async(): - 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', - ) - - -def test_credentials_transport_error(): - # It is an error to provide credentials and a transport instance. - transport = transports.DatastreamGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # It is an error to provide a credentials file and a transport instance. - transport = transports.DatastreamGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = DatastreamClient( - client_options={"credentials_file": "credentials.json"}, - transport=transport, - ) - - # It is an error to provide an api_key and a transport instance. - transport = transports.DatastreamGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - options = client_options.ClientOptions() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = DatastreamClient( - client_options=options, - transport=transport, - ) - - # It is an error to provide an api_key and a credential. - options = mock.Mock() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = DatastreamClient( - client_options=options, - credentials=ga_credentials.AnonymousCredentials() - ) - - # It is an error to provide scopes and a transport instance. - transport = transports.DatastreamGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = DatastreamClient( - client_options={"scopes": ["1", "2"]}, - transport=transport, - ) - - -def test_transport_instance(): - # A client may be instantiated with a custom transport instance. - transport = transports.DatastreamGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - client = DatastreamClient(transport=transport) - assert client.transport is transport - -def test_transport_get_channel(): - # A client may be instantiated with a custom transport instance. - transport = transports.DatastreamGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - - transport = transports.DatastreamGrpcAsyncIOTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - -@pytest.mark.parametrize("transport_class", [ - transports.DatastreamGrpcTransport, - transports.DatastreamGrpcAsyncIOTransport, -]) -def test_transport_adc(transport_class): - # Test default credentials are used if not provided. - with mock.patch.object(google.auth, 'default') as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - 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, - ) - -def test_datastream_base_transport_error(): - # Passing both a credentials object and credentials_file should raise an error - with pytest.raises(core_exceptions.DuplicateCredentialArgs): - transport = transports.DatastreamTransport( - credentials=ga_credentials.AnonymousCredentials(), - credentials_file="credentials.json" - ) - - -def test_datastream_base_transport(): - # Instantiate the base transport. - with mock.patch('google.cloud.datastream_v1alpha1.services.datastream.transports.DatastreamTransport.__init__') as Transport: - Transport.return_value = None - transport = transports.DatastreamTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Every method on the transport should just blindly - # raise NotImplementedError. - methods = ( - 'list_connection_profiles', - 'get_connection_profile', - 'create_connection_profile', - 'update_connection_profile', - 'delete_connection_profile', - 'discover_connection_profile', - 'list_streams', - 'get_stream', - 'create_stream', - 'update_stream', - 'delete_stream', - 'fetch_errors', - 'fetch_static_ips', - 'create_private_connection', - 'get_private_connection', - 'list_private_connections', - 'delete_private_connection', - 'create_route', - 'get_route', - 'list_routes', - 'delete_route', - ) - for method in methods: - with pytest.raises(NotImplementedError): - getattr(transport, method)(request=object()) - - with pytest.raises(NotImplementedError): - transport.close() - - # Additionally, the LRO client (a property) should - # also raise NotImplementedError - 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 - with mock.patch.object(google.auth, 'load_credentials_from_file', autospec=True) as load_creds, mock.patch('google.cloud.datastream_v1alpha1.services.datastream.transports.DatastreamTransport._prep_wrapped_messages') as Transport: - Transport.return_value = None - load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.DatastreamTransport( - credentials_file="credentials.json", - quota_project_id="octopus", - ) - load_creds.assert_called_once_with("credentials.json", - scopes=None, - default_scopes=( - 'https://www.googleapis.com/auth/cloud-platform', -), - quota_project_id="octopus", - ) - - -def test_datastream_base_transport_with_adc(): - # Test the default credentials are used if credentials and credentials_file are None. - with mock.patch.object(google.auth, 'default', autospec=True) as adc, mock.patch('google.cloud.datastream_v1alpha1.services.datastream.transports.DatastreamTransport._prep_wrapped_messages') as Transport: - Transport.return_value = None - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.DatastreamTransport() - adc.assert_called_once() - - -def test_datastream_auth_adc(): - # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(google.auth, 'default', autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - DatastreamClient() - adc.assert_called_once_with( - scopes=None, - default_scopes=( - 'https://www.googleapis.com/auth/cloud-platform', -), - quota_project_id=None, - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.DatastreamGrpcTransport, - transports.DatastreamGrpcAsyncIOTransport, - ], -) -def test_datastream_transport_auth_adc(transport_class): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, 'default', autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class(quota_project_id="octopus", scopes=["1", "2"]) - adc.assert_called_once_with( - scopes=["1", "2"], - default_scopes=( 'https://www.googleapis.com/auth/cloud-platform',), - quota_project_id="octopus", - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.DatastreamGrpcTransport, - transports.DatastreamGrpcAsyncIOTransport, - ], -) -def test_datastream_transport_auth_gdch_credentials(transport_class): - host = 'https://language.com' - api_audience_tests = [None, 'https://language2.com'] - api_audience_expect = [host, 'https://language2.com'] - for t, e in zip(api_audience_tests, api_audience_expect): - with mock.patch.object(google.auth, 'default', autospec=True) as adc: - gdch_mock = mock.MagicMock() - type(gdch_mock).with_gdch_audience = mock.PropertyMock(return_value=gdch_mock) - adc.return_value = (gdch_mock, None) - transport_class(host=host, api_audience=t) - gdch_mock.with_gdch_audience.assert_called_once_with( - e - ) - - -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.DatastreamGrpcTransport, grpc_helpers), - (transports.DatastreamGrpcAsyncIOTransport, grpc_helpers_async) - ], -) -def test_datastream_transport_create_channel(transport_class, grpc_helpers): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch.object( - grpc_helpers, "create_channel", autospec=True - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - adc.return_value = (creds, None) - transport_class( - quota_project_id="octopus", - scopes=["1", "2"] - ) - - create_channel.assert_called_with( - "datastream.googleapis.com:443", - credentials=creds, - credentials_file=None, - quota_project_id="octopus", - default_scopes=( - 'https://www.googleapis.com/auth/cloud-platform', -), - scopes=["1", "2"], - default_host="datastream.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize("transport_class", [transports.DatastreamGrpcTransport, transports.DatastreamGrpcAsyncIOTransport]) -def test_datastream_grpc_transport_client_cert_source_for_mtls( - transport_class -): - cred = ga_credentials.AnonymousCredentials() - - # Check ssl_channel_credentials is used if provided. - with mock.patch.object(transport_class, "create_channel") as mock_create_channel: - mock_ssl_channel_creds = mock.Mock() - transport_class( - host="squid.clam.whelk", - credentials=cred, - ssl_channel_credentials=mock_ssl_channel_creds - ) - mock_create_channel.assert_called_once_with( - "squid.clam.whelk:443", - credentials=cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_channel_creds, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls - # is used. - with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): - with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: - transport_class( - credentials=cred, - client_cert_source_for_mtls=client_cert_source_callback - ) - expected_cert, expected_key = client_cert_source_callback() - mock_ssl_cred.assert_called_once_with( - certificate_chain=expected_cert, - private_key=expected_key - ) - - -@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' - ) - -@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' - ) - -def test_datastream_grpc_transport_channel(): - channel = grpc.secure_channel('http://localhost/', grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.DatastreamGrpcTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - assert transport._ssl_channel_credentials == None - - -def test_datastream_grpc_asyncio_transport_channel(): - channel = aio.secure_channel('http://localhost/', grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.DatastreamGrpcAsyncIOTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - assert transport._ssl_channel_credentials == None - - -# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are -# removed from grpc/grpc_asyncio transport constructor. -@pytest.mark.parametrize("transport_class", [transports.DatastreamGrpcTransport, transports.DatastreamGrpcAsyncIOTransport]) -def test_datastream_transport_channel_mtls_with_client_cert_source( - transport_class -): - with mock.patch("grpc.ssl_channel_credentials", autospec=True) as grpc_ssl_channel_cred: - with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: - mock_ssl_cred = mock.Mock() - grpc_ssl_channel_cred.return_value = mock_ssl_cred - - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - - cred = ga_credentials.AnonymousCredentials() - with pytest.warns(DeprecationWarning): - with mock.patch.object(google.auth, 'default') as adc: - adc.return_value = (cred, None) - transport = transport_class( - host="squid.clam.whelk", - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=client_cert_source_callback, - ) - adc.assert_called_once() - - grpc_ssl_channel_cred.assert_called_once_with( - certificate_chain=b"cert bytes", private_key=b"key bytes" - ) - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - assert transport._ssl_channel_credentials == mock_ssl_cred - - -# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are -# removed from grpc/grpc_asyncio transport constructor. -@pytest.mark.parametrize("transport_class", [transports.DatastreamGrpcTransport, transports.DatastreamGrpcAsyncIOTransport]) -def test_datastream_transport_channel_mtls_with_adc( - transport_class -): - mock_ssl_cred = mock.Mock() - with mock.patch.multiple( - "google.auth.transport.grpc.SslCredentials", - __init__=mock.Mock(return_value=None), - ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), - ): - with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - mock_cred = mock.Mock() - - with pytest.warns(DeprecationWarning): - transport = transport_class( - host="squid.clam.whelk", - credentials=mock_cred, - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=None, - ) - - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=mock_cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - - -def test_datastream_grpc_lro_client(): - client = DatastreamClient( - 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, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -def test_datastream_grpc_lro_async_client(): - client = DatastreamAsyncClient( - 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, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -def test_connection_profile_path(): - project = "squid" - location = "clam" - connection_profile = "whelk" - expected = "projects/{project}/locations/{location}/connectionProfiles/{connection_profile}".format(project=project, location=location, connection_profile=connection_profile, ) - actual = DatastreamClient.connection_profile_path(project, location, connection_profile) - assert expected == actual - - -def test_parse_connection_profile_path(): - expected = { - "project": "octopus", - "location": "oyster", - "connection_profile": "nudibranch", - } - path = DatastreamClient.connection_profile_path(**expected) - - # Check that the path construction is reversible. - actual = DatastreamClient.parse_connection_profile_path(path) - assert expected == actual - -def test_private_connection_path(): - project = "cuttlefish" - location = "mussel" - private_connection = "winkle" - expected = "projects/{project}/locations/{location}/privateConnections/{private_connection}".format(project=project, location=location, private_connection=private_connection, ) - actual = DatastreamClient.private_connection_path(project, location, private_connection) - assert expected == actual - - -def test_parse_private_connection_path(): - expected = { - "project": "nautilus", - "location": "scallop", - "private_connection": "abalone", - } - path = DatastreamClient.private_connection_path(**expected) - - # Check that the path construction is reversible. - actual = DatastreamClient.parse_private_connection_path(path) - assert expected == actual - -def test_route_path(): - project = "squid" - location = "clam" - private_connection = "whelk" - route = "octopus" - expected = "projects/{project}/locations/{location}/privateConnections/{private_connection}/routes/{route}".format(project=project, location=location, private_connection=private_connection, route=route, ) - actual = DatastreamClient.route_path(project, location, private_connection, route) - assert expected == actual - - -def test_parse_route_path(): - expected = { - "project": "oyster", - "location": "nudibranch", - "private_connection": "cuttlefish", - "route": "mussel", - } - path = DatastreamClient.route_path(**expected) - - # Check that the path construction is reversible. - actual = DatastreamClient.parse_route_path(path) - assert expected == actual - -def test_stream_path(): - project = "winkle" - location = "nautilus" - stream = "scallop" - expected = "projects/{project}/locations/{location}/streams/{stream}".format(project=project, location=location, stream=stream, ) - actual = DatastreamClient.stream_path(project, location, stream) - assert expected == actual - - -def test_parse_stream_path(): - expected = { - "project": "abalone", - "location": "squid", - "stream": "clam", - } - path = DatastreamClient.stream_path(**expected) - - # Check that the path construction is reversible. - actual = DatastreamClient.parse_stream_path(path) - assert expected == actual - -def test_common_billing_account_path(): - billing_account = "whelk" - expected = "billingAccounts/{billing_account}".format(billing_account=billing_account, ) - actual = DatastreamClient.common_billing_account_path(billing_account) - assert expected == actual - - -def test_parse_common_billing_account_path(): - expected = { - "billing_account": "octopus", - } - path = DatastreamClient.common_billing_account_path(**expected) - - # Check that the path construction is reversible. - actual = DatastreamClient.parse_common_billing_account_path(path) - assert expected == actual - -def test_common_folder_path(): - folder = "oyster" - expected = "folders/{folder}".format(folder=folder, ) - actual = DatastreamClient.common_folder_path(folder) - assert expected == actual - - -def test_parse_common_folder_path(): - expected = { - "folder": "nudibranch", - } - path = DatastreamClient.common_folder_path(**expected) - - # Check that the path construction is reversible. - actual = DatastreamClient.parse_common_folder_path(path) - assert expected == actual - -def test_common_organization_path(): - organization = "cuttlefish" - expected = "organizations/{organization}".format(organization=organization, ) - actual = DatastreamClient.common_organization_path(organization) - assert expected == actual - - -def test_parse_common_organization_path(): - expected = { - "organization": "mussel", - } - path = DatastreamClient.common_organization_path(**expected) - - # Check that the path construction is reversible. - actual = DatastreamClient.parse_common_organization_path(path) - assert expected == actual - -def test_common_project_path(): - project = "winkle" - expected = "projects/{project}".format(project=project, ) - actual = DatastreamClient.common_project_path(project) - assert expected == actual - - -def test_parse_common_project_path(): - expected = { - "project": "nautilus", - } - path = DatastreamClient.common_project_path(**expected) - - # Check that the path construction is reversible. - actual = DatastreamClient.parse_common_project_path(path) - assert expected == actual - -def test_common_location_path(): - project = "scallop" - location = "abalone" - expected = "projects/{project}/locations/{location}".format(project=project, location=location, ) - actual = DatastreamClient.common_location_path(project, location) - assert expected == actual - - -def test_parse_common_location_path(): - expected = { - "project": "squid", - "location": "clam", - } - path = DatastreamClient.common_location_path(**expected) - - # Check that the path construction is reversible. - actual = DatastreamClient.parse_common_location_path(path) - assert expected == actual - - -def test_client_with_default_client_info(): - client_info = gapic_v1.client_info.ClientInfo() - - with mock.patch.object(transports.DatastreamTransport, '_prep_wrapped_messages') as prep: - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - with mock.patch.object(transports.DatastreamTransport, '_prep_wrapped_messages') as prep: - transport_class = DatastreamClient.get_transport_class() - transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - -@pytest.mark.asyncio -async def test_transport_close_async(): - client = DatastreamAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc_asyncio", - ) - with mock.patch.object(type(getattr(client.transport, "grpc_channel")), "close") as close: - async with client: - close.assert_not_called() - close.assert_called_once() - - -def test_transport_close(): - transports = { - "grpc": "_grpc_channel", - } - - for transport, close_name in transports.items(): - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport - ) - with mock.patch.object(type(getattr(client.transport, close_name)), "close") as close: - with client: - close.assert_not_called() - close.assert_called_once() - -def test_client_ctx(): - transports = [ - 'grpc', - ] - for transport in transports: - client = DatastreamClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport - ) - # Test client calls underlying transport. - with mock.patch.object(type(client.transport), "close") as close: - close.assert_not_called() - with client: - pass - close.assert_called() - -@pytest.mark.parametrize("client_class,transport_class", [ - (DatastreamClient, transports.DatastreamGrpcTransport), - (DatastreamAsyncClient, transports.DatastreamGrpcAsyncIOTransport), -]) -def test_api_key_credentials(client_class, transport_class): - with mock.patch.object( - google.auth._default, "get_api_key_credentials", create=True - ) as get_api_key_credentials: - mock_cred = mock.Mock() - get_api_key_credentials.return_value = mock_cred - options = client_options.ClientOptions() - options.api_key = "api_key" - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options) - patched.assert_called_once_with( - credentials=mock_cred, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) diff --git a/setup.py b/setup.py index 7a68c07..1e90b8f 100644 --- a/setup.py +++ b/setup.py @@ -56,9 +56,7 @@ if package.startswith("google") ] -namespaces = ["google"] -if "google.cloud" in packages: - namespaces.append("google.cloud") +namespaces = ["google", "google.cloud"] setuptools.setup( name=name,